sprockets 2.3.3 → 2.4.6

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: 7d49453908a650a88e75856c3002fc529139583d
4
- data.tar.gz: c4032fb6c3197b5872097d55365b1e3c8547369d
3
+ metadata.gz: 1471328329eb1e6f3a8e218553de19ded2731956
4
+ data.tar.gz: 8bd2fc9eb30ab785ef04ed901a86ee3e9b416775
5
5
  SHA512:
6
- metadata.gz: eeaf6c406818a6736564bad41f732b7f45c18504625caa8e4a71cb0466e6238656ade799b1f4c4c1a5e37c4142f8180e0136cfa6489a88a93e59e70cbf9a5346
7
- data.tar.gz: 1d3f359e15024afc8828d45f868b73a8685d21d69a9e93e4dfd57afb7a4043f5e06f84f49d714ebb879e0855ae6c866a83b042770756bf03dbf64fe2288fcfe5
6
+ metadata.gz: ade13ae863b06566bf143574ade26233e005dbf078ed400b6e7b5e0a3b370017b22f464c0e08da0416244c47e3044b1fb7e9705467620cf38e113424d432da1a
7
+ data.tar.gz: b50b7d1451f79a7d7446ac2ae428b36b6d006d1901e2ab86c0a489b642a30f217eed3a53dbc6f2414413fcad76b9bd427f22131bc853c68119d4a063608adaba
data/README.md CHANGED
@@ -361,6 +361,34 @@ submit a pull request.
361
361
 
362
362
  ## Version History ##
363
363
 
364
+ **2.4.5** (July 10, 2012)
365
+
366
+ * Tweaked some logger levels
367
+
368
+ **2.4.4** (July 2, 2012)
369
+
370
+ * Canonicalize logical path extensions
371
+ * Check absolute paths passed to depend_on
372
+
373
+ **2.4.3** (May 16, 2012)
374
+
375
+ * Exposed :sprockets in sass options
376
+ * Include dependency paths in asset mtime
377
+
378
+ **2.4.2** (May 7, 2012)
379
+
380
+ * Fixed MultiJson feature detect
381
+
382
+ **2.4.1** (April 26, 2012)
383
+
384
+ * Fixed MultiJson API change
385
+ * Fixed gzip mtime
386
+
387
+ **2.4.0** (March 27, 2012)
388
+
389
+ * Added global path registry
390
+ * Added global processor registry
391
+
364
392
  **2.3.2** (March 26, 2012)
365
393
 
366
394
  * Fix Context#logical_path with dots
data/lib/sprockets.rb CHANGED
@@ -3,7 +3,6 @@ require 'sprockets/version'
3
3
  module Sprockets
4
4
  # Environment
5
5
  autoload :Base, "sprockets/base"
6
- autoload :Engines, "sprockets/engines"
7
6
  autoload :Environment, "sprockets/environment"
8
7
  autoload :Index, "sprockets/index"
9
8
  autoload :Manifest, "sprockets/manifest"
@@ -15,14 +14,11 @@ module Sprockets
15
14
  autoload :StaticAsset, "sprockets/static_asset"
16
15
 
17
16
  # Processing
18
- autoload :CharsetNormalizer, "sprockets/charset_normalizer"
19
17
  autoload :Context, "sprockets/context"
20
- autoload :DirectiveProcessor, "sprockets/directive_processor"
21
18
  autoload :EcoTemplate, "sprockets/eco_template"
22
19
  autoload :EjsTemplate, "sprockets/ejs_template"
23
20
  autoload :JstProcessor, "sprockets/jst_processor"
24
21
  autoload :Processor, "sprockets/processor"
25
- autoload :SafetyColons, "sprockets/safety_colons"
26
22
  autoload :SassCacheStore, "sprockets/sass_cache_store"
27
23
  autoload :SassImporter, "sprockets/sass_importer"
28
24
  autoload :SassTemplate, "sprockets/sass_template"
@@ -43,8 +39,32 @@ module Sprockets
43
39
  end
44
40
 
45
41
  # Extend Sprockets module to provide global registry
