joshsusser/refraction — pull request #13 by xaethos (2013-07-10 01:53:01+00:00)
Title: Initialisation options for middleware

Allows for passing a second parameter to the middleware which is made available in the request object. The use case for this is to allow for configuration depending on the environment, without hardcoding it into the rules.

refraction_rules.rb:
```
Refraction.configure do |req|
server_host = req.options[:host]
req.permanent! host: server_host if req.host != server_host
end
```

production.rb:
`config.middleware.insert_before(::Rack::Lock, ::Refraction, host: 'myapp.com')`

staging.rb:
`config.middleware.insert_before(::Rack::Lock, ::Refraction, host: 'myapp-staging.herokuapp.com')`

test.rb:
`config.middleware.insert_before(::Rack::Lock, ::Refraction, host: 'lvh.me')`

Also: updates gems and uses Bundler.