jquery_tag 0.2.4 → 0.2.5
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/.travis.yml +4 -0
- data/README.markdown +16 -8
- data/jquery_tag.gemspec +9 -10
- data/lib/jquery_tag/version.rb +1 -1
- data/lib/jquery_tag.rb +2 -2
- data/spec/rails_helper_spec.rb +2 -2
- data/spec/sinatra_helper_spec.rb +3 -3
- metadata +39 -67
data/.travis.yml
ADDED
data/README.markdown
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# Jquery_tag
|
2
|
+
|
3
|
+
[](http://travis-ci.org/lucasmazza/jquery_tag)
|
4
|
+
|
5
|
+
|
2
6
|
A Helper gem for both Rails and Sinatra for toggling between a local jquery.js file or the hosted script on Google's CDN based on your application environment, avoiding network dependency during development and bandwidth usage when your application goes live.
|
3
7
|
It also supports the same behavior for a loading the jQuery UI script.
|
4
8
|
|
@@ -12,11 +16,13 @@ To download the latest jQuery script to your application just run `jquery_tag` c
|
|
12
16
|
## Usage
|
13
17
|
Inside your views, you can just call the `jquery_tag` method.
|
14
18
|
|
15
|
-
|
19
|
+
```erb
|
20
|
+
<%= jquery_tag %>
|
21
|
+
```
|
16
22
|
|
17
23
|
It accepts a some configuration options by using the following symbols:
|
18
24
|
|
19
|
-
:version # Overrides the script version on the CDN URL. Defaults do '1.6.
|
25
|
+
:version # Overrides the script version on the CDN URL. Defaults do '1.6.2'
|
20
26
|
:file # Path for the local script. Defaults do 'jquery.js'
|
21
27
|
:ui # Loads jQuery UI. Accepts a true value for loading a 'jquery-ui.js' file or a String for the local path.
|
22
28
|
|
@@ -25,12 +31,14 @@ Any other arguments will be passed along to the `javascript_include_tag` helper,
|
|
25
31
|
## Sinatra
|
26
32
|
To use the `jquery_tag` on your [Sinatra](http://www.sinatrarb.com/) applications, just include the `JqueryTag::SinatraHelper` on your application
|
27
33
|
|
28
|
-
|
34
|
+
```ruby
|
35
|
+
require 'jquery_tag' # if your not using Bundler.
|
29
36
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
37
|
+
class Application < Sinatra::Base
|
38
|
+
helpers do
|
39
|
+
include JqueryTag::SinatraHelper
|
40
|
+
end
|
41
|
+
end
|
42
|
+
```
|
35
43
|
|
36
44
|
Just call the `jquery_tag` helper inside your views or layouts, as in the example above. Your local scripts should be located inside a `./public/javascripts/` folder (or whatever the Sinatra public path is configured on your application).
|
data/jquery_tag.gemspec
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path(
|
2
|
+
require File.expand_path('../lib/jquery_tag/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
-
s.name =
|
5
|
+
s.name = 'jquery_tag'
|
6
6
|
s.version = JqueryTag::VERSION
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
|
-
s.authors = [
|
9
|
-
s.email = [
|
10
|
-
s.homepage =
|
11
|
-
s.summary =
|
12
|
-
s.description =
|
8
|
+
s.authors = ['Lucas Mazza']
|
9
|
+
s.email = ['luc4smazza@gmail.com']
|
10
|
+
s.homepage = 'http://rubygems.org/gems/jquery_tag'
|
11
|
+
s.summary = 'jQuery script tag helper for Rails and Sinatra'
|
12
|
+
s.description = 'Helper gem that toggles between local jquery script and Google CDN version based on your app environment'
|
13
13
|
|
14
|
-
s.
|
15
|
-
s.add_development_dependency
|
16
|
-
s.add_development_dependency "rspec", "~> 2.4"
|
14
|
+
s.add_development_dependency 'rspec', '~> 2.4'
|
15
|
+
s.add_development_dependency 'rake', '~> 0.9.2'
|
17
16
|
|
18
17
|
s.files = `git ls-files`.split("\n")
|
19
18
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
data/lib/jquery_tag/version.rb
CHANGED
data/lib/jquery_tag.rb
CHANGED
@@ -4,9 +4,9 @@ require 'jquery_tag/helpers/sinatra_helper'
|
|
4
4
|
|
5
5
|
module JqueryTag # :nodoc:
|
6
6
|
## @return [String] the current (mostly latest) version of jQuery.
|
7
|
-
def self.version; '1.6.
|
7
|
+
def self.version; '1.6.2'; end
|
8
8
|
## @return [String] the current (mostly latest) version of jQuery UI.
|
9
|
-
def self.ui_version; '1.8.
|
9
|
+
def self.ui_version; '1.8.16'; end
|
10
10
|
end
|
11
11
|
|
12
12
|
ActionView::Base.send(:include, JqueryTag::RailsHelper) if defined? Rails
|
data/spec/rails_helper_spec.rb
CHANGED
@@ -41,7 +41,7 @@ describe JqueryTag::RailsHelper do
|
|
41
41
|
before { production! }
|
42
42
|
|
43
43
|
it "uses the google CDN path" do
|
44
|
-
expects_includes_with ['//ajax.googleapis.com/ajax/libs/jquery/1.6.
|
44
|
+
expects_includes_with ['//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js']
|
45
45
|
jquery_tag
|
46
46
|
end
|
47
47
|
|
@@ -51,7 +51,7 @@ describe JqueryTag::RailsHelper do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "uses the google CDN path for the jquery ui script" do
|
54
|
-
expects_includes_with ['//ajax.googleapis.com/ajax/libs/jquery/1.6.
|
54
|
+
expects_includes_with ['//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js']
|
55
55
|
jquery_tag :ui => true
|
56
56
|
end
|
57
57
|
end
|
data/spec/sinatra_helper_spec.rb
CHANGED
@@ -33,7 +33,7 @@ describe JqueryTag::SinatraHelper do
|
|
33
33
|
before { production! }
|
34
34
|
|
35
35
|
it "uses the google CDN path" do
|
36
|
-
expected = %Q{<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.
|
36
|
+
expected = %Q{<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>}
|
37
37
|
jquery_tag.should == expected
|
38
38
|
end
|
39
39
|
|
@@ -43,8 +43,8 @@ describe JqueryTag::SinatraHelper do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "uses the google CDN path for the jquery ui script" do
|
46
|
-
expected = %Q{<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.
|
47
|
-
expected << %Q{<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.
|
46
|
+
expected = %Q{<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>}
|
47
|
+
expected << %Q{<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>}
|
48
48
|
jquery_tag(:ui => true).should == expected
|
49
49
|
end
|
50
50
|
end
|
metadata
CHANGED
@@ -1,64 +1,49 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery_tag
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 4
|
10
|
-
version: 0.2.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Lucas Mazza
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
name: bundler
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
12
|
+
date: 2011-08-29 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &2156601280 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
18
|
+
requirements:
|
27
19
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 0
|
33
|
-
version: "1.0"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.4'
|
34
22
|
type: :development
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rspec
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: *2156601280
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &2156600780 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
29
|
+
requirements:
|
42
30
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 2
|
47
|
-
- 4
|
48
|
-
version: "2.4"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.2
|
49
33
|
type: :development
|
50
|
-
|
51
|
-
|
52
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2156600780
|
36
|
+
description: Helper gem that toggles between local jquery script and Google CDN version
|
37
|
+
based on your app environment
|
38
|
+
email:
|
53
39
|
- luc4smazza@gmail.com
|
54
|
-
executables:
|
40
|
+
executables:
|
55
41
|
- jquery_tag
|
56
42
|
extensions: []
|
57
|
-
|
58
43
|
extra_rdoc_files: []
|
59
|
-
|
60
|
-
files:
|
44
|
+
files:
|
61
45
|
- .gitignore
|
46
|
+
- .travis.yml
|
62
47
|
- Gemfile
|
63
48
|
- README.markdown
|
64
49
|
- Rakefile
|
@@ -73,41 +58,28 @@ files:
|
|
73
58
|
- spec/rails_helper_spec.rb
|
74
59
|
- spec/sinatra_helper_spec.rb
|
75
60
|
- spec/spec_helper.rb
|
76
|
-
has_rdoc: true
|
77
61
|
homepage: http://rubygems.org/gems/jquery_tag
|
78
62
|
licenses: []
|
79
|
-
|
80
63
|
post_install_message:
|
81
64
|
rdoc_options: []
|
82
|
-
|
83
|
-
require_paths:
|
65
|
+
require_paths:
|
84
66
|
- lib
|
85
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
68
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
|
92
|
-
- 0
|
93
|
-
version: "0"
|
94
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
74
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
|
100
|
-
segments:
|
101
|
-
- 1
|
102
|
-
- 3
|
103
|
-
- 6
|
104
|
-
version: 1.3.6
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
105
79
|
requirements: []
|
106
|
-
|
107
80
|
rubyforge_project:
|
108
|
-
rubygems_version: 1.
|
81
|
+
rubygems_version: 1.8.5
|
109
82
|
signing_key:
|
110
83
|
specification_version: 3
|
111
84
|
summary: jQuery script tag helper for Rails and Sinatra
|
112
85
|
test_files: []
|
113
|
-
|