46
- extend Engines
47
- @engines = {}
42
+ require 'hike'
43
+ require 'sprockets/engines'
44
+ require 'sprockets/mime'
45
+ require 'sprockets/processing'
46
+ require 'sprockets/paths'
47
+ extend Engines, Mime, Processing, Paths
48
+
49
+ @trail = Hike::Trail.new(File.expand_path('..', __FILE__))
50
+ @mime_types = {}
51
+ @engines = {}
52
+ @preprocessors = Hash.new { |h, k| h[k] = [] }
53
+ @postprocessors = Hash.new { |h, k| h[k] = [] }
54
+ @bundle_processors = Hash.new { |h, k| h[k] = [] }
55
+
56
+ register_mime_type 'text/css', '.css'
57
+ register_mime_type 'application/javascript', '.js'
58
+
59
+ require 'sprockets/directive_processor'
60
+ register_preprocessor 'text/css', DirectiveProcessor
61
+ register_preprocessor 'application/javascript', DirectiveProcessor
62
+
63
+ require 'sprockets/safety_colons'
64
+ register_postprocessor 'application/javascript', SafetyColons
65
+
66
+ require 'sprockets/charset_normalizer'
67
+ register_bundle_processor 'text/css', CharsetNormalizer
48
68
 
49
69
  # Cherry pick the default Tilt engines that make sense for
50
70
  # Sprockets. We don't need ones that only generate html like HAML.
@@ -33,6 +33,8 @@ module Sprockets
33
33
  alias_method :bytesize, :length
34
34
 
35
35
  def initialize(environment, logical_path, pathname)
36
+ raise ArgumentError, "Asset logical path has no extension: #{logical_path}" if File.extname(logical_path) == ""
37
+
36
38
  @root = environment.root
37
39
  @logical_path = logical_path.to_s
38
40
  @pathname = Pathname.new(pathname)
@@ -145,6 +147,7 @@ module Sprockets
145
147
  if options[:compress]
146
148
  # Run contents through `Zlib`
147
149
  gz = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION)
150
+ gz.mtime = mtime.to_i
148
151
  gz.write to_s
149
152
  gz.close
150
153
  else
@@ -1,17 +1,16 @@
1
1
  require 'sprockets/asset_attributes'
2
2
  require 'sprockets/bundled_asset'
3
3
  require 'sprockets/caching'
4
+ require 'sprockets/errors'
4
5
  require 'sprockets/processed_asset'
5
- require 'sprockets/processing'
6
6
  require 'sprockets/server'
7
7
  require 'sprockets/static_asset'
8
- require 'sprockets/trail'
9
8
  require 'pathname'
10
9
 
11
10
  module Sprockets
12
11
  # `Base` class for `Environment` and `Index`.
13
12
  class Base
14
- include Caching, Processing, Server, Trail
13
+ include Caching, Paths, Mime, Processing, Engines, Server
15
14
 
16
15
  # Returns a `Digest` implementation class.
17
16
  #
@@ -98,6 +97,98 @@ module Sprockets
98
97
  @cache = cache
99
98
  end
100
99
 
