asset_id 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -35,7 +35,7 @@ and to use the id-stamped asset paths in helpers
35
35
  'http://my_bucket.s3.amazonaws.com'
36
36
  end
37
37
  config.action_controller.asset_path = Proc.new do |source|
38
- AssetID::S3.fingerprint(source)
38
+ AssetID::Asset.fingerprint(source)
39
39
  end
40
40
  </code></pre>
41
41
 
@@ -73,6 +73,19 @@ If you want to use the SSL host in your configuration you can do so in <code>con
73
73
  end
74
74
  </code></pre>
75
75
 
76
+ h2. CSS Images
77
+
78
+ By default any relative CSS images that match files on the filesystem are converted to AssetID paths as well.
79
+
80
+ For S3, if you don't specify a <code>prefix</code> it will use the <code>http://</code> bucket URL by default. You can override this in <code>config/asset_id.yml</code>. For example if you wanted to use the <code>https://</code> url:
81
+
82
+ <pre><code>production:
83
+ access_key_id: 'MY_ACCESS_KEY'
84
+ secret_access_key: 'MY_ACCESS_SECRET'
85
+ bucket: "my_live_bucket"
86
+ prefix: "https://my_bucket.s3.amazonaws.com"
87
+ </code></pre>
88
+
76
89
  h2. Using Amazon CloudFront Content Delivery Network (CDN)
77
90
 
78
91
  To use Amazon CloudFront as a CDN for your assets all you need to do is "create a CloudFront distribution":http://docs.amazonwebservices.com/AmazonCloudFront/latest/GettingStartedGuide/ for the bucket you have defined your configuration and then substitute your unique CloudFront domain name in <code>config/environments/production.rb</code>
@@ -111,6 +111,7 @@ module AssetID
111
111
  "url(#{uri})"
112
112
  else
113
113
  asset = Asset.new(uri)
114
+ # TODO: Check the referenced asset is in the asset_paths
114
115
  puts " - Changing CSS URI #{uri} to #{options[:prefix]}#{asset.fingerprint}" if @@debug
115
116
  "url(#{options[:prefix]}#{asset.fingerprint})"
116
117
  end
@@ -15,7 +15,7 @@ module AssetID
15
15
  File.join(Rails.root, 'log', 'asset_id_cache.yml')
16
16
  end
17
17
 
18
- def get(asset)
18
+ def self.get(asset)
19
19
  cache[asset.relative_path]
20
20
  end
21
21
 
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.2
5
+ version: 0.2.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Richard Taylor