headjs-rails 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/headjs-rails.gemspec +3 -3
- data/lib/generators/headjs/install/install_generator.rb +3 -3
- data/lib/headjs-rails/tag_helper.rb +3 -2
- data/test/test_generator.rb +3 -3
- data/test/test_tag_helper.rb +2 -2
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -35,7 +35,7 @@ I also suggest you take a look at the [smurf gem](https://github.com/thumblemonk
|
|
35
35
|
|
36
36
|
## Testing
|
37
37
|
|
38
|
-
Clone the repo, run `bundle install` and `rake test`.
|
38
|
+
Clone the repo, run `bundle install` and `bundle exec rake test`.
|
39
39
|
|
40
40
|
## Contributing to headjs-rails
|
41
41
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/headjs-rails.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "headjs-rails"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David Bittencourt"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-11-19"
|
13
13
|
s.description = "This gem adds a helper and generator to facilitate the use of Head JS in your Rails 3 projects the same way you would normally add javascript tags using Rails default helpers."
|
14
14
|
s.email = "muitocomplicado@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
s.homepage = "http://github.com/muitocomplicado/headjs-rails"
|
38
38
|
s.licenses = ["MIT"]
|
39
39
|
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version = "1.8.
|
40
|
+
s.rubygems_version = "1.8.23"
|
41
41
|
s.summary = "Provides Rails 3 helper and generator for adding Head JS support."
|
42
42
|
|
43
43
|
if s.respond_to? :specification_version then
|
@@ -10,9 +10,9 @@ module Headjs
|
|
10
10
|
module Generators
|
11
11
|
class InstallGenerator < ::Rails::Generators::Base
|
12
12
|
desc "This generator downloads and installs Head JS"
|
13
|
-
class_option :version, :type => :string, :default => "
|
14
|
-
@@default_version = "
|
15
|
-
@@dist_url = "https://github.com/headjs/headjs/
|
13
|
+
class_option :version, :type => :string, :default => "1.0.0", :desc => "Which version of Head JS to fetch"
|
14
|
+
@@default_version = "1.0.0"
|
15
|
+
@@dist_url = "https://raw.github.com/headjs/headjs/master/dist/{version}/{file}"
|
16
16
|
|
17
17
|
def remove_headjs
|
18
18
|
%w(head.js head.min.js).each do |js|
|
@@ -18,7 +18,8 @@ module Headjs
|
|
18
18
|
scan(/src="([^"]+)"/).
|
19
19
|
flatten.
|
20
20
|
map do |src|
|
21
|
-
|
21
|
+
cnt = 0
|
22
|
+
key = original_key =
|
22
23
|
URI.
|
23
24
|
parse(src).
|
24
25
|
path[%r{[^/]+\z}].
|
@@ -26,7 +27,7 @@ module Headjs
|
|
26
27
|
gsub(/\.min$/,'').
|
27
28
|
gsub(/-[0-9a-f]{32}$/,'')
|
28
29
|
while keys.include?(key) do
|
29
|
-
key
|
30
|
+
key = "#{original_key}_#{(cnt = cnt.succ)}"
|
30
31
|
end
|
31
32
|
keys << key
|
32
33
|
"{ '#{key}': '#{src}' }"
|
data/test/test_generator.rb
CHANGED
@@ -8,14 +8,14 @@ class Headjs::Generators::InstallGeneratorTest < Rails::Generators::TestCase
|
|
8
8
|
|
9
9
|
context 'the Head JS install generator' do
|
10
10
|
|
11
|
-
should 'download the default
|
11
|
+
should 'download the default 1.0.0 files' do
|
12
12
|
run_generator %w(headjs:install)
|
13
13
|
assert_file 'public/javascripts/head.js'
|
14
14
|
assert_file 'public/javascripts/head.min.js'
|
15
15
|
end
|
16
16
|
|
17
|
-
should 'download
|
18
|
-
run_generator %w(headjs:install --version
|
17
|
+
should 'download version 0.99 files' do
|
18
|
+
run_generator %w(headjs:install --version 0.99)
|
19
19
|
assert_file 'public/javascripts/head.js'
|
20
20
|
assert_file 'public/javascripts/head.min.js'
|
21
21
|
end
|
data/test/test_tag_helper.rb
CHANGED
@@ -34,8 +34,8 @@ module Headjs
|
|
34
34
|
assert_equal "<script type=\"text/javascript\">head.js( { 'jquery': '#{jquery}' } );</script>", @helpers.headjs_include_tag(jquery)
|
35
35
|
end
|
36
36
|
|
37
|
-
should "
|
38
|
-
assert_equal "<script type=\"text/javascript\">head.js( { 'comments': '/javascripts/products/comments.js' }, { '
|
37
|
+
should "increase label counter to avoid overwriting" do
|
38
|
+
assert_equal "<script type=\"text/javascript\">head.js( { 'comments': '/javascripts/products/comments.js' }, { 'comments_1': '/javascripts/reviews/comments.js' } );</script>", @helpers.headjs_include_tag('products/comments', 'reviews/comments')
|
39
39
|
end
|
40
40
|
|
41
41
|
should "accept strings for local paths" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: headjs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -116,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
116
|
version: '0'
|
117
117
|
segments:
|
118
118
|
- 0
|
119
|
-
hash:
|
119
|
+
hash: -1302805054574789805
|
120
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
121
|
none: false
|
122
122
|
requirements:
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 1.8.
|
128
|
+
rubygems_version: 1.8.23
|
129
129
|
signing_key:
|
130
130
|
specification_version: 3
|
131
131
|
summary: Provides Rails 3 helper and generator for adding Head JS support.
|