Sha256: 4ab7c081f9f1c6312056e25bbdb32947d80752b46e72ea9ae93633535d8a1913
Contents?: true
Size: 1.48 KB
Versions: 4
Compression:
Stored size: 1.48 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 Sugar module Generators class InstallGenerator < ::Rails::Generators::Base desc "This generator installs SugarJS #{Sugar::Rails::SUGARJS_VERSION}" source_root File.expand_path("../../../../../vendor/assets", __FILE__) def copy_javascript say_status("copying", "Sugar JS", :green) copy_file "javascripts/sugar.js", "public/javascripts/sugar.js" end end end end else module Sugar 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 with 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 sugar` to your app/assets/javascripts/application.js") say_status("", "If you upgraded your app from Rails 3.0 and still have sugar.js in your public assets folders, be sure to remove them.") 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
4 entries across 4 versions & 1 rubygems