100
+ def prepend_path(path)
101
+ # Overrides the global behavior to expire the index
102
+ expire_index!
103
+ super
104
+ end
105
+
106
+ def append_path(path)
107
+ # Overrides the global behavior to expire the index
108
+ expire_index!
109
+ super
110
+ end
111
+
112
+ def clear_paths
113
+ # Overrides the global behavior to expire the index
114
+ expire_index!
115
+ super
116
+ end
117
+
118
+ # Finds the expanded real path for a given logical path by
119
+ # searching the environment's paths.
120
+ #
121
+ # resolve("application.js")
122
+ # # => "/path/to/app/javascripts/application.js.coffee"
123
+ #
124
+ # A `FileNotFound` exception is raised if the file does not exist.
125
+ def resolve(logical_path, options = {})
126
+ # If a block is given, preform an iterable search
127
+ if block_given?
128
+ args = attributes_for(logical_path).search_paths + [options]
129
+ @trail.find(*args) do |path|
130
+ yield Pathname.new(path)
131
+ end
132
+ else
133
+ resolve(logical_path, options) do |pathname|
134
+ return pathname
135
+ end
136
+ raise FileNotFound, "couldn't find file '#{logical_path}'"
137
+ end
138
+ end
139
+
140
+ # Register a new mime type.
141
+ def register_mime_type(mime_type, ext)
142
+ # Overrides the global behavior to expire the index
143
+ expire_index!
144
+ @trail.append_extension(ext)
145
+ super
146
+ end
147
+
148
+ # Registers a new Engine `klass` for `ext`.
149
+ def register_engine(ext, klass)
150
+ # Overrides the global behavior to expire the index
151
+ expire_index!
152
+ add_engine_to_trail(ext, klass)
153
+ super
154
+ end
155
+
156
+ def register_preprocessor(mime_type, klass, &block)
157
+ # Overrides the global behavior to expire the index
158
+ expire_index!
159
+ super
160
+ end
161
+
162
+ def unregister_preprocessor(mime_type, klass)
163
+ # Overrides the global behavior to expire the index
164
+ expire_index!
165
+ super
166
+ end
167
+
168
+ def register_postprocessor(mime_type, klass, &block)
169
+ # Overrides the global behavior to expire the index
170
+ expire_index!
171
+ super
172
+ end
173
+
174
+ def unregister_postprocessor(mime_type, klass)
175
+ # Overrides the global behavior to expire the index
176
+ expire_index!
177
+ super
178
+ end
179
+
180
+ def register_bundle_processor(mime_type, klass, &block)
181
+ # Overrides the global behavior to expire the index
182
+ expire_index!
183
+ super
184
+ end
185
+
186
+ def unregister_bundle_processor(mime_type, klass)
187
+ # Overrides the global behavior to expire the index
188
+ expire_index!
189
+ super
190
+ end
191
+
101
192
  # Return an `Index`. Must be implemented by the subclass.
102
193
  def index
103
194
  raise NotImplementedError
@@ -113,14 +204,14 @@ module Sprockets
113
204
  #
114
205
  # Subclasses may cache this method.
115
206
  def entries(pathname)
116
- trail.entries(pathname)
207
+ @trail.entries(pathname)
117
208
  end
118
209
 
119
210
  # Works like `File.stat`.
120
211
  #
121
212
  # Subclasses may cache this method.
122
213
  def stat(path)
123
- trail.stat(path)
214
+ @trail.stat(path)
124
215
  end
125
216
 
126
217
  # Read and compute digest of filename.
@@ -161,6 +252,16 @@ module Sprockets
161
252
  else
162
253
  begin
163
254
  pathname = resolve(logical_path)
255
+
256
+ # If logical path is missing a mime type extension, append
257
+ # the absolute path extname so it has one.
258
+ #
259
+ # Ensures some consistency between finding "foo/bar" vs
260
+ # "foo/bar.js".
261
+ if File.extname(logical_path) == ""
262
+ expanded_logical_path = attributes_for(pathname).logical_path
263
+ logical_path += File.extname(expanded_logical_path)
264
+ end
164
265
  rescue FileNotFound
165
266
  return nil
166
267
  end
@@ -13,8 +13,9 @@ module Sprockets
13
13
  def initialize(environment, logical_path, pathname)
14
14
  super(environment, logical_path, pathname)
15
15
 
16
- @processed_asset = environment.find_asset(pathname, :bundle => false)
17
- @required_assets = @processed_asset.required_assets
16
+ @processed_asset = environment.find_asset(pathname, :bundle => false)
17
+ @required_assets = @processed_asset.required_assets
18
+ @dependency_paths = @processed_asset.dependency_paths
18
19
 
19
20
  @source = ""
20
21
 
@@ -26,7 +27,7 @@ module Sprockets
26
27
  @source = context.evaluate(pathname, :data => @source,
27
28
  :processors => environment.bundle_processors(content_type))
28
29
 
29
- @mtime = to_a.map(&:mtime).max
30
+ @mtime = (to_a + @dependency_paths).map(&:mtime).max
30
31
  @length = Rack::Utils.bytesize(source)
31
32
  @digest = environment.digest.update(source).hexdigest
32
33
  end
@@ -81,7 +81,11 @@ module Sprockets
81
81
  attributes = environment.attributes_for(pathname)
82
82
 
83
83
  if pathname.absolute?
