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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fce2476cd245660b43d7f43d8c73e49e8dba8f8b
4
- data.tar.gz: 04a112134ed6023fc75a5f5932b9ce1e51200d55
3
+ metadata.gz: 52d2bf02cdc6fea8149c3e97e01f3beb73206ffd
4
+ data.tar.gz: 0c7a54162f7423cce7008406f80139d52269676f
5
5
  SHA512:
6
- metadata.gz: 67ae5f33aea980377bbab8a8f70b0fb0364a12696bc1c76c6813b03a11be59091d3630562d16cd0eeccfce1348661dc447989bdc54e34d0598578497f2d14c78
7
- data.tar.gz: 611067448c1962a8a1fea6d50d0e236834f0244f66274ebd87f3bd0b2f2216ad67cdbe548186c3e34e28079bbbf4395286ad384eb13f48680c02a290478c7cd2
6
+ metadata.gz: 0133bd2b3561392e0ad2b17fac3fa2843234b5fd90c44de782882f709dafbe62008babd0ada300e98325cb99792dfa2cb1902c6fbba69b728787208b04ee83af
7
+ data.tar.gz: a2ac64bbcac2aac490a9192da4d9aa23aeb1998296953df9af8627075cdb9c14b9cd7f6f5c106a397ba1ad637edb93dc27016d91f64f894556af2f5a993c888a
@@ -8,5 +8,4 @@ module Sprockets
8
8
  class ConversionError < NotFound; end
9
9
  class FileNotFound < NotFound; end
10
10
  class FileOutsidePaths < NotFound; end
11
- class VersionNotFound < NotFound; end
12
11
  end
@@ -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.fetch("asset-uri:#{VERSION}#{uri}") do
30
- load_asset_by_id_uri(uri, filename, params)
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 : 1211698800
133
+ s ? s.mtime.to_i : nil
149
134
  else
150
- 1211698800
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)
@@ -1,3 +1,3 @@
1
1
  module Sprockets
2
- VERSION = "3.0.2"
2
+ VERSION = "3.0.3"
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: 3.0.2
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-23 00:00:00.000000000 Z
12
+ date: 2015-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack