Easy deployment of your assets on CloudFront or S3. When enabled in production, your assets will be served from Cloudfront/S3 which will result in a speedier front-end.
Include the gem in your app's
environment.rb or Gemfile. It is hosted at Gemcutter[http://gemcutter.org/gems/cloudfront_asset_host]
Make sure your s3-credentials are stored in config/s3.yml like this:
access_key_id: 'access_key' secret_access_key: 'secret'
The gem relies on +openssl md5+ and +gzip+ utilities. Make sure they are available locally and on your servers.
Create an initializer to configure the plugin config/initializers/cloudfront_asset_host.rb
Uploading your assets
CloudfrontAssetHost::Uploader.upload!(:verbose => true, :dryrun => false) before your deployment. Put it for example in your Rakefile or capistrano-recipe. Verbose output will include information about which keys are being uploaded. Enabling dryrun will skip the actual upload if you're just interested to see what will be uploaded.
If the plugin is enabled. Rails' internal
asset_id functionality will be overridden to point to the location of the assets on Cloudfront.
When using in combination with SASS and/or asset_packager it is recommended to generate the css-files and package your assets before uploading them to Cloudfront. For example, call
Tested on Rails 2.3.5 with SASS and AssetPackager plugins
Created at Wakoopa
Copyright (c) 2010 Menno van der Sman, released under the MIT license