84
- pathname
84
+ if environment.stat(pathname)
85
+ pathname
86
+ else
87
+ raise FileNotFound, "couldn't find file '#{pathname}'"
88
+ end
85
89
 
86
90
  elsif content_type = options[:content_type]
87
91
  content_type = self.content_type if content_type == :self
@@ -28,12 +28,12 @@ module Sprockets
28
28
  # Sprockets.register_engine '.sass', SassTemplate
29
29
  #
30
30
  module Engines
31
- # Returns an `Array` of `Engine`s registered on the
32
- # `Environment`. If an `ext` argument is supplied, the `Engine`
33
- # register under that extension will be returned.
31
+ # Returns a `Hash` of `Engine`s registered on the `Environment`.
32
+ # If an `ext` argument is supplied, the `Engine` associated with
33
+ # that extension will be returned.
34
34
  #
35
35
  # environment.engines
36
- # # => [CoffeeScriptTemplate, SassTemplate, ...]
36
+ # # => {".coffee" => CoffeeScriptTemplate, ".sass" => SassTemplate, ...}
37
37
  #
38
38
  # environment.engines('.coffee')
39
39
  # # => CoffeeScriptTemplate
@@ -1,9 +1,6 @@
1
1
  require 'sprockets/base'
2
- require 'sprockets/charset_normalizer'
3
2
  require 'sprockets/context'
4
- require 'sprockets/directive_processor'
5
3
  require 'sprockets/index'
6
- require 'sprockets/safety_colons'
7
4
 
8
5
  require 'hike'
9
6
  require 'logger'
@@ -35,24 +32,23 @@ module Sprockets
35
32
  @digest_class = ::Digest::MD5
36
33
  @version = ''
37
34
 
38
- @mime_types = {}
35
+ @mime_types = Sprockets.registered_mime_types
39
36
  @engines = Sprockets.engines
40
- @preprocessors = Hash.new { |h, k| h[k] = [] }
41
- @postprocessors = Hash.new { |h, k| h[k] = [] }
42
- @bundle_processors = Hash.new { |h, k| h[k] = [] }
37
+ @preprocessors = Sprockets.preprocessors
38
+ @postprocessors = Sprockets.postprocessors
39
+ @bundle_processors = Sprockets.bundle_processors
40
+
41
+ Sprockets.paths.each do |path|
42
+ append_path(path)
43
+ end
43
44
 
44
45
  @engines.each do |ext, klass|
45
46
  add_engine_to_trail(ext, klass)
46
47
  end
47
48
 
48
- register_mime_type 'text/css', '.css'
49
- register_mime_type 'application/javascript', '.js'
50
-
51
- register_preprocessor 'text/css', DirectiveProcessor
52
- register_preprocessor 'application/javascript', DirectiveProcessor
53
-
54
- register_postprocessor 'application/javascript', SafetyColons
55
- register_bundle_processor 'text/css', CharsetNormalizer
49
+ @mime_types.each do |ext, type|
50
+ @trail.append_extension(ext)
51
+ end
56
52
 
57
53
  expire_index!
58
54
 
@@ -37,7 +37,7 @@ module Sprockets
37
37
 
38
38
  begin
39
39
  if File.exist?(@path)
40
- data = MultiJson.decode(File.read(@path))
40
+ data = json_decode(File.read(@path))
41
41
  end
42
42
  rescue MultiJson::DecodeError => e
43
43
  logger.error "#{@path} is invalid: #{e.class} #{e.message}"
@@ -84,7 +84,7 @@ module Sprockets
84
84
  #
85
85
  def compile(*args)
86
86
  paths = environment.each_logical_path(*args).to_a +
87
- args.flatten.select { |fn| Pathname.new(fn).absolute? }
87
+ args.flatten.select { |fn| Pathname.new(fn).absolute? if fn.is_a?(String)}
88
88
 
89
89
  paths.each do |path|
90
90
  if asset = find_asset(path)
@@ -129,7 +129,7 @@ module Sprockets
129
129
 
130
130
  save
131
131
 
132
- logger.warn "Removed #{filename}"
132
+ logger.info "Removed #{filename}"
133
133
 
134
134
  nil
135
135
  end
