Class: Jquery::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Jquery::InstallGenerator
- Defined in:
- lib/generators/jquery/install/install_generator.rb
Constant Summary collapse
- PATH =
source_root File.('../templates', __FILE__)
- JS_DEST =
"public/javascripts"
- CSS_DEST =
"public/stylesheets"
Instance Method Summary collapse
Instance Method Details
#install_jquery ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/generators/jquery/install/install_generator.rb', line 21 def install_jquery version = ([:version].nil?)? "1" : [:version] ui_version = ([:ui_version].nil?)? "1" : [:ui_version] url = "http://ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js" #puts url get url, "#{JS_DEST}/jquery.js" get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "#{JS_DEST}/rails.js" url = "http://ajax.googleapis.com/ajax/libs/jqueryui/#{ui_version}/jquery-ui.min.js" #puts url if .ui? get url, "#{JS_DEST}/jquery-ui.js" end end |
#remove_prototype ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/generators/jquery/install/install_generator.rb', line 13 def remove_prototype old_scripts = %w(controls dragdrop effects prototype) old_scripts.each do |script| path = "#{JS_DEST}/#{script}.js" remove_file path if File.exist? path end end |