heroku/heroku-buildpack-ruby — pull request #43 by ndbroadbent (2012-10-28 21:57:48+00:00)
Title: Simple asset caching, without expiry. Adds support for `turbo-sprockets-rails3`

This is an alternative to #42, which simply removes any assets that aren't referenced by `manifest.yml`.

It provides a strong guarantee that the `public/assets` cache won't grow out of control, by clearing the cache if any exceptions are raised during the cleanup. I know it's usually not a good idea to `rescue Exception`, but you never know what might happen when you're dealing with 2.2 million apps. Anything could be monkey-patched by a rogue gem, and anything could break :)

Since most Rails 3 apps won't benefit from this caching unless they are using my `turbo-sprockets-rails3` gem, I think it would be appropriate to add the following conditional:

```ruby
if File.read('Gemfile.lock').include?('turbo-sprockets-rails3')
# assets caching code ...
```

Let me know what you think about that.

Note that `cache_load "public/assets"` at the beginning doesn't need to be conditional, since it just won't do anything if `public/assets` isn't cached.