@@ -152,7 +152,7 @@ module Sprockets
152
152
  # Wipe directive
153
153
  def clobber
154
154
  FileUtils.rm_r(@dir) if File.exist?(@dir)
155
- logger.warn "Removed #{@dir}"
155
+ logger.info "Removed #{@dir}"
156
156
  nil
157
157
  end
158
158
 
@@ -178,7 +178,7 @@ module Sprockets
178
178
  ms = benchmark do
179
179
  asset = environment.find_asset(logical_path)
180
180
  end
181
- logger.warn "Compiled #{logical_path} (#{ms}ms)"
181
+ logger.debug "Compiled #{logical_path} (#{ms}ms)"
182
182
  asset
183
183
  end
184
184
 
@@ -186,11 +186,30 @@ module Sprockets
186
186
  def save
187
187
  FileUtils.mkdir_p dir
188
188
  File.open(path, 'w') do |f|
189
- f.write MultiJson.encode(@data)
189
+ f.write json_encode(@data)
190
190
  end
191
191
  end
192
192
 
193
193
  private
194
+ # Feature detect newer MultiJson API
195
+ if MultiJson.respond_to?(:dump)
196
+ def json_decode(obj)
197
+ MultiJson.load(obj)
198
+ end
199
+
200
+ def json_encode(obj)
201
+ MultiJson.dump(obj)
202
+ end
203
+ else
204
+ def json_decode(obj)
205
+ MultiJson.decode(obj)
206
+ end
207
+
208
+ def json_encode(obj)
209
+ MultiJson.encode(obj)
210
+ end
211
+ end
212
+
194
213
  def logger
195
214
  environment.logger
196
215
  end
@@ -15,6 +15,11 @@ module Sprockets
15
15
  end
16
16
  end
17
17
 
18
+ # Returns a `Hash` of explicitly registered mime types.
19
+ def registered_mime_types
20
+ @mime_types.dup
21
+ end
22
+
18
23
  if {}.respond_to?(:key)
19
24
  def extension_for_mime_type(type)
20
25
  mime_types.key(type)
@@ -41,8 +46,4 @@ module Sprockets
41
46
  end
42
47
  end
43
48
  end
44
-
45
- # Extend Sprockets module to provide global registry
46
- extend Mime
47
- @mime_types = {}
48
49
  end
@@ -1,16 +1,11 @@
1
- require 'sprockets/errors'
2
- require 'pathname'
3
-
4
1
  module Sprockets
5
- # `Trail` is an internal mixin whose public methods are exposed on
6
- # the `Environment` and `Index` classes.
7
- module Trail
2
+ module Paths
8
3
  # Returns `Environment` root.
9
4
  #
10
5
  # All relative paths are expanded with root as its base. To be
11
6
  # useful set this to your applications root directory. (`Rails.root`)
12
7
  def root
13
- trail.root.dup
8
+ @trail.root.dup
14
9
  end
15
10
 
16
11
  # Returns an `Array` of path `String`s.
@@ -21,14 +16,13 @@ module Sprockets
21
16
  # have no affect on the environment. See `append_path`,
22
17
  # `prepend_path`, and `clear_paths`.
23
18
  def paths
24
- trail.paths.dup
19
+ @trail.paths.dup
25
20
  end
26
21
 
27
22
  # Prepend a `path` to the `paths` list.
28
23
  #
29
24
  # Paths at the end of the `Array` have the least priority.
30
25
  def prepend_path(path)
31
- expire_index!
32
26
  @trail.prepend_path(path)
33
27
  end
34
28
 
@@ -36,7 +30,6 @@ module Sprockets
36
30
  #
37
31
  # Paths at the beginning of the `Array` have a higher priority.
38
32
  def append_path(path)
39
- expire_index!
40
33
  @trail.append_path(path)
41
34
  end
42
35
 
@@ -46,7 +39,6 @@ module Sprockets
46
39
  # completely wipe the paths list and reappend them in the order
47
40
  # you want.
48
41
  def clear_paths
49
- expire_index!
50
42
  @trail.paths.dup.each { |path| @trail.remove_path(path) }
51
43
  end
52
44
 
