Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few new features #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

chrismarshall
Copy link

Hey Adam,
cheers for writing this plugin, saved me heaps of time. I've added several things to it that you might find useful:

  • An easy way to specify the s3.yml filename since we use attachment_fu and we use its default of amazon_s3.yml.

  • An option to delete all other rev_*/* files in the bucket, we use Capistrano to do deploys and because of the way it versions releases on the server retrieving the last CDN revision isn't easy, but we still want a set and forget cleanup process. This could be dangerous if anything else is stored in the bucket with that naming scheme (we have a separate bucket for CDN stuff), so feel free to take this out if you don't like it, but still like the other changes ;).

  • You can now set metadata (in particular we needed the expires header) on the files.

  • You can specify another bucket that will have the same content as the main bucket, but with the css and js gzipped, to allow for browsers that support compressed content to have smaller downloads, this requires asset_host config to check whether or not the client supports, something like:

    config.action_controller.asset_host = Proc.new { |source, request |
    if request.headers['Accept-Encoding'] && request.headers['Accept-Encoding'].include?('gzip')
    "gzip.cdn.foo.com"
    else
    "cdn.foo.com"
    end
    }

I've added to the documentation for the above (although I didn't include the above proc example since there are so many variations on how this should be done depending on cnames, gzipping and so on).

Chris

Chris Marshall added 3 commits March 6, 2011 16:56
…fault name of amazon_s3.yml, so this makes it easier to use one configuration.

- Added option to delete all other revisions, this is a little bit dangerous if two projects are using the same bucket (or if there's anything else with a rev_ prefix in the bucket), but when deploying with tools like Capistrano the previous revision number isn't easily known, so clearing everything else out is the easiest.
- Added option to set metadata, e.g. you can now set the expires header to something well in to the future
…ts call seemed to limit what was returned.
…ed copy of the assets into. Only .js and .css files are gzipped, other files are uploaded uncompressed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant