sprockets 2.7.1 → 2.8.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,11 @@ submit a pull request.
361
361
 
362
362
  ## Version History ##
363
363
 
364
+ **2.8.0** (October 16, 2012)
365
+
366
+ * Allow manifest location to be seperated from output directory
367
+ * Pass logical path and absolute path to each_logical_path iterator
368
+
364
369
  **2.7.0** (October 10, 2012)
365
370
 
366
371
  * Added --css-compressor and --js-compressor command line flags
@@ -328,13 +328,20 @@ module Sprockets
328
328
  nil
329
329
  end
330
330
 
331
- def each_logical_path(*args)
331
+ def each_logical_path(*args, &block)
332
332
  return to_enum(__method__, *args) unless block_given?
333
333
  filters = args.flatten
334
334
  files = {}
335
335
  each_file do |filename|
336
336
  if logical_path = logical_path_for_filename(filename, filters)
337
- yield logical_path unless files[logical_path]
337
+ unless files[logical_path]
338
+ if block.arity == 2
339
+ yield logical_path, filename.to_s
340
+ else
341
+ yield logical_path
342
+ end
343
+ end
344
+
338
345
  files[logical_path] = true
339
346
  end
340
347
  end
@@ -393,14 +400,14 @@ module Sprockets
393
400
  def logical_path_for_filename(filename, filters)
394
401
  logical_path = attributes_for(filename).logical_path.to_s
395
402
 
396
- if matches_filter(filters, logical_path)
403
+ if matches_filter(filters, logical_path, filename)
397
404
  return logical_path
398
405
  end
399
406
 
400
407
  # If filename is an index file, retest with alias
401
408
  if File.basename(logical_path)[/[^\.]+/, 0] == 'index'
402
409
  path = logical_path.sub(/\/index\./, '.')
403
- if matches_filter(filters, path)
410
+ if matches_filter(filters, path, filename)
404
411
  return path
405
412
  end
406
413
  end
@@ -408,16 +415,20 @@ module Sprockets
408
415
  nil
409
416
  end
410
417
 
411
- def matches_filter(filters, filename)
418
+ def matches_filter(filters, logical_path, filename)
412
419
  return true if filters.empty?
413
420
 
414
421
  filters.any? do |filter|
415
422
  if filter.is_a?(Regexp)
416
- filter.match(filename)
423
+ filter.match(logical_path)
417
424
  elsif filter.respond_to?(:call)
418
- filter.call(filename)
425
+ if filter.arity == 1
426
+ filter.call(logical_path)
427
+ else
428
+ filter.call(logical_path, filename.to_s)
429
+ end
419
430
  else
420
- File.fnmatch(filter.to_s, filename)
431
+ File.fnmatch(filter.to_s, logical_path)
421
432
  end
422
433
  end
423
434
  end
@@ -29,13 +29,22 @@ module Sprockets
29
29
  @environment = args.shift
30
30
  end
31
31
 
32
- unless path = args.shift
33
- raise ArgumentError, "manifest requires output path"
32
+ @dir, @path = args[0], args[1]
33
+
34
+ # Expand paths
35
+ @dir = File.expand_path(@dir) if @dir
36
+ @path = File.expand_path(@path) if @path
37
+
38
+ # If path is given as the second arg
39
+ if @dir && File.extname(@dir) != ""
40
+ @dir, @path = nil, @dir
34
41
  end
35
42
 
36
- if File.extname(path) == ""
37
- @dir = File.expand_path(path)
43
+ # Default dir to the directory of the path
44
+ @dir ||= File.dirname(@path) if @path
38
45
 
46
+ # If directory is given w/o path, pick a random manifest.json location
47
+ if @dir && @path.nil?
39
48
  # Find the first manifest.json in the directory
40
49
  paths = Dir[File.join(@dir, "manifest*.json")]
41
50
  if paths.any?
@@ -43,9 +52,10 @@ module Sprockets
43
52
  else
44
53
  @path = File.join(@dir, "manifest-#{SecureRandom.hex(16)}.json")
45
54
  end
46
- else
47
- @path = File.expand_path(path)
48
- @dir = File.dirname(path)
55
+ end
56
+
57
+ unless @dir && @path
58
+ raise ArgumentError, "manifest requires output path"
49
59
  end
50
60
 
51
61
  data = nil
@@ -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.7.1"
2
+ VERSION = "2.8.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.7.1
4
+ version: 2.8.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Sam Stephenson
@@ -9,236 +10,268 @@ 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-10-16 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: closure-compiler
78
87
  requirement: !ruby/object:Gem::Requirement
88
+ none: false
79
89
  requirements:
80
- - - ">="
90
+ - - ! '>='
81
91
  - !ruby/object:Gem::Version
82
92
  version: '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: '0'
90
101
  - !ruby/object:Gem::Dependency
91
102
  name: coffee-script
92
103
  requirement: !ruby/object:Gem::Requirement
104
+ none: false
93
105
  requirements:
94
- - - "~>"
106
+ - - ~>
95
107
  - !ruby/object:Gem::Version
96
108
  version: '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: '2.0'
104
117
  - !ruby/object:Gem::Dependency
