asset_id 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,7 +48,9 @@ module AssetID
48
48
  end
49
49
 
50
50
  def self.fingerprint(path)
51
- Asset.new(path).fingerprint
51
+ asset = Asset.new(path)
52
+ return hit[:fingerprint] if hit = Cache.get(asset)
53
+ return asset.fingerprint
52
54
  end
53
55
 
54
56
  attr_reader :path
@@ -23,7 +23,11 @@ module AssetID
23
23
  end
24
24
 
25
25
  def self.s3_prefix
26
- s3_config['prefix']
26
+ s3_config['prefix'] || s3_bucket_url
27
+ end
28
+
29
+ def self.s3_bucket_url
30
+ "http://#{s3_bucket}.s3.amazonaws.com"
27
31
  end
28
32
 
29
33
  def self.upload(options={})
@@ -15,6 +15,10 @@ module AssetID
15
15
  File.join(Rails.root, 'log', 'asset_id_cache.yml')
16
16
  end
17
17
 
18
+ def get(asset)
19
+ cache[asset.relative_path]
20
+ end
21
+
18
22
  def self.hit?(asset)
19
23
  return true if cache[asset.relative_path] and cache[asset.relative_path][:fingerprint] == asset.fingerprint
20
24
  cache[asset.relative_path] = {:expires => asset.expiry_date.to_s, :fingerprint => asset.fingerprint}
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: asset_id
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Richard Taylor