Skip to content

Commit b581c70

Browse files
committed
Merge pull request #35 from TildeWill/new_wurl
Updating docs for wURL, Removing rake restriction
2 parents c80a617 + 3df46e5 commit b581c70

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ See the `example` folder for a sample Rails app that has been documented.
2929
## Configuration options
3030
- app - Set the application that Rack::Test uses, defaults to `Rails.application`
3131
- docs_dir - Output folder
32-
- format - Output format
32+
- 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.
3333
- template_path - Location of templates
3434
- filter - Filter by example document type
3535
- exclusion_filter - Filter by example document type
@@ -40,14 +40,16 @@ See the `example` folder for a sample Rails app that has been documented.
4040
### Example Configuration
4141
`spec/spec_helper.rb`
4242

43-
RspecApiDocumentation.configure do |config|
44-
config.docs_dir = Rails.root.join("app", "views", "pages")
43+
```ruby
44+
RspecApiDocumentation.configure do |config|
45+
config.docs_dir = Rails.root.join("app", "views", "pages")
4546

46-
config.define_group :public do |config|
47-
config.docs_dir = Rails.root.join("public", "docs")
48-
config.url_prefix = "/docs"
49-
end
50-
end
47+
config.define_group :public do |config|
48+
config.docs_dir = Rails.root.join("public", "docs")
49+
config.url_prefix = "/docs"
50+
end
51+
end
52+
```
5153

5254
## Usage
5355

example/spec/spec_helper.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434

3535
RspecApiDocumentation.configure do |config|
3636
config.docs_dir = Rails.root.join("public", "docs")
37-
config.format = [:html, :json]
37+
# html pages with the wURL console
38+
config.format = [:json, :wurl]
39+
# html pages without the wURL console
40+
#config.format = [:json, :html]
3841
config.url_prefix = "/docs"
3942
config.curl_host = 'http://localhost:3000'
4043
end

lib/tasks/docs.rake

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
require 'rspec/core/rake_task'
22

3-
if Rails.env.test? || Rails.env.development?
4-
desc 'Generate API request documentation from API specs'
5-
RSpec::Core::RakeTask.new('docs:generate') do |t|
6-
t.pattern = 'spec/acceptance/**/*_spec.rb'
7-
t.rspec_opts = ["--format RspecApiDocumentation::ApiFormatter"]
8-
end
3+
desc 'Generate API request documentation from API specs'
4+
RSpec::Core::RakeTask.new('docs:generate') do |t|
5+
t.pattern = 'spec/acceptance/**/*_spec.rb'
6+
t.rspec_opts = ["--format RspecApiDocumentation::ApiFormatter"]
97
end

0 commit comments

Comments
 (0)