sprockets 3.5.2 → 3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/sprockets.rb +1 -0
- data/lib/sprockets/cache.rb +3 -1
- data/lib/sprockets/loader.rb +4 -5
- data/lib/sprockets/manifest.rb +17 -0
- data/lib/sprockets/path_utils.rb +2 -4
- data/lib/sprockets/utils/gzip.rb +12 -3
- data/lib/sprockets/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1eef394792f4af6343438fcc3666a88ca893348
|
4
|
+
data.tar.gz: 464e323e318b96534f12621a3f1a5dfc9a024425
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 446a6718c9ae7f0e94e57672680c7bbb2233855000dd813d3dc1867d0d3c6f12f3dcb43abe21f9a72bfcc05bff7524b9030eb771c342d4ea65fdde1169887f21
|
7
|
+
data.tar.gz: e49c3925afb5988848f46439b1e9c3b5334932e599c13398f0a7a6a312dde2f228c0e679bd8fc898e80dd1861bc4fcfedfd807a9872b91b2af14be210870ab7d
|
data/CHANGELOG.md
CHANGED
data/lib/sprockets.rb
CHANGED
@@ -76,6 +76,7 @@ module Sprockets
|
|
76
76
|
|
77
77
|
# Common font types
|
78
78
|
register_mime_type 'application/vnd.ms-fontobject', extensions: ['.eot']
|
79
|
+
register_mime_type 'application/x-font-opentype', extensions: ['.otf']
|
79
80
|
register_mime_type 'application/x-font-ttf', extensions: ['.ttf']
|
80
81
|
register_mime_type 'application/font-woff', extensions: ['.woff']
|
81
82
|
|
data/lib/sprockets/cache.rb
CHANGED
@@ -153,7 +153,9 @@ module Sprockets
|
|
153
153
|
#
|
154
154
|
# Returns a String with a length less than 250 characters.
|
155
155
|
def expand_key(key)
|
156
|
-
|
156
|
+
digest_key = DigestUtils.pack_urlsafe_base64digest(DigestUtils.digest(key))
|
157
|
+
namespace = digest_key[0, 2]
|
158
|
+
"sprockets/v#{VERSION}/#{namespace}/#{digest_key}"
|
157
159
|
end
|
158
160
|
|
159
161
|
PEEK_SIZE = 100
|
data/lib/sprockets/loader.rb
CHANGED
@@ -143,11 +143,10 @@ module Sprockets
|
|
143
143
|
})
|
144
144
|
validate_processor_result!(result)
|
145
145
|
source = result.delete(:data)
|
146
|
-
metadata = result
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
)
|
146
|
+
metadata = result
|
147
|
+
metadata[:charset] = source.encoding.name.downcase unless metadata.key?(:charset)
|
148
|
+
metadata[:digest] = digest(source)
|
149
|
+
metadata[:length] = source.bytesize
|
151
150
|
else
|
152
151
|
dependencies << build_file_digest_uri(unloaded.filename)
|
153
152
|
metadata = {
|
data/lib/sprockets/manifest.rb
CHANGED
@@ -149,6 +149,23 @@ module Sprockets
|
|
149
149
|
nil
|
150
150
|
end
|
151
151
|
|
152
|
+
# Public: Find the source of assets by paths.
|
153
|
+
#
|
154
|
+
# Returns Enumerator of assets file content.
|
155
|
+
def find_sources(*args)
|
156
|
+
return to_enum(__method__, *args) unless block_given?
|
157
|
+
|
158
|
+
if environment
|
159
|
+
find(*args).each do |asset|
|
160
|
+
yield asset.source
|
161
|
+
end
|
162
|
+
else
|
163
|
+
args.each do |path|
|
164
|
+
yield File.binread(File.join(dir, assets[path]))
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
152
169
|
# Compile and write asset to directory. The asset is written to a
|
153
170
|
# fingerprinted filename like
|
154
171
|
# `application-2e8e9a7c6b0aafa0c9bdeec90ea30213.js`. An entry is
|
data/lib/sprockets/path_utils.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
1
|
module Sprockets
|
4
2
|
# Internal: File and path related utilities. Mixed into Environment.
|
5
3
|
#
|
@@ -276,9 +274,9 @@ module Sprockets
|
|
276
274
|
yield f
|
277
275
|
end
|
278
276
|
|
279
|
-
|
277
|
+
File.rename(tmpname, filename)
|
280
278
|
ensure
|
281
|
-
|
279
|
+
File.delete(tmpname) if File.exist?(tmpname)
|
282
280
|
end
|
283
281
|
end
|
284
282
|
end
|
data/lib/sprockets/utils/gzip.rb
CHANGED
@@ -8,6 +8,16 @@ module Sprockets
|
|
8
8
|
@charset = asset.charset
|
9
9
|
end
|
10
10
|
|
11
|
+
# What non-text mime types should we compress? This list comes from:
|
12
|
+
# https://www.fastly.com/blog/new-gzip-settings-and-deciding-what-compress
|
13
|
+
COMPRESSABLE_MIME_TYPES = {
|
14
|
+
"application/vnd.ms-fontobject" => true,
|
15
|
+
"application/x-font-opentype" => true,
|
16
|
+
"application/x-font-ttf" => true,
|
17
|
+
"image/x-icon" => true,
|
18
|
+
"image/svg+xml" => true
|
19
|
+
}
|
20
|
+
|
11
21
|
# Private: Returns whether or not an asset can be compressed.
|
12
22
|
#
|
13
23
|
# We want to compress any file that is text based.
|
@@ -21,9 +31,8 @@ module Sprockets
|
|
21
31
|
# encoded text. We can check this value to see if the asset
|
22
32
|
# can be compressed.
|
23
33
|
#
|
24
|
-
#
|
25
|
-
|
26
|
-
@charset || @content_type == "image/svg+xml".freeze
|
34
|
+
# We also check against our list of non-text compressible mime types
|
35
|
+
@charset || COMPRESSABLE_MIME_TYPES.include?(@content_type)
|
27
36
|
end
|
28
37
|
|
29
38
|
# Private: Opposite of `can_compress?`.
|
data/lib/sprockets/version.rb
CHANGED
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: 3.
|
4
|
+
version: 3.6.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:
|
12
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -332,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
332
|
version: '0'
|
333
333
|
requirements: []
|
334
334
|
rubyforge_project: sprockets
|
335
|
-
rubygems_version: 2.
|
335
|
+
rubygems_version: 2.5.1
|
336
336
|
signing_key:
|
337
337
|
specification_version: 4
|
338
338
|
summary: Rack-based asset packaging system
|