asset_timestamps_cache 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/VERSION +1 -1
- data/lib/asset_timestamps_cache.rb +6 -2
- data/test/test_asset_timestamps_cache.rb +1 -1
- metadata +1 -1
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -25,10 +25,14 @@ module AssetTimestampsCache
|
|
25
25
|
@@asset_timestamps_cache.clear
|
26
26
|
end
|
27
27
|
|
28
|
+
def self.timestamped_asset_path(asset_path)
|
29
|
+
timestamp = self[asset_path]
|
30
|
+
"#{asset_path}?#{timestamp}"
|
31
|
+
end
|
32
|
+
|
28
33
|
module ViewHelper
|
29
34
|
def timestamped_asset_path(asset_path)
|
30
|
-
|
31
|
-
"#{asset_path}?#{timestamp}"
|
35
|
+
AssetTimestampsCache.timestamped_asset_path(asset_path)
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
@@ -8,10 +8,10 @@ class TestAssetTimestampsCache < Test::Unit::TestCase
|
|
8
8
|
def setup
|
9
9
|
AssetTimestampsCache.clear
|
10
10
|
FileUtils.mkdir_p 'public'
|
11
|
+
FileUtils.touch 'public/fixture.txt'
|
11
12
|
end
|
12
13
|
|
13
14
|
def test_returns_mtime_for_file
|
14
|
-
FileUtils.touch 'public/fixture.txt'
|
15
15
|
mtime = File.mtime('public/fixture.txt').to_i.to_s
|
16
16
|
assert_equal mtime, AssetTimestampsCache['fixture.txt']
|
17
17
|
end
|