Sha256: d9d54ab505eb772587639183bff877672123437486f993e16ccf8b8180c0cbdb

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

require 'rails'

# Supply generator for Rails 3.0.x or if asset pipeline is not enabled
if ::Rails.version < "3.1" || !::Rails.application.config.assets.enabled
  module Inflectionjs
    module Generators
      class InstallGenerator < ::Rails::Generators::Base

        desc "This generator installs inflection-js #{Inflectionjs::Rails::INFLECTION_JS_VERSION}"
        source_root File.expand_path('../../../../../vendor/assets/javascripts', __FILE__)

        def copy_inflectionjs
          say_status("copying", "inflection-js (#{Inflectionjs::Rails::INFLECTION_JS_VERSION})", :green)
          copy_file "inflection.js", "public/javascripts/inflection.js"
        end

      end
    end
  end
else
  module Inflectionjs
    module Generators
      class InstallGenerator < ::Rails::Generators::Base
        desc "Just show instructions so people will know what to do when mistakenly using generator for Rails 3.1 apps"

        def do_nothing
          say_status("deprecated", "You are using Rails 3.1 or the asset pipeline enabled, so this generator is not needed.")
          say_status("", "The necessary files are already in your asset pipeline.")
          say_status("", "Just add `//= require inflection` to your app/assets/javascripts/application.js")
          say_status("", "If you do not want the asset pipeline enabled, you may turn it off in application.rb and re-run this generator.")
          # ok, nothing
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inflection-js-rails-0.1.1 lib/generators/inflectionjs/install/install_generator.rb