105
118
  name: coffee-script-source
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.2.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.2.0
118
133
  - !ruby/object:Gem::Dependency
119
134
  name: eco
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: ejs
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: execjs
148
167
  requirement: !ruby/object:Gem::Requirement
168
+ none: false
149
169
  requirements:
150
- - - "~>"
170
+ - - ~>
151
171
  - !ruby/object:Gem::Version
152
172
  version: '1.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: '1.0'
160
181
  - !ruby/object:Gem::Dependency
161
182
  name: json
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: rack-test
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: rake
190
215
  requirement: !ruby/object:Gem::Requirement
216
+ none: false
191
217
  requirements:
192
- - - ">="
218
+ - - ! '>='
193
219
  - !ruby/object:Gem::Version
194
220
  version: '0'
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: '0'
202
229
  - !ruby/object:Gem::Dependency
203
230
  name: sass
204
231
  requirement: !ruby/object:Gem::Requirement
232
+ none: false
205
233
  requirements:
206
- - - "~>"
234
+ - - ~>
207
235
  - !ruby/object:Gem::Version
208
236
  version: '3.1'
209
237
  type: :development
210
238
  prerelease: false
211
239
  version_requirements: !ruby/object:Gem::Requirement
240
+ none: false
212
241
  requirements:
213
- - - "~>"
242
+ - - ~>
214
243
  - !ruby/object:Gem::Version
215
244
  version: '3.1'
216
245
  - !ruby/object:Gem::Dependency
217
246
  name: uglifier
218
247
  requirement: !ruby/object:Gem::Requirement
248
+ none: false
219
249
  requirements:
220
- - - ">="
250
+ - - ! '>='
221
251
  - !ruby/object:Gem::Version
222
252
  version: '0'
223
253
  type: :development
224
254
  prerelease: false
225
255
  version_requirements: !ruby/object:Gem::Requirement
256
+ none: false
226
257
  requirements:
227
- - - ">="
258
+ - - ! '>='
228
259
  - !ruby/object:Gem::Version
229
260
  version: '0'
230
261
  - !ruby/object:Gem::Dependency
231
262
  name: yui-compressor
232
263
  requirement: !ruby/object:Gem::Requirement
264
+ none: false
233
265
  requirements:
234
- - - ">="
266
+ - - ! '>='
235
267
  - !ruby/object:Gem::Version
236
268
  version: '0'
237
269
  type: :development
238
270
  prerelease: false
239
271
  version_requirements: !ruby/object:Gem::Requirement
272
+ none: false
240
273
  requirements:
241
- - - ">="
274
+ - - ! '>='
242
275
  - !ruby/object:Gem::Version
243
276
  version: '0'
244
277
  description: Sprockets is a Rack-based asset packaging system that concatenates and
@@ -251,11 +284,9 @@ executables:
251
284
  extensions: []
252
285
  extra_rdoc_files: []
253
286
  files:
254
- - LICENSE
255
287
  - README.md
256
- - bin/sprockets
288
+ - LICENSE
257
289
  - lib/rake/sprocketstask.rb
258
- - lib/sprockets.rb
259
290
  - lib/sprockets/asset.rb
260
291
  - lib/sprockets/asset_attributes.rb
261
292
  - lib/sprockets/base.rb
@@ -293,27 +324,30 @@ files:
293
324
  - lib/sprockets/utils.rb
294
325
  - lib/sprockets/version.rb
295
326
  - lib/sprockets/yui_compressor.rb
327
+ - lib/sprockets.rb
328
+ - bin/sprockets
296
329
  homepage: http://getsprockets.org/
297
330
  licenses: []
298
- metadata: {}
299
331
  post_install_message:
300
332
  rdoc_options: []
301
333
  require_paths:
302
334
  - lib
303
335
  required_ruby_version: !ruby/object:Gem::Requirement
336
+ none: false
304
337
  requirements:
305
- - - ">="
338
+ - - ! '>='
306
339
  - !ruby/object:Gem::Version
307
340
  version: '0'
308
341
  required_rubygems_version: !ruby/object:Gem::Requirement
342
+ none: false
309
343
  requirements:
310
- - - ">="
344
+ - - ! '>='
311
345
  - !ruby/object:Gem::Version
312
346
  version: '0'
313
347
  requirements: []
314
348
  rubyforge_project: sprockets
315
- rubygems_version: 2.2.2
349
+ rubygems_version: 1.8.24
316
350
  signing_key:
317
- specification_version: 4
351
+ specification_version: 3
318
352
  summary: Rack-based asset packaging system
319
353
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: bd131a2e00f9178f759b95e16f8bb509a7dba2a7
4
- data.tar.gz: 7699e641eefe68cf240de00163007a6c216eecdc
5
- SHA512:
6
- metadata.gz: e850fb0f904942c5b0e18f98053d7b88e44b8fb6ee3f271b590d9aad989f133e42af8e43c159a06f944f7bb984c0c52f28a4a3d6d6289e2636893349f45b5045
7
- data.tar.gz: 80ff64f26e34c7dfbdaae695ba717e29760a0088d6acf2d81bc75c8a92062067e64f7b1505acc0771e8a33f3a8455d0ec0e96d6f0f35683ce7dcef471226a14f