jquery_tag 0.0.2 → 0.1.0

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.
data/Gemfile.lock CHANGED
@@ -7,21 +7,19 @@ GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
9
  diff-lcs (1.1.2)
10
- rspec (2.0.0)
11
- rspec-core (= 2.0.0)
12
- rspec-expectations (= 2.0.0)
13
- rspec-mocks (= 2.0.0)
14
- rspec-core (2.0.0)
15
- rspec-expectations (2.0.0)
16
- diff-lcs (>= 1.1.2)
17
- rspec-mocks (2.0.0)
18
- rspec-core (= 2.0.0)
19
- rspec-expectations (= 2.0.0)
10
+ rspec (2.1.0)
11
+ rspec-core (~> 2.1.0)
12
+ rspec-expectations (~> 2.1.0)
13
+ rspec-mocks (~> 2.1.0)
14
+ rspec-core (2.1.0)
15
+ rspec-expectations (2.1.0)
16
+ diff-lcs (~> 1.1.2)
17
+ rspec-mocks (2.1.0)
20
18
 
21
19
  PLATFORMS
22
20
  ruby
23
21
 
24
22
  DEPENDENCIES
25
- bundler (>= 1.0.0)
23
+ bundler (~> 1)
26
24
  jquery_tag!
27
- rspec (>= 2.0.0)
25
+ rspec (~> 2)
data/README.markdown CHANGED
@@ -1,8 +1,9 @@
1
1
  # Jquery_tag
2
- a Rails Helper for togglin' between a local jquery.js file `located in /public/javascripts/jquery.js` or the hosted script on Google's CDN.
2
+ a Rails Helper for togglin' between a local jquery.js file located in /public/javascripts/jquery.js or the hosted script on Google's CDN.
3
+ Also supports the same behaviour for a local jquery-ui.js file or the CDN version.
3
4
 
4
5
  ## Installation
5
- `gem jquery_tag` + `bundle install`
6
+ Just add the `jquery_tag` to your Gemfile and run `bundle install`
6
7
 
7
8
  ## Usage
8
9
  Inside your views
@@ -11,6 +12,8 @@ Inside your views
11
12
 
12
13
  Accepted options:
13
14
 
14
- :version # Overrides the script version on the CDN URL. Defaults do '1.4.2'
15
+ :version # Overrides the script version on the CDN URL. Defaults do '1.4'
15
16
  :file # Path for the local script. Defaults do 'jquery.js'
