Class: JqueryUnderscore::Generators::InstallGenerator

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

Constant Summary collapse

@@default_version =
"1.5"

Instance Method Summary collapse

Instance Method Details

#download_jqueryObject



15
16
17
18
19
20
21
22
# File 'lib/generators/jquery_underscore/install/install_generator.rb', line 15

def download_jquery
  say_status("fetching", "jQuery (#{options.version})", :green)
  get_jquery(options.version)
rescue OpenURI::HTTPError
  say_status("warning", "could not find jQuery (#{options.version})", :yellow)
  say_status("fetching", "jQuery (#{@@default_version})", :green)
  get_jquery(@@default_version)
end

#download_jquery_uiObject



24
25
26
27
28
29
30
# File 'lib/generators/jquery_underscore/install/install_generator.rb', line 24

def download_jquery_ui
  if options.ui?
    say_status("fetching", "jQuery UI (latest 1.x release)", :green)
    get "http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js",     "public/javascripts/jquery-ui.js"
    get "http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js", "public/javascripts/jquery-ui.min.js"
  end
end

#download_ujs_driverObject



38
39
40
41
# File 'lib/generators/jquery_underscore/install/install_generator.rb', line 38

def download_ujs_driver
  say_status("fetching", "jQuery UJS adapter (github HEAD)", :green)
  get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
end

#download_underscoreObject



32
33
34
35
36
# File 'lib/generators/jquery_underscore/install/install_generator.rb', line 32

def download_underscore
  say_status("fetching", "Underscore latest", :green)
  get "http://documentcloud.github.com/underscore/underscore.js",     "public/javascripts/underscore.js"
  get "http://documentcloud.github.com/underscore/underscore-min.js", "public/javascripts/underscore.min.js" 
end

#remove_prototypeObject



9
10
11
12
13
# File 'lib/generators/jquery_underscore/install/install_generator.rb', line 9

def remove_prototype
  %w(controls.js dragdrop.js effects.js prototype.js).each do |js|
    remove_file "public/javascripts/#{js}"
  end
end