requirejs-rails 0.8.0 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ <!--
2
+ Marked Style: GitHub
3
+ -->
4
+ # v0.8.2
5
+
6
+ - Fix for `requirejs_include_tag` error when `config/requirejs.yml` has no
7
+ `paths` key. Thanks to @JustinLove for the issue and failing test!
8
+
1
9
  # v0.8.0
2
10
 
3
11
  - Build will now substitute `empty:` for the right-hand side of
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- requirejs-rails (0.8.0)
4
+ requirejs-rails (0.8.2)
5
5
  railties (>= 3.1.1, < 3.3)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ <!--
2
+ Marked Style: GitHub
3
+ -->
1
4
  # RequireJS for Rails
2
5
 
3
6
  Integrates [RequireJS](http://requirejs.org/) into the Rails 3 Asset Pipeline.
@@ -54,8 +54,10 @@ module RequirejsHelper
54
54
  paths = {}
55
55
  modules.each { |m| paths[m] = _javascript_path(m).sub /\.js$/,'' }
56
56
 
57
- # Add paths for assets specified by full URL (on a CDN)
58
- run_config['paths'].each { |k,v| paths[k] = v if v =~ /^https?:/ }
57
+ if run_config.has_key? 'paths'
58
+ # Add paths for assets specified by full URL (on a CDN)
59
+ run_config['paths'].each { |k,v| paths[k] = v if v =~ /^https?:/ }
60
+ end
59
61
 
60
62
  # Override user paths, whose mappings are only relevant in dev mode
61
63
  # and in the build_config.
@@ -1,6 +1,6 @@
1
1
  module Requirejs
2
2
  module Rails
3
- Version = "0.8.0"
3
+ Version = "0.8.2"
4
4
  LibVersion = "1.0.8"
5
5
  end
6
6
  end
@@ -126,10 +126,15 @@ class RequirejsHelperTest < ActionView::TestCase
126
126
 
127
127
  def setup
128
128
  controller.requirejs_included = false
129
+ Rails.application.config.requirejs.user_config = {}
130
+ Rails.application.config.requirejs.delete(:run_config)
131
+ Rails.application.config.requirejs.delete(:build_config)
132
+ end
133
+
134
+ def with_cdn
129
135
  Rails.application.config.requirejs.user_config = { 'paths' =>
130
136
  { 'jquery' => 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' }
131
137
  }
132
-
133
138
  end
134
139
 
135
140
  def wrap(tag)
@@ -163,13 +168,27 @@ class RequirejsHelperTest < ActionView::TestCase
163
168
  end
164
169
  end
165
170
 
171
+ test "requirejs_include_tag with digested asset paths" do
172
+ begin
173
+ saved_digest = Rails.application.config.assets.digest
174
+ Rails.application.config.assets.digest = true
175
+ Rails.application.config.requirejs.user_config = { 'modules' => [{'name' => 'foo'}] }
176
+ render :text => wrap(requirejs_include_tag)
177
+ assert_select "script:first-of-type", :text => %r[var require =.*"paths":{"foo":"/javascripts/foo"}]
178
+ ensure
179
+ Rails.application.config.assets.digest = saved_digest
180
+ end
181
+ end
182
+
166
183
  test "requirejs_include_tag with CDN asset in paths" do
184
+ with_cdn
167
185
  render :text => wrap(requirejs_include_tag)
168
186
  assert_select "script:first-of-type", :text => %r{var require =.*paths.*http://ajax}
169
187
  end
170
188
 
171
189
  test "requirejs_include_tag with CDN asset and digested asset paths" do
172
190
  begin
191
+ with_cdn
173
192
  saved_digest = Rails.application.config.assets.digest
174
193
  Rails.application.config.assets.digest = true
175
194
  render :text => wrap(requirejs_include_tag)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: requirejs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-01 00:00:00.000000000 Z
12
+ date: 2012-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70259994422520 !ruby/object:Gem::Requirement
16
+ requirement: &70237504536140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: '3.3'
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *70259994422520
27
+ version_requirements: *70237504536140
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rails
30
- requirement: &70259994419640 !ruby/object:Gem::Requirement
30
+ requirement: &70237504534000 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ! '>='
@@ -38,10 +38,10 @@ dependencies:
38
38
  version: '3.3'
39
39
  type: :development
40
40
  prerelease: false
41
- version_requirements: *70259994419640
41
+ version_requirements: *70237504534000
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: sqlite3
44
- requirement: &70259994416180 !ruby/object:Gem::Requirement
44
+ requirement: &70237504532100 !ruby/object:Gem::Requirement
45
45
  none: false
46
46
  requirements:
47
47
  - - ! '>='
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '0'
50
50
  type: :development
51
51
  prerelease: false
52
- version_requirements: *70259994416180
52
+ version_requirements: *70237504532100
53
53
  description: This gem provides RequireJS support for your Rails 3 application.
54
54
  email:
55
55
  - whitley@bangpath.org
@@ -129,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  segments:
131
131
  - 0
132
- hash: -70510863405532610
132
+ hash: 2336144338359271813
133
133
  required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  none: false
135
135
  requirements:
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  segments:
140
140
  - 0
141
- hash: -70510863405532610
141
+ hash: 2336144338359271813
142
142
  requirements:
143
143
  - node.js is required for 'rake assets:precompile', used to run the r.js build
144
144
  - If needed, jQuery should be v1.7 or greater (jquery-rails >= 1.0.17).