@@ -57,34 +49,10 @@ module Sprockets
57
49
  # # => [".js", ".css", ".coffee", ".sass", ...]
58
50
  #
59
51
  def extensions
60
- trail.extensions.dup
61
- end
62
-
63
- # Finds the expanded real path for a given logical path by
64
- # searching the environment's paths.
65
- #
66
- # resolve("application.js")
67
- # # => "/path/to/app/javascripts/application.js.coffee"
68
- #
69
- # A `FileNotFound` exception is raised if the file does not exist.
70
- def resolve(logical_path, options = {})
71
- # If a block is given, preform an iterable search
72
- if block_given?
73
- args = attributes_for(logical_path).search_paths + [options]
74
- trail.find(*args) do |path|
75
- yield Pathname.new(path)
76
- end
77
- else
78
- resolve(logical_path, options) do |pathname|
79
- return pathname
80
- end
81
- raise FileNotFound, "couldn't find file '#{logical_path}'"
82
- end
52
+ @trail.extensions.dup
83
53
  end
84
54
 
85
55
  protected
86
- def trail
87
- @trail
88
- end
56
+ attr_reader :trail
89
57
  end
90
58
  end
@@ -19,7 +19,7 @@ module Sprockets
19
19
  @dependency_digest = compute_dependency_digest(environment)
20
20
 
21
21
  elapsed_time = ((Time.now.to_f - start_time) * 1000).to_i
22
- environment.logger.info "Compiled #{logical_path} (#{elapsed_time}ms) (pid #{Process.pid})"
22
+ environment.logger.debug "Compiled #{logical_path} (#{elapsed_time}ms) (pid #{Process.pid})"
23
23
  end
24
24
 
25
25
  # Interal: Used to check equality
@@ -7,16 +7,6 @@ module Sprockets
7
7
  # `Processing` is an internal mixin whose public methods are exposed on
8
8
  # the `Environment` and `Index` classes.
9
9
  module Processing
10
- include Engines, Mime
11
-
12
- # Register a new mime type.
13
- def register_mime_type(mime_type, ext)
14
- # Overrides the global behavior to expire the index
15
- expire_index!
16
- @trail.append_extension(ext)
17
- super
18
- end
19
-
20
10
  # Returns an `Array` of format extension `String`s.
21
11
  #
22
12
  # format_extensions
@@ -26,14 +16,6 @@ module Sprockets
26
16
  @trail.extensions - @engines.keys
27
17
  end
28
18
 
29
- # Registers a new Engine `klass` for `ext`.
30
- def register_engine(ext, klass)
31
- # Overrides the global behavior to expire the index
32
- expire_index!
33
- add_engine_to_trail(ext, klass)
34
- super
35
- end
36
-
37
19
  # Deprecated alias for `preprocessors`.
38
20
  def processors(*args)
39
21
  preprocessors(*args)
@@ -83,13 +65,11 @@ module Sprockets
83
65
  #
84
66
  # A block can be passed for to create a shorthand processor.
85
67
  #
86
- # register_preprocessor :my_processor do |context, data|
68
+ # register_preprocessor 'text/css', :my_processor do |context, data|
87
69
  # data.gsub(...)
88
70
  # end
89
71
  #
90
72
  def register_preprocessor(mime_type, klass, &block)
91
- expire_index!
92
-
93
73
  if block_given?
94
74
  name = klass.to_s
95
75
  klass = Class.new(Processor) do
@@ -107,13 +87,11 @@ module Sprockets
107
87
  #
108
88
  # A block can be passed for to create a shorthand processor.
109
89
  #
110
- # register_postprocessor :my_processor do |context, data|
90
+ # register_postprocessor 'text/css', :my_processor do |context, data|
111
91
  # data.gsub(...)
112
92
  # end
113
93
  #
114
94
  def register_postprocessor(mime_type, klass, &block)
115
- expire_index!
116
-
117
95
  if block_given?
118
96
  name = klass.to_s
119
97
  klass = Class.new(Processor) do
@@ -135,8 +113,6 @@ module Sprockets
135
113
  # unregister_preprocessor 'text/css', Sprockets::DirectiveProcessor
136
114
  #
137
115
  def unregister_preprocessor(mime_type, klass)
