sprockets 2.11.3 → 2.12.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92a457a4b3e0eb70d84a01ffb4631434724d2d2d
4
- data.tar.gz: 5fc9b324ba6359844ff7aae3b939dfa1280d6802
3
+ metadata.gz: 8efd52cbc36180a9d159eccda49e71d3b979ac45
4
+ data.tar.gz: e6ab087dec16c64f2b48607039283e030a9aed04
5
5
  SHA512:
6
- metadata.gz: 465dba63f0800fc7478858e0c3fdf98f5ca2d35f0c179d1bf2af6278f8813320303f6b762b9748c2d5ecc790e82a8058a8be200317cbd1521a62ab5d6181ab8c
7
- data.tar.gz: b3d7d6657eae4938d75e1e88a26991d57cab783216ba5455227d2a5f6dc9590dfc32adf7271ff0946dc212c543e295c04347bc438fd684052841db83e1fe25ba
6
+ metadata.gz: 75c5d0b9cd9cc3001bc7dadc320e8a82b8f8fffac55ce4e49936f720da3ce25d5dd2a8c56e4e93f5ea603b1e69666b7eed80b6d8aaf7936e7f73ed0001316a5e
7
+ data.tar.gz: ec401d6e2fa75d1dc25d7c3a64db8130663c2eb3aeb46cfe8dfebc3a86a4c0a912ffa7694a2fb2c570b9cb0ed5f3bd6f9e1f7212d79275c0fe2a4f542be31eeb
data/README.md CHANGED
@@ -366,6 +366,11 @@ submit a pull request.
366
366
 
367
367
  ## Version History ##
368
368
 
369
+ **2.12.0** (March 13, 2014)
370
+
371
+ * Avoid context reference in SassImporter hack so its Marshallable. Fixes
372
+ issues with Sass 3.3.x.
373
+
369
374
  **2.11.0** (February 19, 2014)
370
375
 
371
376
  * Support for `.bower.json`
@@ -1,19 +1,20 @@
1
1
  require 'sass'
2
2
 
3
3
  module Sprockets
4
- # This custom importer adds sprockets dependency tracking on to Sass
5
- # `@import` statements. This makes the Sprockets and Sass caching
6
- # systems work together.
4
+ # This custom importer that tracks all imported filenames during
5
+ # compile.
7
6
  class SassImporter < Sass::Importers::Filesystem
8
- def initialize(context, root)
9
- @context = context
10
- super root.to_s
7
+ attr_reader :imported_filenames
8
+
9
+ def initialize(*args)
10
+ @imported_filenames = []
11
+ super
11
12
  end
12
13
 
13
14
  def find_relative(*args)
14
15
  engine = super
15
16
  if engine && (filename = engine.options[:filename])
16
- @context.depend_on(filename)
17
+ @imported_filenames << filename
17
18
  end
18
19
  engine
19
20
  end
@@ -21,7 +22,7 @@ module Sprockets
21
22
  def find(*args)
22
23
  engine = super
23
24
  if engine && (filename = engine.options[:filename])
24
- @context.depend_on(filename)
25
+ @imported_filenames << filename
25
26
  end
26
27
  engine
27
28
  end
@@ -42,15 +42,21 @@ module Sprockets
42
42
  :line => line,
43
43
  :syntax => syntax,
44
44
  :cache_store => cache_store,
45
- :importer => SassImporter.new(context, context.pathname),
46
- :load_paths => context.environment.paths.map { |path| SassImporter.new(context, path) },
45
+ :importer => SassImporter.new(context.pathname.to_s),
46
+ :load_paths => context.environment.paths.map { |path| SassImporter.new(path.to_s) },
47
47
  :sprockets => {
48
48
  :context => context,
49
49
  :environment => context.environment
50
50
  }
51
51
  }
52
52
 
53
- ::Sass::Engine.new(data, options).render
53
+ result = ::Sass::Engine.new(data, options).render
54
+
55
+ # Track all imported files
56
+ filenames = ([options[:importer].imported_filenames] + options[:load_paths].map(&:imported_filenames)).flatten.uniq
57
+ filenames.each { |filename| context.depend_on(filename) }
58
+
59
+ result
54
60
  rescue ::Sass::SyntaxError => e
55
61
  # Annotates exception message with parse line number
56
62
  context.__LINE__ = e.sass_backtrace.first[:line]
@@ -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.11.3"
2
+ VERSION = "2.12.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.3
4
+ version: 2.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stephenson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-29 00:00:00.000000000 Z
12
+ date: 2014-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hike
@@ -313,7 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
313
313
  version: '0'
314
314
  requirements: []
315
315
  rubyforge_project: sprockets
316
- rubygems_version: 2.2.2
316
+ rubygems_version: 2.2.0
317
317
  signing_key:
318
318
  specification_version: 4
319
319
  summary: Rack-based asset packaging system