grape_doc 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -4
- data/README.md +8 -54
- data/grape_doc.gemspec +3 -3
- data/lib/grape_doc/doc_generator.rb +5 -7
- data/lib/grape_doc/version.rb +1 -1
- metadata +7 -6
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
_Not published yet_
|
2
|
-
|
3
1
|
# GrapeDoc
|
4
2
|
|
5
3
|
This gem generate API documentation from Grape API.
|
@@ -69,59 +67,15 @@ _At this time it supports only MarkDown format._
|
|
69
67
|
Tweet.find(params[:id])
|
70
68
|
end
|
71
69
|
|
72
|
-
|
73
|
-
|
74
|
-
Single entity
|
75
|
-
|
76
|
-
desc "Returns a tweet.",
|
77
|
-
:response => {
|
78
|
-
:id => 14,
|
79
|
-
:tweet => "FooBarBazz"
|
80
|
-
}
|
81
|
-
get '/show/:id' do
|
82
|
-
Tweet.find(params[:id])
|
83
|
-
end
|
84
|
-
|
85
|
-
Array of entities
|
86
|
-
|
87
|
-
desc "Returns a tweets",
|
88
|
-
:response => [
|
89
|
-
{
|
90
|
-
:id => 14,
|
91
|
-
:tweet => "FooBarBazz"
|
92
|
-
},
|
93
|
-
{
|
94
|
-
:id => 14,
|
95
|
-
:tweet => "FooBarBazz"
|
96
|
-
}
|
97
|
-
]
|
98
|
-
get '/tweets' do
|
99
|
-
Tweet.all
|
100
|
-
end
|
101
|
-
|
102
|
-
### Response using Grape::Entity
|
103
|
-
|
104
|
-
Single entity
|
70
|
+
## TODO
|
105
71
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
desc "Returns a tweet.",
|
115
|
-
:response_with => { :entities => API::Entities::Tweet }
|
116
|
-
get '/show/:id' do
|
117
|
-
Tweet.find(params[:id])
|
118
|
-
end
|
119
|
-
|
120
|
-
Grape::Entity description
|
121
|
-
|
122
|
-
class Tweet < Grape::Entity
|
123
|
-
expose :tweet, :documentation => {:type => String, :desc => "words go here", :value => "FuuBar"}
|
124
|
-
end
|
72
|
+
- generate plain response
|
73
|
+
- generate response from Grape::Entity
|
74
|
+
- generate response from Grape::Entity with nested entities
|
75
|
+
- other output formats
|
76
|
+
- ~~write docs into separated files~~
|
77
|
+
- add code documentation
|
78
|
+
- and more others features
|
125
79
|
|
126
80
|
## Contributing
|
127
81
|
|
data/grape_doc.gemspec
CHANGED
@@ -4,9 +4,9 @@ require File.expand_path('../lib/grape_doc/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Alex Denisov"]
|
6
6
|
gem.email = ["1101.debian@gmail.com"]
|
7
|
-
gem.description = %q{
|
8
|
-
gem.summary = %q{
|
9
|
-
gem.homepage = ""
|
7
|
+
gem.description = %q{Documentation generator for Grape API}
|
8
|
+
gem.summary = %q{Documentation generator for Grape API}
|
9
|
+
gem.homepage = "https://github.com/AlexDenisov/grape_doc"
|
10
10
|
gem.files = `git ls-files`.split($\)
|
11
11
|
gem.executables << "grape_doc"
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
@@ -29,14 +29,12 @@ module GrapeDoc
|
|
29
29
|
|
30
30
|
def generate
|
31
31
|
doc_formatter = init_formatter
|
32
|
-
generated_resources = self.resources.map do | resource |
|
33
|
-
doc_formatter.generate_resource_doc resource
|
34
|
-
end.join
|
35
32
|
doc_dir = "#{Dir.pwd}/grape_doc"
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
FileUtils.mkdir_p(doc_dir)
|
34
|
+
|
35
|
+
self.resources.each do | resource |
|
36
|
+
File.open(File.join(doc_dir, "#{resource.resource_name}.md"), 'w') {|f| f.write doc_formatter.generate_resource_doc(resource) }
|
37
|
+
end
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
data/lib/grape_doc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape_doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-06-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: grape
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '2.11'
|
90
|
-
description:
|
90
|
+
description: Documentation generator for Grape API
|
91
91
|
email:
|
92
92
|
- 1101.debian@gmail.com
|
93
93
|
executables:
|
@@ -123,7 +123,7 @@ files:
|
|
123
123
|
- spec/test_classes/api.rb
|
124
124
|
- spec/test_classes/projects.rb
|
125
125
|
- spec/test_classes/users.rb
|
126
|
-
homepage:
|
126
|
+
homepage: https://github.com/AlexDenisov/grape_doc
|
127
127
|
licenses: []
|
128
128
|
post_install_message:
|
129
129
|
rdoc_options: []
|
@@ -143,10 +143,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project:
|
146
|
-
rubygems_version: 1.8.
|
146
|
+
rubygems_version: 1.8.23
|
147
147
|
signing_key:
|
148
148
|
specification_version: 3
|
149
|
-
summary:
|
149
|
+
summary: Documentation generator for Grape API
|
150
150
|
test_files:
|
151
151
|
- spec/api_document_spec.rb
|
152
152
|
- spec/api_parameter_spec.rb
|
@@ -158,3 +158,4 @@ test_files:
|
|
158
158
|
- spec/test_classes/api.rb
|
159
159
|
- spec/test_classes/projects.rb
|
160
160
|
- spec/test_classes/users.rb
|
161
|
+
has_rdoc:
|