sprockets 2.5.1 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sprockets might be problematic. Click here for more details.

data/README.md CHANGED
@@ -361,6 +361,10 @@ submit a pull request.
361
361
 
362
362
  ## Version History ##
363
363
 
364
+ **2.6.0** (September 19, 2012)
365
+
366
+ * Added bower component.json require support
367
+
364
368
  **2.5.0** (September 4, 2012)
365
369
 
366
370
  * Fixed Ruby 2.0 RegExp warning
@@ -17,10 +17,15 @@ module Sprockets
17
17
  def search_paths
18
18
  paths = [pathname.to_s]
19
19
 
20
+ path_without_extensions = extensions.inject(pathname) { |p, ext| p.sub(ext, '') }
21
+
22
+ # optimization: component.json can only be nested one level deep
23
+ if !path_without_extensions.to_s.index('/')
24
+ paths << path_without_extensions.join("component.json").to_s
25
+ end
26
+
20
27
  if pathname.basename(extensions.join).to_s != 'index'
21
- path_without_extensions = extensions.inject(pathname) { |p, ext| p.sub(ext, '') }
22
- index_path = path_without_extensions.join("index#{extensions.join}").to_s
23
- paths << index_path
28
+ paths << path_without_extensions.join("index#{extensions.join}").to_s
24
29
  end
25
30
 
26
31
  paths
@@ -5,6 +5,7 @@ require 'sprockets/errors'
5
5
  require 'sprockets/processed_asset'
6
6
  require 'sprockets/server'
7
7
  require 'sprockets/static_asset'
8
+ require 'multi_json'
8
9
  require 'pathname'
9
10
 
10
11
  module Sprockets
@@ -127,7 +128,23 @@ module Sprockets
127
128
  if block_given?
128
129
  args = attributes_for(logical_path).search_paths + [options]
129
130
  @trail.find(*args) do |path|
130
- yield Pathname.new(path)
131
+ pathname = Pathname.new(path)
132
+ if pathname.basename.to_s == 'component.json'
133
+ component = json_decode(pathname.read)
134
+ case component['main']
135
+ when String
136
+ yield pathname.dirname.join(component['main'])
137
+ when Array
138
+ extname = File.extname(logical_path)
139
+ component['main'].each do |fn|
140
+ if extname == "" || extname == File.extname(fn)
141
+ yield pathname.dirname.join(fn)
142
+ end
143
+ end
144
+ end
145
+ else
146
+ yield pathname
147
+ end
131
148
  end
132
149
  else
133
150
  resolve(logical_path, options) do |pathname|
@@ -404,5 +421,16 @@ module Sprockets
404
421
  end
405
422
  end
406
423
  end
424
+
425
+ # Feature detect newer MultiJson API
426
+ if MultiJson.respond_to?(:dump)
427
+ def json_decode(obj)
428
+ MultiJson.load(obj)
429
+ end
430
+ else
431
+ def json_decode(obj)
432
+ MultiJson.decode(obj)
433
+ end
434
+ end
407
435
  end
408
436
  end
@@ -33,16 +33,16 @@ module Sprockets
33
33
  # Extract the path from everything after the leading slash
