@@ -4,7 +4,7 @@ class InstallGenerator < ::Rails::Generators::Base
4
4
desc "This generator downloads and installs jQuery, jQuery-ujs HEAD, and (optionally) jQuery UI 1.8.4"
5
5
class_option :ui , :type => :boolean , :default => false , :desc => "Whether to Include JQueryUI"
6
6
class_option :version , :type => :string , :default => "1.4.1" , :desc => "Which version of JQuery to fetch"
7
- @@versions = %w( 1.4.2 1.4.1 1.4.0 1.3.2 1.3.1 1.3.0 1.2.6 )
7
+ @@versions = %w( 1.4.3 1.4. 2 1.4.1 1.4.0 1.3.2 1.3.1 1.3.0 1.2.6 )
8
8
9
9
10
10
def remove_prototype
@@ -20,14 +20,22 @@ def download_jquery
20
20
get "http://ajax.googleapis.com/ajax/libs/jquery/#{ options . version } /jquery.min.js" , "public/javascripts/jquery.min.js"
21
21
get "http://ajax.googleapis.com/ajax/libs/jquery/#{ options . version } /jquery.js" , "public/javascripts/jquery.js"
22
22
else
23
- puts "JQuery #{ options . version } is invalid; fetching #{ @@versions [ 1 ] } instead."
24
- get "http://ajax.googleapis.com/ajax/libs/jquery/#{ @@versions [ 1 ] } /jquery.min.js" , "public/javascripts/jquery.min.js"
25
- get "http://ajax.googleapis.com/ajax/libs/jquery/#{ @@versions [ 1 ] } /jquery.js" , "public/javascripts/jquery.js"
23
+ # Try to get it anyway
24
+ begin
25
+ puts "Trying to fetch JQuery version #{ options . version } , even though I don't know about it.'"
26
+ get "http://ajax.googleapis.com/ajax/libs/jquery/#{ options . version } /jquery.min.js" , "public/javascripts/jquery.min.js"
27
+ get "http://ajax.googleapis.com/ajax/libs/jquery/#{ options . version } /jquery.js" , "public/javascripts/jquery.js"
28
+ puts "Success"
29
+ rescue
30
+ puts "JQuery #{ options . version } is invalid; fetching #{ @@versions [ 2 ] } instead."
31
+ get "http://ajax.googleapis.com/ajax/libs/jquery/#{ @@versions [ 2 ] } /jquery.min.js" , "public/javascripts/jquery.min.js"
32
+ get "http://ajax.googleapis.com/ajax/libs/jquery/#{ @@versions [ 2 ] } /jquery.js" , "public/javascripts/jquery.js"
33
+ end
26
34
end
27
35
28
36
# Downloading latest jQueryUI minified
29
- get "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4 /jquery-ui.min.js" , "public/javascripts/jquery-ui.min.js" if options . ui?
30
- get "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4 /jquery-ui.js" , "public/javascripts/jquery-ui.js" if options . ui?
37
+ get "http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" , "public/javascripts/jquery-ui.min.js" if options . ui?
38
+ get "http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js" , "public/javascripts/jquery-ui.js" if options . ui?
31
39
end
32
40
33
41
def download_ujs_driver
0 commit comments