Sha256: f25784b371c7ce0380f488c335f334952280dc2ad0befddfe6bac711ce80d0a9

Contents?: true

Size: 888 Bytes

Versions: 13

Compression:

Stored size: 888 Bytes

Contents

require 'rails/generators'

module Databound
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)
      desc 'This generator adds Databound to the asset pipeline'

      def add_assets
        js_manifest = 'app/assets/javascripts/application.js'
        coffee_manifest = 'app/assets/javascripts/application.js.coffee'

        if File.exist?(js_manifest)
          insert_into_file js_manifest, "//= require databound\n", after: "jquery_ujs\n"
        elsif File.exist?(coffee_manifest)
          insert_into_file coffee_manifest, "#= require databound\n", after: "jquery_ujs\n"
        else
          copy_file 'application.js', js_manifest
        end
      end

      def add_databound
        copy_file 'databound-standalone.js', 'vendor/assets/javascripts/databound.js'
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
databound-3.1.3 lib/generators/databound/install/install_generator.rb
databound-3.1.2 lib/generators/databound/install/install_generator.rb
databound-3.1.1 lib/generators/databound/install/install_generator.rb
databound-3.1.0 lib/generators/databound/install/install_generator.rb
databound-3.0.3 lib/generators/databound/install/install_generator.rb
databound-3.0.2 lib/generators/databound/install/install_generator.rb
databound-3.0.1 lib/generators/databound/install/install_generator.rb
databound-3.0.0 lib/generators/databound/install/install_generator.rb
databound-2.0.1 lib/generators/databound/install/install_generator.rb
databound-2.0.0 lib/generators/databound/install/install_generator.rb
databound-1.1.0 lib/generators/databound/install/install_generator.rb
databound-1.0.2 lib/generators/databound/install/install_generator.rb
databound-1.0.1 lib/generators/databound/install/install_generator.rb