34
34
  path = unescape(env['PATH_INFO'].to_s.sub(/^\//, ''))
35
35
 
36
- # Strip fingerprint
37
- if fingerprint = path_fingerprint(path)
38
- path = path.sub("-#{fingerprint}", '')
39
- end
40
-
41
36
  # URLs containing a `".."` are rejected for security reasons.
42
37
  if forbidden_request?(path)
43
38
  return forbidden_response
44
39
  end
45
40
 
41
+ # Strip fingerprint
42
+ if fingerprint = path_fingerprint(path)
43
+ path = path.sub("-#{fingerprint}", '')
44
+ end
45
+
46
46
  # Look up the asset.
47
47
  asset = find_asset(path, :bundle => !body_only?(env))
48
48
 
@@ -90,7 +90,7 @@ module Sprockets
90
90
  #
91
91
  # http://example.org/assets/../../../etc/passwd
92
92
  #
93
- path.include?("..") || Pathname.new(path).absolute?
93
+ path.include?("..")
94
94
  end
95
95
 
96
96
  # Returns a 403 Forbidden response tuple
@@ -222,7 +222,7 @@ module Sprockets
222
222
  # # => "0aa2105d29558f3eb790d411d7d8fb66"
223
223
  #
224
224
  def path_fingerprint(path)
225
- path[/-([0-9a-f]{7,40})\.[^.]+\z/, 1]
225
+ path[/-([0-9a-f]{7,40})\.[^.]+$/, 1]
226
226
  end
227
227
 
228
228
  # URI.unescape is deprecated on 1.9. We need to use URI::Parser
@@ -1,3 +1,3 @@
1
1
  module Sprockets
2
- VERSION = "2.5.1"
2
+ VERSION = "2.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.6.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Sam Stephenson
@@ -9,194 +10,220 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-10-28 00:00:00.000000000 Z
13
+ date: 2012-09-19 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: hike
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - "~>"
20
+ - - ~>
19
21
  - !ruby/object:Gem::Version
20
22
  version: '1.2'
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - "~>"
28
+ - - ~>
26
29
  - !ruby/object:Gem::Version
27
30
  version: '1.2'
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: multi_json
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
- - - "~>"
36
+ - - ~>
33
37
  - !ruby/object:Gem::Version
34
38
  version: '1.0'
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
- - - "~>"
44
+ - - ~>
40
45
  - !ruby/object:Gem::Version
41
46
  version: '1.0'
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: rack
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
- - - "~>"
52
+ - - ~>
47
53
  - !ruby/object:Gem::Version
48
54
  version: '1.0'
49
55
  type: :runtime
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
- - - "~>"
60
+ - - ~>
54
61
  - !ruby/object:Gem::Version
55
62
  version: '1.0'
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: tilt
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
- - - "~>"
68
+ - - ~>
61
69
  - !ruby/object:Gem::Version
62
70
  version: '1.1'
63
- - - "!="
71
+ - - ! '!='
64
72
  - !ruby/object:Gem::Version
65
73
  version: 1.3.0
66
74
  type: :runtime
67
75
  prerelease: false
68
76
  version_requirements: !ruby/object:Gem::Requirement
77
+ none: false
69
78
  requirements:
70
- - - "~>"
79
+ - - ~>
71
80
  - !ruby/object:Gem::Version
72
81
  version: '1.1'
73
- - - "!="
82
+ - - ! '!='
74
83
  - !ruby/object:Gem::Version
75
84
  version: 1.3.0
76
85
  - !ruby/object:Gem::Dependency
77
86
  name: coffee-script
78
87
  requirement: !ruby/object:Gem::Requirement
88
+ none: false
79
89
  requirements:
80
- - - "~>"
90
+ - - ~>
81
91
  - !ruby/object:Gem::Version
82
92
  version: '2.0'
83
93
  type: :development
84
94
  prerelease: false
85
95
  version_requirements: !ruby/object:Gem::Requirement
96
+ none: false
86
97
  requirements:
87
- - - "~>"
98
+ - - ~>
88
99
  - !ruby/object:Gem::Version
89
100
  version: '2.0'
90
101
  - !ruby/object:Gem::Dependency
91
102
  name: coffee-script-source
92
103
  requirement: !ruby/object:Gem::Requirement
104
+ none: false
93
105
  requirements:
94
- - - "~>"
106
+ - - ~>
95
107
  - !ruby/object:Gem::Version
96
108
  version: 1.2.0
97
109
  type: :development
98
110
  prerelease: false
99
111
  version_requirements: !ruby/object:Gem::Requirement
112
+ none: false
100
113
  requirements:
101
- - - "~>"
114
+ - - ~>
102
115
  - !ruby/object:Gem::Version
103
116
  version: 1.2.0
104
117
  - !ruby/object:Gem::Dependency
105
118
  name: eco
106
119
  requirement: !ruby/object:Gem::Requirement
120
+ none: false
107
121
  requirements:
108
- - - "~>"
122
+ - - ~>
109
123
  - !ruby/object:Gem::Version
110
124
  version: '1.0'
111
125
  type: :development
112
126
  prerelease: false
113
127
  version_requirements: !ruby/object:Gem::Requirement
128
+ none: false
114
129
  requirements:
115
- - - "~>"
130
+ - - ~>
116
131
  - !ruby/object:Gem::Version
117
132
  version: '1.0'
118
133
  - !ruby/object:Gem::Dependency
119
134
  name: ejs
120
135
  requirement: !ruby/object:Gem::Requirement
136
+ none: false
121
137
  requirements:
122
- - - "~>"
138
+ - - ~>
123
139
  - !ruby/object:Gem::Version
124
140
  version: '1.0'
125
141
  type: :development
126
142
  prerelease: false
127
143
  version_requirements: !ruby/object:Gem::Requirement
144
+ none: false
128
145
  requirements:
129
- - - "~>"
146
+ - - ~>
130
147
  - !ruby/object:Gem::Version
131
148
  version: '1.0'
132
149
  - !ruby/object:Gem::Dependency
133
150
  name: execjs
134
151
  requirement: !ruby/object:Gem::Requirement
152
+ none: false
135
153
  requirements:
136
- - - "~>"
154
+ - - ~>
137
155
  - !ruby/object:Gem::Version
138
156
  version: '1.0'
139
157
  type: :development
140
158
  prerelease: false
141
159
  version_requirements: !ruby/object:Gem::Requirement
160
+ none: false
142
161
  requirements:
143
- - - "~>"
162
+ - - ~>
144
163
  - !ruby/object:Gem::Version
145
164
  version: '1.0'
146
165
  - !ruby/object:Gem::Dependency
147
166
  name: json
148
167
  requirement: !ruby/object:Gem::Requirement
168
+ none: false
149
169
  requirements:
150
- - - ">="
170
+ - - ! '>='
151
171
  - !ruby/object:Gem::Version
152
172
  version: '0'
153
173
  type: :development
154
174
  prerelease: false
155
175
  version_requirements: !ruby/object:Gem::Requirement
176
+ none: false
156
177
  requirements:
157
- - - ">="
178
+ - - ! '>='
158
179
  - !ruby/object:Gem::Version
159
180
  version: '0'
160
181
  - !ruby/object:Gem::Dependency
161
182
  name: rack-test
162
183
  requirement: !ruby/object:Gem::Requirement
184
+ none: false
163
185
  requirements:
164
- - - ">="
186
+ - - ! '>='
165
187
  - !ruby/object:Gem::Version
166
188
  version: '0'
167
189
  type: :development
168
190
  prerelease: false
169
191
  version_requirements: !ruby/object:Gem::Requirement
192
+ none: false
170
193
  requirements:
171
- - - ">="
194
+ - - ! '>='
172
195
  - !ruby/object:Gem::Version
173
196
  version: '0'
174
197
  - !ruby/object:Gem::Dependency
175
198
  name: rake
176
199
  requirement: !ruby/object:Gem::Requirement
200
+ none: false
177
201
  requirements:
178
- - - ">="
202
+ - - ! '>='
179
203
  - !ruby/object:Gem::Version
180
204
  version: '0'
181
205
  type: :development
182
206
  prerelease: false
183
207
  version_requirements: !ruby/object:Gem::Requirement
208
+ none: false
184
209
  requirements:
185
- - - ">="
210
+ - - ! '>='
186
211
  - !ruby/object:Gem::Version
187
212
  version: '0'
188
213
  - !ruby/object:Gem::Dependency
189
214
  name: sass
190
215
  requirement: !ruby/object:Gem::Requirement
216
+ none: false
191
217
  requirements:
192
- - - "~>"
218
+ - - ~>
193
219
  - !ruby/object:Gem::Version
194
220
  version: '3.1'
195
221
  type: :development
196
222
  prerelease: false
197
223
  version_requirements: !ruby/object:Gem::Requirement
224
+ none: false
198
225
  requirements:
199
- - - "~>"
226
+ - - ~>
200
227
  - !ruby/object:Gem::Version
201
228
  version: '3.1'
202
229
  description: Sprockets is a Rack-based asset packaging system that concatenates and
@@ -209,11 +236,9 @@ executables:
209
236
  extensions: []
210
237
  extra_rdoc_files: []
211
238
  files:
212
- - LICENSE
213
239
  - README.md
214
- - bin/sprockets
240
+ - LICENSE
215
241
  - lib/rake/sprocketstask.rb
216
- - lib/sprockets.rb
217
242
  - lib/sprockets/asset.rb
218
243
  - lib/sprockets/asset_attributes.rb
219
244
  - lib/sprockets/base.rb
@@ -247,27 +272,30 @@ files:
247
272
  - lib/sprockets/static_asset.rb
248
273
  - lib/sprockets/utils.rb
249
274
  - lib/sprockets/version.rb
275
+ - lib/sprockets.rb
276
+ - bin/sprockets
250
277
  homepage: http://getsprockets.org/
251
278
  licenses: []
252
- metadata: {}
253
279
  post_install_message:
254
280
  rdoc_options: []
255
281
  require_paths:
256
282
  - lib
257
283
  required_ruby_version: !ruby/object:Gem::Requirement
284
+ none: false
258
285
  requirements:
259
- - - ">="
286
+ - - ! '>='
260
287
  - !ruby/object:Gem::Version
261
288
  version: '0'
262
289
  required_rubygems_version: !ruby/object:Gem::Requirement
290
+ none: false
263
291
  requirements:
264
- - - ">="
292
+ - - ! '>='
265
293
  - !ruby/object:Gem::Version
266
294
  version: '0'
267
295
  requirements: []
268
296
  rubyforge_project: sprockets
269
- rubygems_version: 2.2.2
297
+ rubygems_version: 1.8.23
270
298
  signing_key:
271
- specification_version: 4
299
+ specification_version: 3
272
300
  summary: Rack-based asset packaging system
273
301
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: bc422a95c06732b838f61ec50895909c7a23b66b
4
- data.tar.gz: 181162666f7aca9b032582e6a857f9ad19d0a568
5
- SHA512:
6
- metadata.gz: 55c68dc273cbdf040a5b11c5093548dcc66e37c652aced9162344e061a191966b9b50016559c29328e1827ba18c1c28418ea6c5e58c7da3884e4dcc85e190b68
7
- data.tar.gz: 7d492ae84a013fab793f7f0beaee12d0614d27ea4e3e33b03c3432f78346d45ffddeca99930182646bbfd7eea5c42f7a324e285ae7d2cfa929a8118a3d18f001