autodoc 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/autodoc/configuration.rb +4 -0
- data/lib/autodoc/document.rb +1 -1
- data/lib/autodoc/documents.rb +1 -1
- data/lib/autodoc/templates/toc.md.erb +3 -2
- data/lib/autodoc/version.rb +1 -1
- data/spec/autodoc/documents_spec.rb +67 -0
- data/spec/dummy/doc/admin/entries.md +23 -0
- data/spec/dummy/doc/recipes.md +10 -10
- data/spec/dummy/doc/toc.md +2 -0
- data/spec/requests/admin/entries_spec.rb +39 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d93952ec85969ac234dbeb59363103d1587a06dd
|
4
|
+
data.tar.gz: 2f69882edbd84d12d0cd5c257858fa50a45d4a66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ba609ac4bed6ac01df05fcaa3b1c6dcf1101e150d106016d4bcecc4850dc334a7074f785ce342df9cf6101e297e6673348b39c5cb9e985d6b325777b99b8b6e
|
7
|
+
data.tar.gz: 8af2b92831a033e1b9d189911b92ac379e4651d02f752a11d70e691b8d26d2b21565f8b7edaf6b1b1831082ca0395ff9e6e8d4b70264a5f8bf7400be111786bd
|
data/CHANGELOG.md
CHANGED
data/lib/autodoc/document.rb
CHANGED
data/lib/autodoc/documents.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
<%# coding: UTF-8 -%>
|
2
2
|
## Table of Contents
|
3
3
|
<% @table.sort.each do |pathname, documents| -%>
|
4
|
-
|
4
|
+
<% relative_path = pathname.relative_path_from(Autodoc.configuration.pathname) -%>
|
5
|
+
* [<%= relative_path %>](<%= relative_path %>)
|
5
6
|
<% documents.group_by(&:title).each do |title, documents| -%>
|
6
7
|
<% documents.each_with_index do |document, index| -%>
|
7
8
|
<% suffix = index == 0 ? "" : "-#{index}" -%>
|
8
|
-
* [<%= title %>](<%= "#{
|
9
|
+
* [<%= title %>](<%= "#{relative_path}##{document.identifier}#{suffix}" %>)
|
9
10
|
<% end -%>
|
10
11
|
<% end -%>
|
11
12
|
<% end -%>
|
data/lib/autodoc/version.rb
CHANGED
@@ -0,0 +1,67 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Autodoc::Documents do
|
4
|
+
describe "#render_toc" do
|
5
|
+
before do
|
6
|
+
documents.append(context)
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:documents) do
|
10
|
+
Autodoc::Documents.new
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:context) do
|
14
|
+
mock = double(example: example, request: request)
|
15
|
+
mock.stub(clone: mock)
|
16
|
+
mock
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:example) do
|
20
|
+
double(file_path: file_path, full_description: full_description)
|
21
|
+
end
|
22
|
+
|
23
|
+
let(:file_path) do
|
24
|
+
"spec/requests/recipes.md"
|
25
|
+
end
|
26
|
+
|
27
|
+
let(:request) do
|
28
|
+
double(method: method)
|
29
|
+
end
|
30
|
+
|
31
|
+
let(:method) do
|
32
|
+
"GET"
|
33
|
+
end
|
34
|
+
|
35
|
+
context "with GET /recipes spec" do
|
36
|
+
let(:full_description) do
|
37
|
+
"Recipe #{method} /recipes returns recipes"
|
38
|
+
end
|
39
|
+
|
40
|
+
let(:file_path) do
|
41
|
+
"./spec/requests/recipes_spec.rb"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "includes links to recipes.md" do
|
45
|
+
toc = documents.send(:render_toc)
|
46
|
+
toc.should include("[recipes.md](recipes.md)")
|
47
|
+
toc.should include("[GET /recipes](recipes.md#get-recipes)")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "with GET /admin/recipes spec" do
|
52
|
+
let(:full_description) do
|
53
|
+
"Admin::Recipe #{method} /admin/recipes returns recipes for administrator"
|
54
|
+
end
|
55
|
+
|
56
|
+
let(:file_path) do
|
57
|
+
"./spec/requests/admin/recipes_spec.rb"
|
58
|
+
end
|
59
|
+
|
60
|
+
it "includes links to admin/recipes.md" do
|
61
|
+
toc = documents.send(:render_toc)
|
62
|
+
toc.should include("[admin/recipes.md](admin/recipes.md)")
|
63
|
+
toc.should include("[GET /admin/recipes](admin/recipes.md#get-adminrecipes)")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
## GET /admin/entries
|
2
|
+
Returns entries.
|
3
|
+
|
4
|
+
### Example
|
5
|
+
```
|
6
|
+
GET /admin/entries HTTP/1.1
|
7
|
+
Accept: application/json
|
8
|
+
Content-Length: 0
|
9
|
+
Host: example.org
|
10
|
+
```
|
11
|
+
|
12
|
+
```
|
13
|
+
HTTP/1.1 200
|
14
|
+
Content-Length: 45
|
15
|
+
Content-Type: application/json
|
16
|
+
|
17
|
+
[
|
18
|
+
{
|
19
|
+
"title": "Test Title",
|
20
|
+
"body": "Lorem Ipsum"
|
21
|
+
}
|
22
|
+
]
|
23
|
+
```
|
data/spec/dummy/doc/recipes.md
CHANGED
@@ -14,11 +14,11 @@ HTTP/1.1 200
|
|
14
14
|
Cache-Control: max-age=0, private, must-revalidate
|
15
15
|
Content-Length: 111
|
16
16
|
Content-Type: application/json; charset=utf-8
|
17
|
-
ETag: "
|
17
|
+
ETag: "d2bb4f3624c215dcc71b683ec7d58ebd"
|
18
18
|
X-Content-Type-Options: nosniff
|
19
19
|
X-Frame-Options: SAMEORIGIN
|
20
|
-
X-Request-Id:
|
21
|
-
X-Runtime: 0.
|
20
|
+
X-Request-Id: 5f84d51d-9709-4a8f-a02c-77732902252b
|
21
|
+
X-Runtime: 0.013851
|
22
22
|
X-UA-Compatible: chrome=1
|
23
23
|
X-XSS-Protection: 1; mode=block
|
24
24
|
|
@@ -26,8 +26,8 @@ X-XSS-Protection: 1; mode=block
|
|
26
26
|
"id": 1,
|
27
27
|
"name": "test",
|
28
28
|
"type": 2,
|
29
|
-
"created_at": "2013-12-
|
30
|
-
"updated_at": "2013-12-
|
29
|
+
"created_at": "2013-12-29T14:22:59.625Z",
|
30
|
+
"updated_at": "2013-12-29T14:22:59.625Z"
|
31
31
|
}
|
32
32
|
```
|
33
33
|
|
@@ -61,12 +61,12 @@ HTTP/1.1 201
|
|
61
61
|
Cache-Control: max-age=0, private, must-revalidate
|
62
62
|
Content-Length: 111
|
63
63
|
Content-Type: application/json; charset=utf-8
|
64
|
-
ETag: "
|
64
|
+
ETag: "0d698f869368039f2145c92927b36720"
|
65
65
|
Location: http://www.example.com/recipes/1
|
66
66
|
X-Content-Type-Options: nosniff
|
67
67
|
X-Frame-Options: SAMEORIGIN
|
68
|
-
X-Request-Id:
|
69
|
-
X-Runtime: 0.
|
68
|
+
X-Request-Id: 84349101-dc40-4416-83a0-a767242881f9
|
69
|
+
X-Runtime: 0.003861
|
70
70
|
X-UA-Compatible: chrome=1
|
71
71
|
X-XSS-Protection: 1; mode=block
|
72
72
|
|
@@ -74,7 +74,7 @@ X-XSS-Protection: 1; mode=block
|
|
74
74
|
"id": 1,
|
75
75
|
"name": "name",
|
76
76
|
"type": 1,
|
77
|
-
"created_at": "2013-12-
|
78
|
-
"updated_at": "2013-12-
|
77
|
+
"created_at": "2013-12-29T14:22:59.676Z",
|
78
|
+
"updated_at": "2013-12-29T14:22:59.676Z"
|
79
79
|
}
|
80
80
|
```
|
data/spec/dummy/doc/toc.md
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Admin::Entries" do
|
4
|
+
include Rack::Test::Methods
|
5
|
+
|
6
|
+
let(:env) do
|
7
|
+
{ "HTTP_ACCEPT" => "application/json" }
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:params) do
|
11
|
+
{}
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:app) do
|
15
|
+
lambda do |env|
|
16
|
+
[
|
17
|
+
200,
|
18
|
+
{ "Content-Type" => "application/json" },
|
19
|
+
[
|
20
|
+
[
|
21
|
+
{
|
22
|
+
title: "Test Title",
|
23
|
+
body: "Lorem Ipsum",
|
24
|
+
},
|
25
|
+
].to_json,
|
26
|
+
],
|
27
|
+
]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "GET /admin/entries" do
|
32
|
+
context "with Rack::Test", :autodoc do
|
33
|
+
it "returns entries" do
|
34
|
+
get "/admin/entries", params, env
|
35
|
+
last_response.status.should == 200
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
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.3.
|
4
|
+
version: 0.3.3
|
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-12-
|
11
|
+
date: 2013-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- lib/autodoc/templates/document.md.erb
|
131
131
|
- lib/autodoc/templates/toc.md.erb
|
132
132
|
- lib/autodoc/version.rb
|
133
|
+
- spec/autodoc/documents_spec.rb
|
133
134
|
- spec/dummy/Rakefile
|
134
135
|
- spec/dummy/app/assets/javascripts/application.js
|
135
136
|
- spec/dummy/app/assets/stylesheets/application.css
|
@@ -158,6 +159,7 @@ files:
|
|
158
159
|
- spec/dummy/config/routes.rb
|
159
160
|
- spec/dummy/db/migrate/20130607075126_create_recipes.rb
|
160
161
|
- spec/dummy/db/schema.rb
|
162
|
+
- spec/dummy/doc/admin/entries.md
|
161
163
|
- spec/dummy/doc/entries.md
|
162
164
|
- spec/dummy/doc/recipes.md
|
163
165
|
- spec/dummy/doc/toc.md
|
@@ -168,6 +170,7 @@ files:
|
|
168
170
|
- spec/dummy/public/500.html
|
169
171
|
- spec/dummy/public/favicon.ico
|
170
172
|
- spec/dummy/script/rails
|
173
|
+
- spec/requests/admin/entries_spec.rb
|
171
174
|
- spec/requests/entries_spec.rb
|
172
175
|
- spec/requests/recipes_spec.rb
|
173
176
|
- spec/spec_helper.rb
|
@@ -196,6 +199,7 @@ signing_key:
|
|
196
199
|
specification_version: 4
|
197
200
|
summary: Auto-generate JSON API documents from your request-specs.
|
198
201
|
test_files:
|
202
|
+
- spec/autodoc/documents_spec.rb
|
199
203
|
- spec/dummy/Rakefile
|
200
204
|
- spec/dummy/app/assets/javascripts/application.js
|
201
205
|
- spec/dummy/app/assets/stylesheets/application.css
|
@@ -224,6 +228,7 @@ test_files:
|
|
224
228
|
- spec/dummy/config/routes.rb
|
225
229
|
- spec/dummy/db/migrate/20130607075126_create_recipes.rb
|
226
230
|
- spec/dummy/db/schema.rb
|
231
|
+
- spec/dummy/doc/admin/entries.md
|
227
232
|
- spec/dummy/doc/entries.md
|
228
233
|
- spec/dummy/doc/recipes.md
|
229
234
|
- spec/dummy/doc/toc.md
|
@@ -234,6 +239,8 @@ test_files:
|
|
234
239
|
- spec/dummy/public/500.html
|
235
240
|
- spec/dummy/public/favicon.ico
|
236
241
|
- spec/dummy/script/rails
|
242
|
+
- spec/requests/admin/entries_spec.rb
|
237
243
|
- spec/requests/entries_spec.rb
|
238
244
|
- spec/requests/recipes_spec.rb
|
239
245
|
- spec/spec_helper.rb
|
246
|
+
has_rdoc:
|