sprockets 3.0.2 → 3.0.3
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/lib/sprockets/errors.rb +0 -1
- data/lib/sprockets/loader.rb +12 -26
- data/lib/sprockets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52d2bf02cdc6fea8149c3e97e01f3beb73206ffd
|
4
|
+
data.tar.gz: 0c7a54162f7423cce7008406f80139d52269676f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0133bd2b3561392e0ad2b17fac3fa2843234b5fd90c44de782882f709dafbe62008babd0ada300e98325cb99792dfa2cb1902c6fbba69b728787208b04ee83af
|
7
|
+
data.tar.gz: a2ac64bbcac2aac490a9192da4d9aa23aeb1998296953df9af8627075cdb9c14b9cd7f6f5c106a397ba1ad637edb93dc27016d91f64f894556af2f5a993c888a
|
data/lib/sprockets/errors.rb
CHANGED
data/lib/sprockets/loader.rb
CHANGED
@@ -26,8 +26,13 @@ module Sprockets
|
|
26
26
|
def load(uri)
|
27
27
|
filename, params = parse_asset_uri(uri)
|
28
28
|
if params.key?(:id)
|
29
|
-
asset = cache.
|
30
|
-
|
29
|
+
unless asset = cache.get("asset-uri:#{VERSION}:#{uri}", true)
|
30
|
+
id = params.delete(:id)
|
31
|
+
uri_without_id = build_asset_uri(filename, params)
|
32
|
+
asset = load_asset_by_uri(uri_without_id, filename, params)
|
33
|
+
if asset[:id] != id
|
34
|
+
@logger.warn "Sprockets load error: Tried to find #{uri}, but latest was id #{asset[:id]}"
|
35
|
+
end
|
31
36
|
end
|
32
37
|
else
|
33
38
|
asset = fetch_asset_from_dependency_cache(uri, filename) do |paths|
|
@@ -45,28 +50,7 @@ module Sprockets
|
|
45
50
|
end
|
46
51
|
|
47
52
|
private
|
48
|
-
def load_asset_by_id_uri(uri, filename, params)
|
49
|
-
# Internal assertion, should be routed through load_asset_by_uri
|
50
|
-
unless id = params.delete(:id)
|
51
|
-
raise ArgumentError, "expected uri to have an id: #{uri}"
|
52
|
-
end
|
53
|
-
|
54
|
-
uri = build_asset_uri(filename, params)
|
55
|
-
asset = load_asset_by_uri(uri, filename, params)
|
56
|
-
|
57
|
-
if id && asset[:id] != id
|
58
|
-
raise VersionNotFound, "could not find specified id: #{uri}##{id}"
|
59
|
-
end
|
60
|
-
|
61
|
-
asset
|
62
|
-
end
|
63
|
-
|
64
53
|
def load_asset_by_uri(uri, filename, params)
|
65
|
-
# Internal assertion, should be routed through load_asset_by_id_uri
|
66
|
-
if params.key?(:id)
|
67
|
-
raise ArgumentError, "expected uri to have no id: #{uri}"
|
68
|
-
end
|
69
|
-
|
70
54
|
unless file?(filename)
|
71
55
|
raise FileNotFound, "could not find file: #{filename}"
|
72
56
|
end
|
@@ -118,6 +102,7 @@ module Sprockets
|
|
118
102
|
length: source.bytesize
|
119
103
|
)
|
120
104
|
else
|
105
|
+
dependencies << build_file_digest_uri(filename)
|
121
106
|
metadata = {
|
122
107
|
digest: file_digest(filename),
|
123
108
|
length: self.stat(filename).size,
|
@@ -145,11 +130,12 @@ module Sprockets
|
|
145
130
|
asset[:mtime] = metadata[:dependencies].map { |u|
|
146
131
|
if u.start_with?("file-digest:")
|
147
132
|
s = self.stat(parse_file_digest_uri(u))
|
148
|
-
s ? s.mtime.to_i :
|
133
|
+
s ? s.mtime.to_i : nil
|
149
134
|
else
|
150
|
-
|
135
|
+
nil
|
151
136
|
end
|
152
|
-
}.max
|
137
|
+
}.compact.max
|
138
|
+
asset[:mtime] ||= self.stat(filename).mtime.to_i
|
153
139
|
|
154
140
|
cache.set("asset-uri:#{VERSION}:#{asset[:uri]}", asset, true)
|
155
141
|
cache.set("asset-uri-digest:#{VERSION}:#{uri}:#{asset[:dependencies_digest]}", asset[:uri], true)
|
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.0.
|
4
|
+
version: 3.0.3
|
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: 2015-04-
|
12
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|