diff --git a/README.md b/README.md index 0929a4ce..07738420 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ See the `example` folder for a sample Rails app that has been documented. ## Configuration options - app - Set the application that Rack::Test uses, defaults to `Rails.application` - docs_dir - Output folder -- format - Output format +- format - An array of output format(s). Possible values are :json, :html, or :wurl. The final option is similar to :html, but includes the wURL console. - template_path - Location of templates - filter - Filter by example document type - exclusion_filter - Filter by example document type @@ -40,14 +40,16 @@ See the `example` folder for a sample Rails app that has been documented. ### Example Configuration `spec/spec_helper.rb` - RspecApiDocumentation.configure do |config| - config.docs_dir = Rails.root.join("app", "views", "pages") +```ruby +RspecApiDocumentation.configure do |config| + config.docs_dir = Rails.root.join("app", "views", "pages") - config.define_group :public do |config| - config.docs_dir = Rails.root.join("public", "docs") - config.url_prefix = "/docs" - end - end + config.define_group :public do |config| + config.docs_dir = Rails.root.join("public", "docs") + config.url_prefix = "/docs" + end +end +``` ## Usage diff --git a/example/spec/spec_helper.rb b/example/spec/spec_helper.rb index 6d67800d..20875e8f 100644 --- a/example/spec/spec_helper.rb +++ b/example/spec/spec_helper.rb @@ -34,7 +34,10 @@ RspecApiDocumentation.configure do |config| config.docs_dir = Rails.root.join("public", "docs") - config.format = [:html, :json] + # html pages with the wURL console + config.format = [:json, :wurl] + # html pages without the wURL console + #config.format = [:json, :html] config.url_prefix = "/docs" config.curl_host = 'http://localhost:3000' end diff --git a/lib/tasks/docs.rake b/lib/tasks/docs.rake index c4b572ce..d1f4e00b 100644 --- a/lib/tasks/docs.rake +++ b/lib/tasks/docs.rake @@ -1,9 +1,7 @@ require 'rspec/core/rake_task' -if Rails.env.test? || Rails.env.development? - desc 'Generate API request documentation from API specs' - RSpec::Core::RakeTask.new('docs:generate') do |t| - t.pattern = 'spec/acceptance/**/*_spec.rb' - t.rspec_opts = ["--format RspecApiDocumentation::ApiFormatter"] - end +desc 'Generate API request documentation from API specs' +RSpec::Core::RakeTask.new('docs:generate') do |t| + t.pattern = 'spec/acceptance/**/*_spec.rb' + t.rspec_opts = ["--format RspecApiDocumentation::ApiFormatter"] end