Skip to content

Commit 28c75ae

Browse files
committed
Merge pull request #89 from rails/schneems/relative-cache-paths-3.x
[close #59] Use relative path for cache keys
2 parents 8ddce70 + 8630ce3 commit 28c75ae

File tree

4 files changed

+310
-46
lines changed

4 files changed

+310
-46
lines changed

lib/sprockets/base.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
require 'sprockets/path_utils'
1111
require 'sprockets/resolve'
1212
require 'sprockets/server'
13+
require 'sprockets/loader'
1314

1415
module Sprockets
1516
# `Base` class for `Environment` and `Cached`.
@@ -48,9 +49,10 @@ def file_digest(path)
4849
# Caveat: Digests are cached by the path's current mtime. Its possible
4950
# for a files contents to have changed and its mtime to have been
5051
# negligently reset thus appearing as if the file hasn't changed on
51-
# disk. Also, the mtime is only read to the nearest second. Its
52+
# disk. Also, the mtime is only read to the nearest second. It's
5253
# also possible the file was updated more than once in a given second.
53-
cache.fetch("file_digest:#{path}:#{stat.mtime.to_i}") do
54+
key = UnloadedAsset.new(path, self).file_digest_key(stat.mtime.to_i)
55+
cache.fetch(key) do
5456
self.stat_digest(path, stat)
5557
end
5658
end

lib/sprockets/dependencies.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@ def add_dependency(uri)
5151
end
5252
alias_method :depend_on, :add_dependency
5353

54-
# Internal: Resolve set of dependency URIs.
55-
#
56-
# Returns Array of resolved Objects.
57-
def resolve_dependencies(uris)
58-
uris.map { |uri| resolve_dependency(uri) }
59-
end
60-
6154
# Internal: Resolve dependency URIs.
6255
#
6356
# Returns resolved Object.

0 commit comments

Comments
 (0)