Class: Jquery::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/jquery/install/install_generator.rb

Constant Summary collapse

@@jquery_version =
"1.6.1"
@@jquery_ui_version =
"1.8.12"
@@jquery_ujs_version =
"dad6982dc592686677e6845e681233c40d2ead27"

Instance Method Summary collapse

Instance Method Details

#copy_jqueryObject



20
21
22
23
24
# File 'lib/generators/jquery/install/install_generator.rb', line 20

def copy_jquery
  say_status("copying", "jQuery (#{@@jquery_version})", :green)
  copy_file "jquery.js", "public/javascripts/jquery.js"
  copy_file "jquery.min.js", "public/javascripts/jquery.min.js"
end

#copy_jquery_uiObject



26
27
28
29
30
31
32
# File 'lib/generators/jquery/install/install_generator.rb', line 26

def copy_jquery_ui
  if options.ui?
    say_status("copying", "jQuery UI (#{@@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_driverObject



34
35
36
37
38
# File 'lib/generators/jquery/install/install_generator.rb', line 34

def copy_ujs_driver
  say_status("copying", "jQuery UJS adapter (#{@@jquery_ujs_version[0..5]})", :green)
  remove_file "public/javascripts/rails.js"
  copy_file "jquery_ujs.js", "public/javascripts/jquery_ujs.js"
end

#remove_prototypeObject



14
15
16
17
18
# File 'lib/generators/jquery/install/install_generator.rb', line 14

def remove_prototype
  PROTOTYPE_JS.each do |name|
    remove_file "public/javascripts/#{name}.js"
  end
end