Class: Jquery::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Jquery::Generators::InstallGenerator
- Defined in:
- lib/generators/jquery/install/install_generator.rb,
lib/generators/jquery/install/install_generator.rb
Instance Method Summary collapse
- #copy_jquery ⇒ Object
- #copy_jquery_ui ⇒ Object
- #copy_ujs_driver ⇒ Object
- #do_nothing ⇒ Object
- #remove_prototype ⇒ Object
Instance Method Details
#copy_jquery ⇒ Object
19 20 21 22 23 |
# File 'lib/generators/jquery/install/install_generator.rb', line 19 def copy_jquery say_status("copying", "jQuery (#{Jquery::Rails::JQUERY_VERSION})", :green) copy_file "jquery.js", "public/javascripts/jquery.js" copy_file "jquery.min.js", "public/javascripts/jquery.min.js" end |
#copy_jquery_ui ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/generators/jquery/install/install_generator.rb', line 25 def copy_jquery_ui if .ui? say_status("copying", "jQuery UI (#{Jquery::Rails::JQUERY_UI_VERSION})", :green) copy_file "jquery-ui.js", "public/javascripts/jquery-ui.js" copy_file "jquery-ui.min.js", "public/javascripts/jquery-ui.min.js" end end |
#copy_ujs_driver ⇒ Object
33 34 35 36 37 |
# File 'lib/generators/jquery/install/install_generator.rb', line 33 def copy_ujs_driver say_status("copying", "jQuery UJS adapter (#{Jquery::Rails::JQUERY_UJS_VERSION[0..5]})", :green) remove_file "public/javascripts/rails.js" copy_file "jquery_ujs.js", "public/javascripts/jquery_ujs.js" end |
#do_nothing ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/generators/jquery/install/install_generator.rb', line 48 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 jquery` and `//= require jquery_ujs` to your app/assets/javascripts/application.js") say_status("", "If you upgraded your app from Rails 3.0 and still have jquery.js, rails.js, or jquery_ujs.js in your javascripts, 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 |
#remove_prototype ⇒ Object
13 14 15 16 17 |
# File 'lib/generators/jquery/install/install_generator.rb', line 13 def remove_prototype Rails::PROTOTYPE_JS.each do |name| remove_file "public/javascripts/#{name}.js" end end |