Sha256: ec8c0c6d56fee5ed8ffe3736d5b301d0f6d319748bb58640fa47dc4f8cb8d1a9

Contents?: true

Size: 1.73 KB

Versions: 2

Compression:

Stored size: 1.73 KB

Contents

# Autodoc
Generate documentation from your rack application & request-spec.

## Installation
```ruby
gem "autodoc", group: :test
```

## Usage
Run rspec with AUTODOC=1 to generate documents for your request-specs tagged with `:autodoc`.  
example: [doc/recipes.md](https://github.com/r7kamura/autodoc/blob/master/spec/dummy/doc/recipes.md), [doc/toc.md](https://github.com/r7kamura/autodoc/blob/master/spec/dummy/doc/toc.md)

```sh
# shell-command
AUTODOC=1 rspec
```

### Example for any Rack application with rack-test
```ruby
# spec/requests/entries_spec.rb
describe "Entries" do
  include Rack::Test::Methods

  let(:app) do
    MyRackApplication
  end

  describe "GET /entries", autodoc: true do
    get "/entries"
    last_response.status.should == 200
  end
end
```

### Example for Rails application with rspec-rails
```ruby
# spec/requests/recipes_spec.rb
describe "Recipes" do
  describe "POST /recipes", autodoc: true do
    it "creates a new recipe" do
      post "/recipes", name: "alice", type: 1
      response.status.should == 201
    end
  end
end
```

### Configuration
You can configure `Autodoc.configuration` to change its behavior:

* path - [String] location to put files (default: ./doc)
* headers - [Array] keys of documented response header (default: ["Location"])
* template - [String] ERB template for each document (default: [document.md.erb](https://github.com/r7kamura/autodoc/blob/master/lib/autodoc/templates/document.md.erb))
* toc_template - [String] ERB template for ToC (default: [toc.md.erb](https://github.com/r7kamura/autodoc/blob/master/lib/autodoc/templates/toc.md.erb))
* toc - [Boolean] whether to generate toc.md (default: false)

```ruby
# example
Autodoc.configuration.path = "doc/api"
Autodoc.configuration.toc = true
```

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
autodoc-0.3.0 README.md
autodoc-0.2.8 README.md