autodoc 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +14 -13
- data/lib/autodoc/document.rb +1 -1
- data/lib/autodoc/documents.rb +1 -0
- data/lib/autodoc/version.rb +1 -1
- data/spec/dummy/doc/recipes.md +11 -20
- data/spec/dummy/doc/toc.md +1 -1
- data/spec/requests/recipes_spec.rb +21 -16
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23c07c4c85ad1c66193733e371af30832c1ef8d0
|
4
|
+
data.tar.gz: 4da0100e043b131ffafbf8e824dcfb37c53e344e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 698d341f91a205c3a89485ca9120fbfa4790e1804746ab0e23da0ffe81ace672b821ac2612de6e68be733cddca16cae0e1183c6715e7e998549de3778ef5f64f
|
7
|
+
data.tar.gz: 3df52d3c08b2f791be3363e379495338a052b03ab308e1c0e83fd9b977e2354fda31bb6b111814b8bb7fec36c4941a397d88e3c3c3fc830da2c1bf3bf53d3414
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -7,31 +7,26 @@ gem "autodoc", group: :test
|
|
7
7
|
```
|
8
8
|
|
9
9
|
## Usage
|
10
|
-
|
10
|
+
Run rspec with AUTODOC=1 to generate documents for the specs tagged with `:autodoc`.
|
11
|
+
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)
|
12
|
+
|
13
|
+
```sh
|
14
|
+
# shell-command
|
15
|
+
AUTODOC=1 rspec
|
16
|
+
```
|
11
17
|
|
12
18
|
```ruby
|
13
19
|
# spec/requests/recipes_spec.rb
|
14
20
|
describe "Recipes" do
|
15
|
-
let(:params) do
|
16
|
-
{ name: "alice", type: 1 }
|
17
|
-
end
|
18
|
-
|
19
21
|
describe "POST /recipes", autodoc: true do
|
20
22
|
it "creates a new recipe" do
|
21
|
-
post "/recipes.json",
|
23
|
+
post "/recipes.json", name: "alice", type: 1
|
22
24
|
response.status.should == 201
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
26
28
|
```
|
27
29
|
|
28
|
-
Run rspec with AUTODOC=1 to generate documents. ([example](https://github.com/r7kamura/autodoc/blob/master/spec/dummy/doc/recipes.md))
|
29
|
-
|
30
|
-
```sh
|
31
|
-
# shell-command
|
32
|
-
AUTODOC=1 rspec
|
33
|
-
```
|
34
|
-
|
35
30
|
### Configuration
|
36
31
|
You can configure `Autodoc.configuration` to change its behavior:
|
37
32
|
|
@@ -40,3 +35,9 @@ You can configure `Autodoc.configuration` to change its behavior:
|
|
40
35
|
* template - [String] ERB template for each document (default: [document.md.erb](https://github.com/r7kamura/autodoc/blob/master/lib/autodoc/templates/document.md.erb))
|
41
36
|
* toc_template - [String] ERB template for ToC (default: [toc.md.erb](https://github.com/r7kamura/autodoc/blob/master/lib/autodoc/templates/toc.md.erb))
|
42
37
|
* toc - [Boolean] whether to generate toc.md (default: false)
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
# example
|
41
|
+
Autodoc.configuration.path = "doc/api"
|
42
|
+
Autodoc.configuration.toc = true
|
43
|
+
```
|
data/lib/autodoc/document.rb
CHANGED
data/lib/autodoc/documents.rb
CHANGED
data/lib/autodoc/version.rb
CHANGED
data/spec/dummy/doc/recipes.md
CHANGED
@@ -1,30 +1,21 @@
|
|
1
|
-
##
|
2
|
-
|
3
|
-
|
4
|
-
### parameters
|
5
|
-
* `name` string (required, except: `["alice", "bob"]`)
|
6
|
-
* `type` integer (only: `1..3`)
|
1
|
+
## GET /recipes/:id
|
2
|
+
Returns the recipe.
|
7
3
|
|
8
4
|
### request
|
9
5
|
```
|
10
|
-
|
11
|
-
```
|
12
|
-
|
13
|
-
```
|
14
|
-
name=name&type=1
|
6
|
+
GET /recipes/:id
|
15
7
|
```
|
16
8
|
|
17
9
|
### response
|
18
10
|
```ruby
|
19
|
-
Status:
|
20
|
-
Location: http://www.example.com/recipes/1
|
11
|
+
Status: 200
|
21
12
|
response:
|
22
13
|
{
|
23
14
|
"id": 1,
|
24
|
-
"name": "
|
25
|
-
"type":
|
26
|
-
"created_at": "2013-11-
|
27
|
-
"updated_at": "2013-11-
|
15
|
+
"name": "test",
|
16
|
+
"type": 2,
|
17
|
+
"created_at": "2013-11-30T19:04:12.608Z",
|
18
|
+
"updated_at": "2013-11-30T19:04:12.608Z"
|
28
19
|
}
|
29
20
|
```
|
30
21
|
|
@@ -47,13 +38,13 @@ name=name&type=1
|
|
47
38
|
### response
|
48
39
|
```ruby
|
49
40
|
Status: 201
|
50
|
-
Location: http://example.
|
41
|
+
Location: http://www.example.com/recipes/1
|
51
42
|
response:
|
52
43
|
{
|
53
44
|
"id": 1,
|
54
45
|
"name": "name",
|
55
46
|
"type": 1,
|
56
|
-
"created_at": "2013-11-
|
57
|
-
"updated_at": "2013-11-
|
47
|
+
"created_at": "2013-11-30T19:04:12.684Z",
|
48
|
+
"updated_at": "2013-11-30T19:04:12.684Z"
|
58
49
|
}
|
59
50
|
```
|
data/spec/dummy/doc/toc.md
CHANGED
@@ -6,13 +6,30 @@ describe "Recipes" do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
let(:params) do
|
9
|
-
{
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
{}
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "GET /recipes/:id" do
|
13
|
+
let(:recipe) do
|
14
|
+
Recipe.create(name: "test", type: 2)
|
15
|
+
end
|
16
|
+
|
17
|
+
context "with valid condition (using Rack::Test)", :autodoc do
|
18
|
+
include Rack::Test::Methods
|
19
|
+
|
20
|
+
it "returns the recipe" do
|
21
|
+
get "/recipes/#{recipe.id}", params, env
|
22
|
+
last_response.status.should == 200
|
23
|
+
end
|
24
|
+
end
|
13
25
|
end
|
14
26
|
|
15
27
|
describe "POST /recipes" do
|
28
|
+
before do
|
29
|
+
params[:name] = "name"
|
30
|
+
params[:type] = 1
|
31
|
+
end
|
32
|
+
|
16
33
|
context "without required param" do
|
17
34
|
before do
|
18
35
|
params.delete(:name)
|
@@ -52,17 +69,5 @@ describe "Recipes" do
|
|
52
69
|
response.status.should == 201
|
53
70
|
end
|
54
71
|
end
|
55
|
-
|
56
|
-
context "with valid condition (client using Rack::Test)", :autodoc do
|
57
|
-
include Rack::Test::Methods
|
58
|
-
before do
|
59
|
-
header 'Accept', 'application/json'
|
60
|
-
end
|
61
|
-
|
62
|
-
it "creates a new recipe" do
|
63
|
-
post "/recipes", params
|
64
|
-
last_response.status.should == 201
|
65
|
-
end
|
66
|
-
end
|
67
72
|
end
|
68
73
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -219,4 +219,3 @@ test_files:
|
|
219
219
|
- spec/dummy/script/rails
|
220
220
|
- spec/requests/recipes_spec.rb
|
221
221
|
- spec/spec_helper.rb
|
222
|
-
has_rdoc:
|