resolve/refinerycms — pull request #1640 by keram (2012-05-06 14:29:34+00:00)
Title: added configuration verbose_rack_cache

This time when you run webserver on devel mode you see in console stuff like this

```
cache: [GET /assets/application.css] stale, valid, store
cache: [GET /assets/application.css] stale, valid, store
cache: [GET /assets/formatting.css] stale, valid, store
cache: [GET /assets/formatting.css] stale, valid, store
cache: [GET /assets/theme.css] stale, valid, store
cache: [GET /assets/theme.css] stale, valid, store
cache: [GET /assets/home.css] stale, valid, store
cache: [GET /assets/home.css] stale, valid, store
cache: [GET /assets/modernizr-min.js] stale, valid, store
cache: [GET /assets/modernizr-min.js] stale, valid, store
```

that can be annoying. This change allow turn off this by configuration.

Another issue here is that all assets are duplicated in cache as you can see in log.
That is because ``Rack::Cache`` middleware is included twice.
First in ``images/lib/refinery/images/dragonfly.rb`` secondly ``resources/lib/refinery/resources/dragonfly.rb``
I don't know what is best solution fix that. First option is move this block:

```ruby
app.config.middleware.insert_before 'Dragonfly::Middleware', 'Rack::Cache', {
:verbose => Rails.env.development?,
:metastore => "file:#{Rails.root.join('tmp', 'dragonfly', 'cache', 'meta')}",
:entitystore => "file:#{Rails.root.join('tmp', 'dragonfly', 'cache', 'body')}"
}
```
from **dragonfly.rb to higher place or extend ``Rails::Configuration::MiddlewareStackProxy`` with something like this:

```ruby
module Rails
module Configuration
class MiddlewareStackProxy
def insert_before_unless_inserted(*args, &block)
@operations << [:insert_before, args, block] unless @operations.include?([:insert_before, args, block])
end
end
end
end
```
and than use
```ruby
app.config.middleware.insert_before_unless_inserted 'Dragonfly::Middleware', 'Rack::Cache', {...
```

What you think guys? I appreciate any solution :).
thnx