16
- :args # Any other arguments that will be passed to the javascript_include_tag helper
17
+ :ui # Loads the jquery-ui file. Accepts a true value for loading a 'jquery-ui.js' file or a String for the local path.
18
+
19
+ Any other arguments will be passed along to the `javascript_include_tag` helper.
data/jquery_tag.gemspec CHANGED
@@ -3,7 +3,7 @@ require File.expand_path("../lib/jquery_tag/version", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "jquery_tag"
6
- s.version = Jquery::Tag::VERSION
6
+ s.version = JqueryTag::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Lucas Mazza"]
9
9
  s.email = ["luc4smazza@gmail.com"]
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  s.description = "Helper gem that toggles between local jquery script and Google CDN version based on your app environment"
13
13
 
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
- s.add_development_dependency "bundler", ">= 1.0.0"
16
- s.add_development_dependency "rspec", ">= 2.0.0"
15
+ s.add_development_dependency "bundler", "~> 1"
16
+ s.add_development_dependency "rspec", "~> 2"
17
17
 
18
18
  s.files = `git ls-files`.split("\n")
19
19
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
@@ -1,5 +1,3 @@
1
- module Jquery
2
- module Tag
3
- VERSION = "0.0.2"
4
- end
1
+ module JqueryTag
2
+ VERSION = "0.1.0"
5
3
  end
@@ -1,27 +1,25 @@
1
- module Jquery
2
- module Tag
3
- module ViewHelpers
4
- def jquery_tag(*args)
5
-
6
- options = args.first.is_a?(Hash) ? args.pop : {}
1
+ module JqueryTag
2
+ module ViewHelpers
3
+ def jquery_tag(*args)
7
4
 
8
- args.unshift(jquery_ui_file(options[:ui])) if options[:ui]
9
- args.unshift(jquery_file(options[:file], options[:version]))
5
+ options = args.first.is_a?(Hash) ? args.pop : {}
10
6
 
11
- javascript_include_tag args
12
- end
13
-
14
- private
15
- def jquery_file(path, version)
16
- path ||= 'jquery.js'
17
- version ||= '1.4.3'
18
- Rails.env.production? ? "http://ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js" : path
19
- end
20
-
21
- def jquery_ui_file(path)
22
- path = path.is_a?(String) ? path : "jquery-ui.js"
23
- Rails.env.production? ? 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js' : path
24
- end
25
- end
7
+ args.unshift(jquery_ui_file(options[:ui])) if options[:ui]
8
+ args.unshift(jquery_file(options[:file], options[:version]))
9
+
10
+ javascript_include_tag args
11
+ end
12
+
13
+ private
14
+ def jquery_file(path, version)
15
+ path ||= 'jquery.js'
16
+ version ||= '1.4'
17
+ Rails.env.production? ? "http://ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js" : path
18
+ end
19
+
20
+ def jquery_ui_file(path)
21
+ path = path.is_a?(String) ? path : "jquery-ui.js"
22
+ Rails.env.production? ? 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js' : path
23
+ end
26
24
  end
27
25
  end
data/lib/jquery_tag.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  require 'jquery_tag/view_helpers'
2
2
 
3
- ActionView::Base.send(:include, Jquery::Tag::ViewHelpers)
3
+ ActionView::Base.send(:include, JqueryTag::ViewHelpers)
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Jquery::Tag::ViewHelpers do
4
- include Jquery::Tag::ViewHelpers
5
-
3
+ describe JqueryTag::ViewHelpers do
4
+ include JqueryTag::ViewHelpers
5
+
6
6
  context "development" do
7
7
  before { development! }
8
8
 
@@ -10,17 +10,17 @@ describe Jquery::Tag::ViewHelpers do
10
10
  expects_include_with ['jquery.js']
11
11
  jquery_tag
12
12
  end
13
-
13
+
14
14
  it "delegates any other arguments" do
15
15
  expects_include_with ['jquery.js', 'application.js']
16
16
  jquery_tag 'application.js'
17
17
  end
18
-
18
+
19
19
  it "accepts a different path for the local jquery file" do
20
20
  expects_include_with ['frameworks/jquery.min.js']
21
21
  jquery_tag :file => "frameworks/jquery.min.js"
22
22
  end
23
-
23
+
24
24
  it "renders the jquery-ui.js file" do
25
25
  expects_include_with ['jquery.js', 'jquery-ui.js']
26
26
  jquery_tag :ui => true
@@ -31,22 +31,22 @@ describe Jquery::Tag::ViewHelpers do
31
31
  jquery_tag :ui => 'frameworks/jquery-ui.js'
32
32
  end
33
33
  end
34
-
34
+
35
35
  context "production" do
36
36
  before { production! }
37
-
37
+
38
38
  it "uses the google CDN path" do
39
- expects_include_with ['http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js']
39
+ expects_include_with ['http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js']
40
40
  jquery_tag
41
41
  end
42
-
42
+
43
43
  it "accepts a different version for the jquery script" do
44
44
  expects_include_with ['http://ajax.googleapis.com/ajax/libs/jquery/1.0.0/jquery.min.js']
45
45
  jquery_tag :version => '1.0.0'
46
46
  end
47
-
47
+
48
48
  it "uses the google CDN path for the jquery ui script" do
49
- expects_include_with ['http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js']
49
+ expects_include_with ['http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js']
50
50
  jquery_tag :ui => true
51
51
  end
52
52
  end
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 2
10
- version: 0.0.2
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lucas Mazza
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-18 00:00:00 -02:00
18
+ date: 2010-11-12 00:00:00 -02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,14 +24,12 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ">="
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 23
29
+ hash: 1
30
30
  segments:
31
31
  - 1
32
- - 0
33
- - 0
34
- version: 1.0.0
32
+ version: "1"
35
33
  type: :development
36
34
  version_requirements: *id001
37
35
  - !ruby/object:Gem::Dependency
@@ -40,14 +38,12 @@ dependencies:
40
38
  requirement: &id002 !ruby/object:Gem::Requirement
41
39
  none: false
42
40
  requirements:
43
- - - ">="
41
+ - - ~>
44
42
  - !ruby/object:Gem::Version
45
- hash: 15
43
+ hash: 7
46
44
  segments:
47
45
  - 2
48
- - 0
49
- - 0
50
- version: 2.0.0
46
+ version: "2"
51
47
  type: :development
52
48
  version_requirements: *id002
53
49
  description: Helper gem that toggles between local jquery script and Google CDN version based on your app environment