diff --git a/README.markdown b/README.markdown index 8b213d2..b792eeb 100644 --- a/README.markdown +++ b/README.markdown @@ -1,21 +1,40 @@ # CloudFront AssetHost -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. +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. + +## Why? + +Hosting your assets on CloudFront ensures minimum latency for all your visitors. But deploying your assets requires some additional management that this gem provides. + +### Expiration + +The best way to expire your assets on CloudFront is to upload the asset to a new unique url. The gem will calculate the MD5-hash of the asset and incorporate that into the URL. + +### Efficient uploading + +By using the MD5-hash we can easily determined which assets aren't uploaded yet. This speeds up the deployment considerably. + +### Compressed assets + +CloudFront will not serve compressed assets automatically. To counter this, the gem will upload gzipped javascripts and stylesheets and serve them when the user-agent supports it. ## Installing -Include the gem in your app's `environment.rb` or Gemfile. It is hosted at Gemcutter[http://gemcutter.org/gems/cloudfront_asset_host] + gem install cloudfront_asset_host + +Include the gem in your app's `environment.rb` or `Gemfile`. ### Dependencies +The gem relies on `openssl md5` and `gzip` utilities. Make sure they are available locally and on your servers. + +### Configuration + 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. - -### Configuration Create an initializer to configure the plugin _config/initializers/cloudfront_asset_host.rb_ # Simple configuration @@ -32,11 +51,11 @@ Create an initializer to configure the plugin _config/initializers/cloudfront_as config.s3_config = "#{RAILS_ROOT}/config/s3.yml" # Alternative location of your s3-config file # gzip related configuration - config.gzip = true # enable gzipped assets (defaults to true) + config.gzip = true # enable gzipped assets (defaults to true) config.gzip_extensions = ['js', 'css'] # only gzip javascript or css (defaults to %w(js css)) config.gzip_prefix = "gz" # prefix for gzipped bucket (defaults to "gz") - config.enabled = true if Rails.env.production? # only enable in production + config.enabled = true if Rails.env.production? # only enable in production end ## Usage @@ -50,6 +69,14 @@ If the plugin is enabled. Rails' internal `asset_host` and `asset_id` functional ### Other plugins 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 `Sass::Plugin.update_stylesheets` and `Synthesis::AssetPackage.build_all` first. +## Contributing + +Feel free to fork the project and send pull-requests. + +## Known Limitations + + - Does not delete old assets + ## Compatibility Tested on Rails 2.3.5 with SASS and AssetPackager plugins diff --git a/cloudfront_asset_host.gemspec b/cloudfront_asset_host.gemspec index e9e77e8..d516ad6 100644 --- a/cloudfront_asset_host.gemspec +++ b/cloudfront_asset_host.gemspec @@ -5,40 +5,45 @@ Gem::Specification.new do |s| s.name = %q{cloudfront_asset_host} - s.version = "0.1.0" + s.version = "1.0.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Menno van der Sman"] - s.date = %q{2009-11-13} + s.date = %q{2010-03-18} s.description = %q{Easy deployment of your assets on CloudFront or S3 using a simple rake-task. When enabled in production, the application's asset_host and public_paths will point to the correct location.} s.email = %q{menno@wakoopa.com} s.extra_rdoc_files = [ "README.markdown" ] s.files = [ - "MIT-LICENSE", + ".gitignore", + "MIT-LICENSE", "README.markdown", "Rakefile", "VERSION", + "cloudfront_asset_host.gemspec", "lib/cloudfront_asset_host.rb", "lib/cloudfront_asset_host/asset_tag_helper_ext.rb", + "lib/cloudfront_asset_host/css_rewriter.rb", "lib/cloudfront_asset_host/mime_types.yml", - "lib/cloudfront_asset_host/tasks.rb", "lib/cloudfront_asset_host/uploader.rb", - "tasks/cloudfront_asset_host.rake", "test/app/config/s3.yml", + "test/app/public/images/image.png", "test/app/public/javascripts/application.js", + "test/app/public/stylesheets/style.css", "test/cloudfront_asset_host_test.rb", + "test/css_rewriter_test.rb", "test/test_helper.rb", "test/uploader_test.rb" ] s.homepage = %q{http://github.com/menno/cloudfront_asset_host} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] - s.rubygems_version = %q{1.3.5} + s.rubygems_version = %q{1.3.6} s.summary = %q{Rails plugin to easily and efficiently deploy your assets on Amazon's S3 or CloudFront} s.test_files = [ "test/cloudfront_asset_host_test.rb", + "test/css_rewriter_test.rb", "test/test_helper.rb", "test/uploader_test.rb" ]