diff --git a/README.md b/README.md index 1d0a78c..932a1ec 100644 --- a/README.md +++ b/README.md @@ -38,13 +38,16 @@ Define which application Dredd::Rack must serve automatically: require 'dredd/rack' -# Allow the automatic setup of a local application server when necessary -# -# Find the name of your application in its `config.ru` file. -Dredd::Rack.app = Example::Application # or Rails.application, Sinatra::Application... +Dredd::Rack.configure do |config| + # Allow the automatic setup of a local application server when necessary + # + # Find the name of your application in its `config.ru` file. + config.app = Example::Application # or Rails.application, Sinatra::Application... + + # Optionally, you can define a custom Dredd command: + config.dredd_command = 'dredd' +end -# Optionally, you can define a custom Dredd command: -Dredd::Rack.dredd_command = 'dredd' ``` Usage diff --git a/lib/dredd/rack/configuration.rb b/lib/dredd/rack/configuration.rb index 858993f..db8cbdb 100644 --- a/lib/dredd/rack/configuration.rb +++ b/lib/dredd/rack/configuration.rb @@ -35,6 +35,10 @@ def dredd_command=(command) @@app = nil @@dredd_command = 'dredd' + # Allow the default configuration to be overwritten from initializers + def configure + yield self if block_given? + end end end end