Skip to content

Commit

Permalink
Add configuration handler for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalo-bulnes committed Jun 9, 2016
1 parent de0fe97 commit 3bd5856
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/dredd/rack/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3bd5856

Please sign in to comment.