grape-doc 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3ef112f1cfda8c0f2aeaea8a6e6bf31ec205c70
4
- data.tar.gz: 3e3ba46f60a0a3f42e323d84335ab4e56ebf850e
3
+ metadata.gz: caa394eadde9afd947824250ce504efef851025d
4
+ data.tar.gz: 30a65e747ab167f41d4c4ac5b11aa54092d981fc
5
5
  SHA512:
6
- metadata.gz: 610f14fea4beb9067955f13308491583cbb101d1984dff76c536b565cc93c26152ad4db64938e8549b83b32829784676900ca9a5d679f33765f28328e822a81a
7
- data.tar.gz: ce10b1cbd6fed21329bf10e21f50b73da442262bb916adc0ee38a0a1f951149f530396db725ec7697253207d589b2121030196fbe87f18ef24c856cabe66d573
6
+ metadata.gz: 3b95bb7efabc6e93a542d38440af9fda0dee90b5e0020e6ca95753f932ce3ab7ceb37df72d0369c0369d27b75a3756dfa7b5a57ce22c43dfc4c14a071c162091
7
+ data.tar.gz: c676d58047822cd7148de315b84838b25db853568c01581e197a67581ace8da1c36a41d63074bd2a685c799bb88f46e5bfda14a6cb1f2a3a37541f07b49dbeaf
data/README.md CHANGED
@@ -1,18 +1,58 @@
1
1
  Grape-Doc
2
2
  ========
3
3
 
4
- Grape documentation generator
4
+ ### Description
5
5
 
6
- install:
6
+ It's a Grape documentation generator for lazy developers.
7
+ The main goal is to make as clean and useful documentation
8
+ as possible for 3. party developers to your application without
9
+ sharing anything from the code.
7
10
 
8
- gem install grape-doc
11
+ The Documentation generator it self is a little evil because
12
+ it not force but really count on it, that you make test for
13
+ your api endpoints. For now it's all based on rack-test,
14
+ but support will be given for other testing frameworks too.
15
+
16
+ But dont misunderstand this, it can live without it,
17
+ you just have to do more support for the others,
18
+ because the documentation will lack curl samples and sample
19
+ response body and stuffs like that.
20
+
21
+ #### Install
22
+
23
+ $ gem install grape-doc
9
24
 
10
- Gemfile:
25
+ #### Gemfile
26
+
27
+ gem 'grape-doc'
28
+
29
+ #### Simple Use
30
+
31
+ ```ruby
32
+
33
+ GrapeDoc.generate
34
+ #> this will create an api_doc.html in the project_folder/doc
35
+
36
+ ```
37
+
38
+ I Would suggest run minitests first,
39
+ with including all the test in the test folder that touch anything with your grape api classes.
40
+ Because a rack-test-poc , there will be generated yaml files in the test/poc folder
41
+
42
+ #### Complex Use
43
+
44
+ ```ruby
11
45
 
12
- gem 'grape-doc'
46
+ GrapeDoc.generate format: 'redmine', # or textile, or html
47
+ path: File.join(__dir__,'..........')
48
+
13
49
 
14
- Simple Use:
50
+ ```
51
+
52
+ well that was complex! right?
15
53
 
16
- GrapeDoc.generate
54
+ #### After words
17
55
 
18
- #> this will create an api_doc.html in the project folder/doc
56
+ I would strongly suggest using Grape build in desc method for api endpoints,
57
+ and define every parameters ahead, so they will be included in the documentation,
58
+ and validated on request!
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -8,8 +8,9 @@ module GrapeDoc
8
8
  raise(ArgumentError,'invalid options given') unless opts.class <= Hash
9
9
  @options = {
10
10
  'format' => 'html',
11
- 'path' => File.join(Helpers.doc_folder_path,'api_doc.html')
11
+ 'path' => File.join(Helpers.doc_folder_path,'api_doc')
12
12
  }.merge(opts.reduce({}){|m,o| m.merge!(o[0].to_s => o[1]) ;m})
13
+ self.options['path'] = self.options['path'].to_s.sub(/\..*$/,'')
13
14
 
14
15
  process_head
15
16
  process_table_of_content
@@ -26,11 +27,11 @@ module GrapeDoc
26
27
  case @options['format'].to_s.downcase
27
28
 
28
29
  when /redmine/,/textile/
29
- File.write self.options['path'].sub(/\..*$/,'.textile'),
30
+ File.write self.options['path'] + '.textile',
30
31
  document.to_textile
31
32
 
32
33
  else
33
- File.write self.options['path'].sub(/\..*$/,'.html'),
34
+ File.write self.options['path'] + '.html',
34
35
  document.to_textile.to_html
35
36
 
36
37
 
@@ -4,7 +4,7 @@ describe 'Doc generating' do
4
4
  specify 'test documentation generator' do
5
5
 
6
6
  var = GrapeDoc.new
7
- GrapeDoc.generate path: File.join(__dir__,'sample.html'),format: 'redmine'
7
+ GrapeDoc.generate path: File.join(__dir__,'sample'),format: 'redmine'
8
8
 
9
9
  end
10
10
 
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
@@ -135,7 +135,6 @@ files:
135
135
  - lib/grape/doc/helper.rb
136
136
  - lib/grape/doc/parser.rb
137
137
  - lib/grape/doc/prototype.rb
138
- - test/sample.html
139
138
  - test/sample.textile
140
139
  - test/test_all.rb
141
140
  - test/test_collector.rb
@@ -166,7 +165,6 @@ signing_key:
166
165
  specification_version: 4
167
166
  summary: Documentation generator for Grape module
168
167
  test_files:
169
- - test/sample.html
170
168
  - test/sample.textile
171
169
  - test/test_all.rb
172
170
  - test/test_collector.rb
data/test/sample.html DELETED
@@ -1,42 +0,0 @@
1
- <h1>Rest Api Documentation (grape-doc)</h1>
2
- <h2><span class="caps">GET</span>: /hello(.:format)</h2>
3
- <h3>Request</h3>
4
- <h4>description</h4>
5
- <ul>
6
- <li>Hello world!</li>
7
- </ul>
8
- <h4>params</h4>
9
- <ul>
10
- <li>test
11
- <ul>
12
- <li>required: false</li>
13
- <li>type: String</li>
14
- <li>desc: it&#8217;s a test string</li>
15
- </ul></li>
16
- </ul>
17
- <h3>Response</h3>
18
- <h4>example</h4>
19
- <h5>curl sample with /hello</h5>
20
- <pre>$ curl -X GET "http://example.org/hello?test=hy" -H "Accept-Version: v1" -H "X-Token: blabla"</pre>
21
- <ul>
22
- <li>status code: 200</li>
23
- <li>format type: json</li>
24
- </ul>
25
- <h6>raw response body</h6>
26
- <pre>{"hello":"world!"}</pre>
27
- <h6>json formatted body with Class types</h6>
28
- <pre>{
29
- "hello": "String"
30
- }</pre>
31
- <h5>curl sample with /hello.json</h5>
32
- <pre>$ curl -X GET "http://example.org/hello.json?" -H "Accept-Version: v1" -H "X-Token: blabla"</pre>
33
- <ul>
34
- <li>status code: 200</li>
35
- <li>format type: json</li>
36
- </ul>
37
- <h6>raw response body</h6>
38
- <pre>{"hello":"world!"}</pre>
39
- <h6>json formatted body with Class types</h6>
40
- <pre>{
41
- "hello": "String"
42
- }</pre>