jquery-rails 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of jquery-rails might be problematic. Click here for more details.

data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  pkg/*
2
2
  tmp
3
3
  spec/support/*/Gemfile.lock
4
+ spec/support/*/public/javascripts
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 0.2.4 (16 October 2010)
2
+
3
+ Features:
4
+
5
+ - Updated to use the new jQuery 1.4.3 by default, with the IE .live() bug fixed
6
+ - Always download the newest 1.x release of jQuery UI
7
+ - Try to install unknown versions of jQuery, with fallback to the default
8
+ - Print informative messages in the correct Generator style
9
+
10
+ ## 0.2.3 (13 October 2010)
11
+
12
+ Features:
13
+
14
+ - Support Edge Rails 3.1 by depending on Rails ~>3.0
15
+ - Add Sam Ruby's assert_select_jquery test helper method
16
+ - Use jquery.min only in production (and not in the test env)
17
+
1
18
  ## 0.2.2 (8 October 2010)
2
19
 
3
20
  Feature:
data/Gemfile.lock ADDED
@@ -0,0 +1,87 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jquery-rails (0.2.3)
5
+ rails (~> 3.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ abstract (1.0.0)
11
+ actionmailer (3.0.1)
12
+ actionpack (= 3.0.1)
13
+ mail (~> 2.2.5)
14
+ actionpack (3.0.1)
15
+ activemodel (= 3.0.1)
16
+ activesupport (= 3.0.1)
17
+ builder (~> 2.1.2)
18
+ erubis (~> 2.6.6)
19
+ i18n (~> 0.4.1)
20
+ rack (~> 1.2.1)
21
+ rack-mount (~> 0.6.12)
22
+ rack-test (~> 0.5.4)
23
+ tzinfo (~> 0.3.23)
24
+ activemodel (3.0.1)
25
+ activesupport (= 3.0.1)
26
+ builder (~> 2.1.2)
27
+ i18n (~> 0.4.1)
28
+ activerecord (3.0.1)
29
+ activemodel (= 3.0.1)
30
+ activesupport (= 3.0.1)
31
+ arel (~> 1.0.0)
32
+ tzinfo (~> 0.3.23)
33
+ activeresource (3.0.1)
34
+ activemodel (= 3.0.1)
35
+ activesupport (= 3.0.1)
36
+ activesupport (3.0.1)
37
+ addressable (2.2.2)
38
+ arel (1.0.1)
39
+ activesupport (~> 3.0.0)
40
+ builder (2.1.2)
41
+ crack (0.1.8)
42
+ erubis (2.6.6)
43
+ abstract (>= 1.0.0)
44
+ i18n (0.4.1)
45
+ mail (2.2.7)
46
+ activesupport (>= 2.3.6)
47
+ mime-types
48
+ treetop (>= 1.4.5)
49
+ mime-types (1.16)
50
+ polyglot (0.3.1)
51
+ rack (1.2.1)
52
+ rack-mount (0.6.13)
53
+ rack (>= 1.0.0)
54
+ rack-test (0.5.6)
55
+ rack (>= 1.0)
56
+ rails (3.0.1)
57
+ actionmailer (= 3.0.1)
58
+ actionpack (= 3.0.1)
59
+ activerecord (= 3.0.1)
60
+ activeresource (= 3.0.1)
61
+ activesupport (= 3.0.1)
62
+ bundler (~> 1.0.0)
63
+ railties (= 3.0.1)
64
+ railties (3.0.1)
65
+ actionpack (= 3.0.1)
66
+ activesupport (= 3.0.1)
67
+ rake (>= 0.8.4)
68
+ thor (~> 0.14.0)
69
+ rake (0.8.7)
70
+ rspec (1.3.0)
71
+ thor (0.14.3)
72
+ treetop (1.4.8)
73
+ polyglot (>= 0.3.1)
74
+ tzinfo (0.3.23)
75
+ webmock (1.4.0)
76
+ addressable (>= 2.2.2)
77
+ crack (>= 0.1.7)
78
+
79
+ PLATFORMS
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ bundler (~> 1.0.0)
84
+ jquery-rails!
85
+ rails (~> 3.0)
86
+ rspec (~> 1.3)
87
+ webmock (~> 1.4.0)
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
- require "rspec/core/rake_task"
4
+ require "spec/rake/spectask"
5
5
  desc "Run all examples"
6
- RSpec::Core::RakeTask.new(:spec) do |t|
6
+ Spec::Rake::SpecTask.new(:spec) do |t|
7
7
  t.ruby_opts = ['-r test/unit']
8
- t.rspec_opts = %w[--color]
8
+ t.spec_opts = %w[--color]
9
9
  end
10
10
  task :default => :spec
data/jquery-rails.gemspec CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.add_dependency "rails", "~> 3.0"
18
18
  s.add_development_dependency "bundler", "~> 1.0.0"
19
19
  s.add_development_dependency "rspec", "~> 1.3"
20
+ s.add_development_dependency "webmock", "~> 1.4.0"
20
21
 
21
22
  s.files = `git ls-files`.split("\n")
22
23
  s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
@@ -1,11 +1,10 @@
1
1
  module Jquery
2
2
  module Generators
3
3
  class InstallGenerator < ::Rails::Generators::Base
4
- desc "This generator downloads and installs jQuery, jQuery-ujs HEAD, and (optionally) jQuery UI 1.8.4"
5
- class_option :ui, :type => :boolean, :default => false, :desc => "Whether to Include JQueryUI"
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 )
8
-
4
+ desc "This generator downloads and installs jQuery, jQuery-ujs HEAD, and (optionally) the newest jQuery UI"
5
+ class_option :ui, :type => :boolean, :default => false, :desc => "Include jQueryUI"
6
+ class_option :version, :type => :string, :default => "1.4.3", :desc => "Which version of jQuery to fetch"
7
+ @@default_version = "1.4.3"
9
8
 
10
9
  def remove_prototype
11
10
  %w(controls.js dragdrop.js effects.js prototype.js).each do |js|
@@ -14,27 +13,34 @@ module Jquery
14
13
  end
15
14
 
16
15
  def download_jquery
17
- # Downloading latest jQuery
18
- if @@versions.include?(options.version)
19
- puts "Fetching JQuery version #{options.version}!"
20
- get "http://ajax.googleapis.com/ajax/libs/jquery/#{options.version}/jquery.min.js", "public/javascripts/jquery.min.js"
21
- get "http://ajax.googleapis.com/ajax/libs/jquery/#{options.version}/jquery.js", "public/javascripts/jquery.js"
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"
26
- end
16
+ say_status("fetching", "jQuery (#{options.version})", :green)
17
+ get_jquery(options.version)
18
+ rescue OpenURI::HTTPError
19
+ say_status("warning", "could not find jQuery (#{options.version})", :yellow)
20
+ say_status("fetching", "jQuery (#{@@default_version})", :green)
21
+ get_jquery(@@default_version)
22
+ end
27
23
 
28
- # 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?
24
+ def download_jquery_ui
25
+ if options.ui?
26
+ say_status("fetching", "jQuery UI (latest 1.x release)", :green)
27
+ get "http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js", "public/javascripts/jquery-ui.js"
28
+ get "http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js", "public/javascripts/jquery-ui.min.js"
29
+ end
31
30
  end
32
31
 
33
32
  def download_ujs_driver
34
- # Downloading latest jQuery drivers
33
+ say_status("fetching", "jQuery UJS adapter (github HEAD)", :green)
35
34
  get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
36
35
  end
37
36
 
37
+ private
38
+
39
+ def get_jquery(version)
40
+ get "http://ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.js", "public/javascripts/jquery.js"
41
+ get "http://ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js", "public/javascripts/jquery.min.js"
42
+ end
43
+
38
44
  end
39
45
  end
40
46
  end
@@ -1,5 +1,5 @@
1
1
  module Jquery
2
2
  module Rails
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
  end
@@ -9,19 +9,42 @@ class Jquery::Generators::InstallGeneratorTest < Rails::Generators::TestCase
9
9
  tests Jquery::Generators::InstallGenerator
10
10
  arguments []
11
11
 
12
- setup :prepare_destination
12
+ before(:each) do
13
+ prepare_destination
14
+ @response = {:body => "abc", :status => 200}
15
+ stub_request(:get, /ajax.googleapis.com|github.com/).to_return(@response)
16
+ end
17
+
18
+ it "should remove prototype" do
19
+ run_generator
20
+ %w(controls.js dragdrop.js effects.js prototype.js).each { |js| assert_no_file "public/javascripts/#{js}" }
21
+ end
22
+
23
+ it "should install the rails ujs shim" do
24
+ run_generator
25
+ assert_file "public/javascripts/rails.js"
26
+ end
13
27
 
14
28
  it "should install jquery" do
15
29
  run_generator
30
+ %w(jquery.min.js jquery.js).each { |js| assert_file "public/javascripts/#{js}" }
31
+ end
16
32
 
17
- %w(jquery.min.js jquery.js rails.js).each { |js| assert_file "public/javascripts/#{js}" }
18
- %w(controls.js dragdrop.js effects.js prototype.js).each { |js| assert_no_file "public/javascripts/#{js}" }
33
+ it "should install old jquery versions" do
34
+ run_generator %w(--version 1.4.2)
35
+ %w(jquery.min.js jquery.js).each { |js| assert_file "public/javascripts/#{js}" }
36
+ end
37
+
38
+ it "should try to install unknown jquery versions with fallback" do
39
+ stub_request(:get, /ajax.googleapis.com/).
40
+ to_return(:status => 404, :body => "No").
41
+ to_return(@response)
42
+ run_generator %w(--version 100.0)
43
+ %w(jquery.min.js jquery.js).each { |js| assert_file "public/javascripts/#{js}" }
19
44
  end
20
45
 
21
46
  it "should install jquery-ui when asked" do
22
47
  run_generator %w(--ui)
23
-
24
- %w(jquery.min.js jquery.js jquery-ui.min.js jquery-ui.js rails.js).each { |js| assert_file "public/javascripts/#{js}" }
25
- %w(controls.js dragdrop.js effects.js prototype.js).each { |js| assert_no_file "public/javascripts/#{js}" }
48
+ %w(jquery-ui.min.js jquery-ui.js).each { |js| assert_file "public/javascripts/#{js}" }
26
49
  end
27
50
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,11 @@
1
- # Setup for generator tests
1
+ # Set up RSpec
2
+ require 'webmock/rspec'
3
+
4
+ Spec::Runner.configure do |config|
5
+ config.include WebMock::API
6
+ end
7
+
8
+ # Set up generator tests
2
9
  require 'rails/all'
3
10
  require 'rails/generators'
4
11
  require 'rails/generators/test_case'
@@ -18,3 +25,5 @@ Rails.application.config.root = Rails.root
18
25
  # Call configure to load the settings from
19
26
  # Rails.application.config.generators to Rails::Generators
20
27
  Rails::Generators.configure!
28
+
29
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Andr\xC3\xA9 Arko"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-13 00:00:00 -07:00
18
+ date: 2010-10-16 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -64,6 +64,22 @@ dependencies:
64
64
  version: "1.3"
65
65
  type: :development
66
66
  version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: webmock
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ hash: 7
76
+ segments:
77
+ - 1
78
+ - 4
79
+ - 0
80
+ version: 1.4.0
81
+ type: :development
82
+ version_requirements: *id004
67
83
  description: This gem provides a Rails generator to install jQuery and the jQuery-ujs driver into your Rails 3 application, and then have them included automatically instead of Prototype.
68
84
  email:
69
85
  - andre@arko.net
@@ -77,6 +93,7 @@ files:
77
93
  - .gitignore
78
94
  - CHANGELOG.md
79
95
  - Gemfile
96
+ - Gemfile.lock
80
97
  - README.md
81
98
  - Rakefile
82
99
  - jquery-rails.gemspec