138
- expire_index!
139
-
140
116
  if klass.is_a?(String) || klass.is_a?(Symbol)
141
117
  klass = @preprocessors[mime_type].detect { |cls|
142
118
  cls.respond_to?(:name) &&
@@ -152,8 +128,6 @@ module Sprockets
152
128
  # unregister_postprocessor 'text/css', Sprockets::DirectiveProcessor
153
129
  #
154
130
  def unregister_postprocessor(mime_type, klass)
155
- expire_index!
156
-
157
131
  if klass.is_a?(String) || klass.is_a?(Symbol)
158
132
  klass = @postprocessors[mime_type].detect { |cls|
159
133
  cls.respond_to?(:name) &&
@@ -192,8 +166,6 @@ module Sprockets
192
166
  # end
193
167
  #
194
168
  def register_bundle_processor(mime_type, klass, &block)
195
- expire_index!
196
-
197
169
  if block_given?
198
170
  name = klass.to_s
199
171
  klass = Class.new(Processor) do
@@ -210,8 +182,6 @@ module Sprockets
210
182
  # unregister_bundle_processor 'text/css', Sprockets::CharsetNormalizer
211
183
  #
212
184
  def unregister_bundle_processor(mime_type, klass)
213
- expire_index!
214
-
215
185
  if klass.is_a?(String) || klass.is_a?(Symbol)
216
186
  klass = @bundle_processors[mime_type].detect { |cls|
217
187
  cls.respond_to?(:name) &&
@@ -234,8 +204,6 @@ module Sprockets
234
204
  #
235
205
  # The compressor object must respond to `compress` or `compile`.
236
206
  def css_compressor=(compressor)
237
- expire_index!
238
-
239
207
  unregister_bundle_processor 'text/css', :css_compressor
240
208
  return unless compressor
241
209
 
@@ -256,8 +224,6 @@ module Sprockets
256
224
  #
257
225
  # The compressor object must respond to `compress` or `compile`.
258
226
  def js_compressor=(compressor)
259
- expire_index!
260
-
261
227
  unregister_bundle_processor 'application/javascript', :js_compressor
262
228
  return unless compressor
263
229
 
@@ -34,7 +34,11 @@ module Sprockets
34
34
  :syntax => syntax,
35
35
  :cache_store => cache_store,
36
36
  :importer => SassImporter.new(context, context.pathname),
37
- :load_paths => context.environment.paths.map { |path| SassImporter.new(context, path) }
37
+ :load_paths => context.environment.paths.map { |path| SassImporter.new(context, path) },
38
+ :sprockets => {
39
+ :context => context,
40
+ :environment => context.environment
41
+ }
38
42
  }
39
43
 
40
44
  ::Sass::Engine.new(data, options).render
@@ -30,6 +30,7 @@ module Sprockets
30
30
  pathname.open('rb') do |rd|
31
31
  File.open("#{filename}+", 'wb') do |wr|
32
32
  gz = Zlib::GzipWriter.new(wr, Zlib::BEST_COMPRESSION)
33
+ gz.mtime = mtime.to_i
33
34
  buf = ""
34
35
  while rd.read(16384, buf)
35
36
  gz.write(buf)
@@ -1,3 +1,3 @@
1
1
  module Sprockets
2
- VERSION = "2.3.3"
2
+ VERSION = "2.4.6"
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.3.3
4
+ version: 2.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stephenson
@@ -232,6 +232,7 @@ files:
232
232
  - lib/sprockets/jst_processor.rb
233
233
  - lib/sprockets/manifest.rb
234
234
  - lib/sprockets/mime.rb
235
+ - lib/sprockets/paths.rb
235
236
  - lib/sprockets/processed_asset.rb
236
237
  - lib/sprockets/processing.rb
237
238
  - lib/sprockets/processor.rb
@@ -242,7 +243,6 @@ files:
242
243
  - lib/sprockets/scss_template.rb
243
244
  - lib/sprockets/server.rb
244
245
  - lib/sprockets/static_asset.rb
245
- - lib/sprockets/trail.rb
246
246
  - lib/sprockets/utils.rb
247
247
  - lib/sprockets/version.rb
248
248
  homepage: http://getsprockets.org/