grape-doc 0.0.1.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -0
- data/LICENSE +8 -0
- data/README.md +4 -0
- data/Rakefile +1 -0
- data/VERSION +1 -0
- data/grape-doc.gemspec +26 -0
- data/lib/grape/doc/logic.rb +495 -0
- data/lib/grape/doc/mpatch.rb +58 -0
- data/lib/grape/doc.rb +1 -0
- data/lib/grape-doc.rb +1 -0
- metadata +125 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6cc913997d475f2662a9a46193ef7a20f09a6512
|
4
|
+
data.tar.gz: d424ec6fd9bf1bbaf98c077f734ae3cf68ebd9cf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e65db9a8cd40cf01d25116f2432791f235c3fef9d8b7dafaeb3ae715d554478b72c4ae0645ff81e7e50d25ea799fa4fae8b16c3cd20eed443239946597211a9
|
7
|
+
data.tar.gz: e4c5014b787461dde2e770b3f50975f9b6ba50afcd0eee15768856f6735efa3e34cd7aa647dc272ca8fcdcc9d3ad6ba5d3ce0b034ebd5032cdb34308371d46ac
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
Copyright (c) 2014 Adam Luzsi
|
2
|
+
|
3
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
4
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
5
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
6
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
7
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
8
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.join"bundler","gem_tasks"
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1.alpha
|
data/grape-doc.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
|
5
|
+
spec.name = "grape-doc"
|
6
|
+
spec.version = File.open(File.join(File.dirname(__FILE__),"VERSION")).read.split("\n")[0].chomp.gsub(' ','')
|
7
|
+
spec.authors = ["Adam Luzsi"]
|
8
|
+
spec.email = ["adamluzsi@gmail.com"]
|
9
|
+
|
10
|
+
spec.description = %q{ Documentation generator for Grape module compatible with Redmine and Github formats }
|
11
|
+
spec.summary = %q{ Documentation generator for Grape module }
|
12
|
+
|
13
|
+
spec.homepage = "https://github.com/adamluzsi/#{__FILE__.split(File::Separator).last.split('.').first}"
|
14
|
+
spec.files = `git ls-files`.split($/)
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler"
|
20
|
+
spec.add_development_dependency "rake"
|
21
|
+
|
22
|
+
spec.add_dependency "grape"
|
23
|
+
spec.add_dependency "rack-test"
|
24
|
+
spec.add_dependency "rack-test-poc"
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,495 @@
|
|
1
|
+
module GrapeDoc
|
2
|
+
module Extend
|
3
|
+
module Doc
|
4
|
+
|
5
|
+
# helpers for doc generation
|
6
|
+
def wiki_body(route,wrapper_begin,wrapper_end,wrapper_close)
|
7
|
+
|
8
|
+
require 'grape/doc/mpatch'
|
9
|
+
|
10
|
+
description_key= :body
|
11
|
+
tmp_array= Array.new()
|
12
|
+
params= nil
|
13
|
+
evalue= nil
|
14
|
+
content_type= nil
|
15
|
+
|
16
|
+
#if route.route_path == "/booking/request(.:format)"
|
17
|
+
# debugger
|
18
|
+
#end
|
19
|
+
|
20
|
+
case true
|
21
|
+
|
22
|
+
when route.route_description.class <= ::String
|
23
|
+
params= route.route_params
|
24
|
+
|
25
|
+
when route.route_description.class <= ::Hash
|
26
|
+
|
27
|
+
if !route.route_description[:content_type].nil?
|
28
|
+
content_type= route.route_description[:content_type]
|
29
|
+
end
|
30
|
+
|
31
|
+
if description_key.nil?
|
32
|
+
params= route.route_params
|
33
|
+
evalue= "value[:type]"
|
34
|
+
else
|
35
|
+
params= route.route_description[description_key]
|
36
|
+
evalue= "value"
|
37
|
+
end
|
38
|
+
|
39
|
+
when route.route_description.class <= ::NilClass
|
40
|
+
params= route.route_params
|
41
|
+
params ||= "no return"
|
42
|
+
content_type= "TXT"
|
43
|
+
|
44
|
+
else
|
45
|
+
params= route.route_params
|
46
|
+
content_type= "TXT"
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
case true
|
51
|
+
|
52
|
+
when params.class <= ::Hash
|
53
|
+
|
54
|
+
if params == route.route_params
|
55
|
+
tmp_hash= Hash.new
|
56
|
+
params.each do |key,value|
|
57
|
+
tmp_hash[key]= value[:type].to_s
|
58
|
+
end
|
59
|
+
params= tmp_hash
|
60
|
+
end
|
61
|
+
|
62
|
+
params = params.convert_all_value_to_grape_dsl_format
|
63
|
+
|
64
|
+
when params.class <= ::Class
|
65
|
+
begin
|
66
|
+
if params.to_s.include? '::'
|
67
|
+
if params.to_s.downcase.include? 'boolean'
|
68
|
+
params= params.to_s.split('::').last
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
content_type= "TXT"
|
73
|
+
end
|
74
|
+
|
75
|
+
when params.class <= ::String
|
76
|
+
content_type= "TXT"
|
77
|
+
|
78
|
+
else
|
79
|
+
begin
|
80
|
+
params= "no params spec"
|
81
|
+
content_type= "TXT"
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
content_type ||= 'TXT'
|
87
|
+
content_type = content_type.keys if content_type.class <= ::Hash
|
88
|
+
|
89
|
+
[*content_type].each do |one_content_type|
|
90
|
+
|
91
|
+
case one_content_type.to_s.downcase
|
92
|
+
|
93
|
+
when 'json'
|
94
|
+
begin
|
95
|
+
|
96
|
+
tmp_array.push [wrapper_begin,one_content_type.to_s,wrapper_end].join
|
97
|
+
|
98
|
+
require 'json'
|
99
|
+
|
100
|
+
formatted_string= params.to_json
|
101
|
+
|
102
|
+
{
|
103
|
+
'{' => "{\n",
|
104
|
+
'}' => "\n}",
|
105
|
+
',' => ",\n"
|
106
|
+
}.each do |from,to|
|
107
|
+
formatted_string.gsub!(from,to)
|
108
|
+
end
|
109
|
+
|
110
|
+
formatted_string.gsub!(/^"/," \"")
|
111
|
+
tmp_array.push formatted_string
|
112
|
+
tmp_array.push wrapper_close
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
when "txt"
|
117
|
+
tmp_array.push(params.inspect)
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
return tmp_array
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
# this method help create from grape params and description a ppt like redmine wiki doc
|
128
|
+
# Usage:
|
129
|
+
#
|
130
|
+
##> example variable for description (hash obj)
|
131
|
+
#description= Hash.new
|
132
|
+
#
|
133
|
+
##> optional -> :description
|
134
|
+
#description[:desc]= String.new
|
135
|
+
#
|
136
|
+
##> response body like if JSON than a ruby Hash obj with the Structure and the values are the types
|
137
|
+
#description[:body]= Hash.new
|
138
|
+
#
|
139
|
+
##> response body code type -> like json usually same as content_type (format :xy)
|
140
|
+
#description[:content_type]= String.new #> "JSON"
|
141
|
+
#
|
142
|
+
#desc description
|
143
|
+
#params do
|
144
|
+
# optional :blabla, :type => String, :desc => "bla bla desc"
|
145
|
+
# requires :xy, type: String, desc: "XY desc"
|
146
|
+
#end
|
147
|
+
#get "xy" do
|
148
|
+
#
|
149
|
+
#end
|
150
|
+
#
|
151
|
+
##>---------------------------------------------------------------------------------------------------
|
152
|
+
#> OR the classic
|
153
|
+
#desc "My awsome String Description"
|
154
|
+
#params do
|
155
|
+
# optional :blabla, :type => String, :desc => "bla bla desc"
|
156
|
+
# requires :xy, type: String, desc: "XY desc"
|
157
|
+
#end
|
158
|
+
#delete "xy" do
|
159
|
+
#
|
160
|
+
#end
|
161
|
+
#
|
162
|
+
##>---------------------------------------------------------------------
|
163
|
+
## For the method use
|
164
|
+
#
|
165
|
+
## for a targeted specified class
|
166
|
+
#Grape.create_redmine_wiki_doc target_class: REST::API,
|
167
|
+
# path: File.expand_path(File.join(File.dirname(__FILE__),"test_file.txt"))
|
168
|
+
#
|
169
|
+
## for all grape subclass (directs and indirects)
|
170
|
+
#Grape.create_redmine_wiki_doc path: File.expand_path(File.join(File.dirname(__FILE__),"test_file.txt"))
|
171
|
+
#
|
172
|
+
def create_wiki_doc(*args)
|
173
|
+
|
174
|
+
# default set in args
|
175
|
+
begin
|
176
|
+
|
177
|
+
args= Hash[*args]
|
178
|
+
args.dup.each do |key,value|
|
179
|
+
if key.class != Symbol
|
180
|
+
args[key.to_s.to_sym]= value
|
181
|
+
args.delete key
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
if args[:path].nil?
|
186
|
+
raise ArgumentError,"You must set a file path with a file name in order to create documentation for grape!"
|
187
|
+
end
|
188
|
+
|
189
|
+
args[:desc_files] ||= Array.new
|
190
|
+
|
191
|
+
[:desc,:desc_file,:extra_desc_file].each do |one_key|
|
192
|
+
|
193
|
+
args[:desc_files] += args[(one_key.to_s+"s").to_sym] if args[(one_key.to_s+"s").to_sym].class == Array
|
194
|
+
args[:desc_files].push(args[one_key]) if args[one_key].class == String
|
195
|
+
|
196
|
+
end
|
197
|
+
|
198
|
+
args[:type] ||= args[:doc_type]
|
199
|
+
args[:type] ||= 'wiki'
|
200
|
+
|
201
|
+
#args[:path],
|
202
|
+
#args[:extra_desc_file]
|
203
|
+
#args[:target_class]
|
204
|
+
#args[:type]
|
205
|
+
|
206
|
+
end
|
207
|
+
|
208
|
+
|
209
|
+
# defaults
|
210
|
+
begin
|
211
|
+
|
212
|
+
uni_tab= ""
|
213
|
+
case args[:type].to_s.downcase
|
214
|
+
|
215
|
+
when "redmine","redmine_wiki","redmine-wiki","redminewiki"
|
216
|
+
begin
|
217
|
+
|
218
|
+
mid_tab= " "*3
|
219
|
+
|
220
|
+
bsym= "*"
|
221
|
+
isym= "_"
|
222
|
+
|
223
|
+
htsym= "* "
|
224
|
+
mtsym= htsym[0]*2 +" "
|
225
|
+
stsym= htsym[0]*3 +" "
|
226
|
+
|
227
|
+
hheader= "h3. "
|
228
|
+
mheader= "h4. "
|
229
|
+
sheader= "h5. "
|
230
|
+
|
231
|
+
container_markup_begin= "<pre><code class=\""
|
232
|
+
container_markup_end= "\">"
|
233
|
+
container_markup_close= "</code></pre>"
|
234
|
+
|
235
|
+
toc_mark= "\n{{>toc}}\n"
|
236
|
+
|
237
|
+
end
|
238
|
+
|
239
|
+
when "github","wiki","md"
|
240
|
+
begin
|
241
|
+
|
242
|
+
mid_tab= " "*3
|
243
|
+
|
244
|
+
bsym= "*"
|
245
|
+
isym= "_"
|
246
|
+
|
247
|
+
htsym= "* "
|
248
|
+
mtsym= " * "
|
249
|
+
stsym= " * "
|
250
|
+
|
251
|
+
hheader= "## "
|
252
|
+
mheader= "### "
|
253
|
+
sheader= "#### "
|
254
|
+
|
255
|
+
container_markup_begin= "```"
|
256
|
+
container_markup_end= ""
|
257
|
+
container_markup_close= "```"
|
258
|
+
toc_mark= ""
|
259
|
+
|
260
|
+
end
|
261
|
+
|
262
|
+
else
|
263
|
+
raise ArgumentError, "invalid :type has been set, try github or redmine"
|
264
|
+
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
|
269
|
+
# site name
|
270
|
+
begin
|
271
|
+
write_out_array = Array.new
|
272
|
+
write_out_array.push "#{hheader}#{$0} REST Interface Documentation\n\n"
|
273
|
+
end
|
274
|
+
|
275
|
+
# description
|
276
|
+
begin
|
277
|
+
args[:desc_files].each do |extra_desc_file_path|
|
278
|
+
|
279
|
+
write_out_array.push "#{sheader}#{extra_desc_file_path.split(File::Separator).last.split('.')[0].camelcase}\n"
|
280
|
+
write_out_array.push " "+File.open(extra_desc_file_path,"r").read+"\n"
|
281
|
+
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
# table of contents
|
286
|
+
begin
|
287
|
+
write_out_array.push toc_mark
|
288
|
+
end
|
289
|
+
|
290
|
+
# classes array
|
291
|
+
begin
|
292
|
+
rest_models= Array.new
|
293
|
+
end
|
294
|
+
if args[:target_class].nil?
|
295
|
+
Grape::API.each_subclass do |one_class|
|
296
|
+
rest_models.push(one_class)
|
297
|
+
end
|
298
|
+
else
|
299
|
+
if args[:target_class].class != Class && args[:target_class] != nil
|
300
|
+
raise ArgumentError, "invalid input :target_class is not a Class obj"
|
301
|
+
end
|
302
|
+
rest_models.push(args[:target_class])
|
303
|
+
end
|
304
|
+
|
305
|
+
rest_models.each do |rest_api_model|
|
306
|
+
next if Grape::API == rest_api_model
|
307
|
+
rest_api_model.routes.map do |route|
|
308
|
+
|
309
|
+
|
310
|
+
method_name= "#{hheader}Request: #{route.route_path} call: #{route.route_method.to_s.downcase} part"
|
311
|
+
|
312
|
+
# check that does the method already in the documentation
|
313
|
+
unless write_out_array.include?(method_name)
|
314
|
+
|
315
|
+
# create call name
|
316
|
+
begin
|
317
|
+
write_out_array.push method_name
|
318
|
+
end
|
319
|
+
|
320
|
+
# request
|
321
|
+
begin
|
322
|
+
|
323
|
+
# create request description
|
324
|
+
begin
|
325
|
+
write_out_array.push("\n"+(uni_tab*1)+"#{mheader}Request description")
|
326
|
+
case true
|
327
|
+
|
328
|
+
when route.route_description.class <= String
|
329
|
+
route.route_description.each_line do |one_line|
|
330
|
+
write_out_array.push((uni_tab*2)+htsym+one_line.chomp)
|
331
|
+
end
|
332
|
+
|
333
|
+
when route.route_description.class <= Hash
|
334
|
+
begin
|
335
|
+
|
336
|
+
description_msg = nil
|
337
|
+
|
338
|
+
[:d,:desc,:description].each do |sym|
|
339
|
+
description_msg ||= route.route_description[sym]
|
340
|
+
end
|
341
|
+
|
342
|
+
description_msg ||= "No description available for this path"
|
343
|
+
description_msg= [*description_msg]
|
344
|
+
|
345
|
+
description_msg.dup.each do |element|
|
346
|
+
next unless element.include?("\n")
|
347
|
+
|
348
|
+
index_n= description_msg.index(element)
|
349
|
+
description_msg.delete(element)
|
350
|
+
new_elements= element.split("\n")
|
351
|
+
new_elements.size.times do |counter_n|
|
352
|
+
description_msg.insert(index_n + counter_n - 1, new_elements[counter_n - 1] )
|
353
|
+
end
|
354
|
+
|
355
|
+
end
|
356
|
+
|
357
|
+
description_msg.each do |one_line|
|
358
|
+
write_out_array.push((uni_tab*2)+htsym+one_line.chomp)
|
359
|
+
end
|
360
|
+
|
361
|
+
end
|
362
|
+
|
363
|
+
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
# pre request
|
368
|
+
begin
|
369
|
+
write_out_array.push("\n#{mheader}request\n")
|
370
|
+
end
|
371
|
+
|
372
|
+
# create route method
|
373
|
+
begin
|
374
|
+
write_out_array.push((uni_tab*2)+"#{htsym}#{bsym}method:#{bsym}#{mid_tab} #{route.route_method}")
|
375
|
+
end
|
376
|
+
|
377
|
+
# create route path
|
378
|
+
begin
|
379
|
+
write_out_array.push((uni_tab*2)+"#{htsym}#{bsym}path:#{bsym}#{mid_tab} #{route.route_path}")
|
380
|
+
end
|
381
|
+
|
382
|
+
# create route content_type
|
383
|
+
begin
|
384
|
+
write_out_array.push((uni_tab*2)+"#{htsym}#{bsym}headers:#{bsym}#{mid_tab}")
|
385
|
+
rest_api_model.content_types.each do |one_format_type,one_format_header|
|
386
|
+
write_out_array.push "#{mtsym}#{uni_tab*2}#{one_format_header}"
|
387
|
+
end
|
388
|
+
|
389
|
+
write_out_array.push ""
|
390
|
+
end
|
391
|
+
|
392
|
+
# parameters
|
393
|
+
begin
|
394
|
+
new_docs_element= Array.new
|
395
|
+
if route.route_params.count == 0
|
396
|
+
new_docs_element.push " No specified or special params"
|
397
|
+
else
|
398
|
+
new_docs_element.push ""
|
399
|
+
new_docs_element.push "#{htsym}#{isym}#{bsym}Parameters#{bsym}#{isym}"
|
400
|
+
route.route_params.each do |key,value|
|
401
|
+
new_docs_element.push "#{mtsym}#{isym}#{key}#{isym}"
|
402
|
+
value.each do |value_key,value_value|
|
403
|
+
new_docs_element.push "#{stsym}#{value_key}: #{value_value}"
|
404
|
+
end
|
405
|
+
end
|
406
|
+
new_docs_element.push "\n"
|
407
|
+
end
|
408
|
+
refactored_element= Array.new
|
409
|
+
new_docs_element.each do |one_element|
|
410
|
+
refactored_element.push((uni_tab*2)+one_element)
|
411
|
+
end
|
412
|
+
write_out_array.push refactored_element.join("\n")
|
413
|
+
end
|
414
|
+
|
415
|
+
end
|
416
|
+
|
417
|
+
# response
|
418
|
+
begin
|
419
|
+
|
420
|
+
# pre response
|
421
|
+
begin
|
422
|
+
write_out_array.push("\n#{mheader}response\n")
|
423
|
+
end
|
424
|
+
|
425
|
+
#> TODO make better implementation for others to use
|
426
|
+
#create route content_type
|
427
|
+
begin
|
428
|
+
if !Grape::Endpoint.config_obj.nil?
|
429
|
+
|
430
|
+
write_out_array.push((uni_tab*2)+"#{sheader}Extra headers:")
|
431
|
+
|
432
|
+
Grape::Endpoint.header_config_obj.each do |header_key,header_value|
|
433
|
+
write_out_array.push "#{htsym}#{header_key}: #{header_value.join(', ')}"
|
434
|
+
end
|
435
|
+
|
436
|
+
write_out_array.push ""
|
437
|
+
|
438
|
+
end
|
439
|
+
end if Grape::Endpoint.respond_to?(:config_obj) && Grape::Endpoint.respond_to?(:header_config_obj)
|
440
|
+
|
441
|
+
# create response bodies
|
442
|
+
begin
|
443
|
+
#TODO check out why not working normaly with evry path!
|
444
|
+
write_out_array.push((uni_tab*2)+"#{sheader}*body:*")
|
445
|
+
wiki_body(route,container_markup_begin,container_markup_end,container_markup_close ).each do |one_element|
|
446
|
+
write_out_array.push one_element
|
447
|
+
end
|
448
|
+
write_out_array.push ""
|
449
|
+
end
|
450
|
+
|
451
|
+
end
|
452
|
+
|
453
|
+
# error resp
|
454
|
+
begin
|
455
|
+
|
456
|
+
# pre error
|
457
|
+
begin
|
458
|
+
write_out_array.push("\n#{mheader}response in case of failure\n")
|
459
|
+
end
|
460
|
+
|
461
|
+
# create error response headers
|
462
|
+
begin
|
463
|
+
|
464
|
+
end
|
465
|
+
|
466
|
+
# create error response bodies
|
467
|
+
begin
|
468
|
+
#write_out_array.push((uni_tab*2)+"*body:*")
|
469
|
+
write_out_array.push((uni_tab*2)+"#{htsym}*Internal Server Error:500*")
|
470
|
+
end
|
471
|
+
|
472
|
+
end
|
473
|
+
|
474
|
+
# after space
|
475
|
+
begin
|
476
|
+
write_out_array.push "\n----\n"
|
477
|
+
end
|
478
|
+
|
479
|
+
end
|
480
|
+
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
484
|
+
File.new(args[:path],"w").write write_out_array.join("\n")
|
485
|
+
|
486
|
+
return nil
|
487
|
+
end
|
488
|
+
|
489
|
+
alias :create_ppt_doc :create_wiki_doc
|
490
|
+
|
491
|
+
end
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
Grape.__send__ :extend, ::GrapeDoc::Extend::Doc
|
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
module GrapeDSL
|
3
|
+
module EXT
|
4
|
+
|
5
|
+
module ArrayMP
|
6
|
+
def convert_all_value_to_grape_dsl_format
|
7
|
+
|
8
|
+
self.count.times do |index|
|
9
|
+
|
10
|
+
case true
|
11
|
+
|
12
|
+
when self[index].class <= Hash
|
13
|
+
self[index].convert_all_value_to_grape_dsl_format
|
14
|
+
|
15
|
+
when self[index].class <= Array
|
16
|
+
self[index].convert_all_value_to_grape_dsl_format
|
17
|
+
|
18
|
+
else
|
19
|
+
self[index]= self[index].to_s
|
20
|
+
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
return self
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
module HashMP
|
31
|
+
def convert_all_value_to_grape_dsl_format
|
32
|
+
|
33
|
+
self.each do |key,value|
|
34
|
+
|
35
|
+
case true
|
36
|
+
|
37
|
+
when value.class <= Hash
|
38
|
+
value.convert_all_value_to_grape_dsl_format
|
39
|
+
|
40
|
+
when value.class <= Array
|
41
|
+
value.convert_all_value_to_grape_dsl_format
|
42
|
+
|
43
|
+
else
|
44
|
+
self[key]= value.to_s
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
return self
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
Array.__send__ :include, GrapeDSL::EXT::ArrayMP
|
58
|
+
Hash.__send__ :include, GrapeDSL::EXT::HashMP
|
data/lib/grape/doc.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'grape-doc'
|
data/lib/grape-doc.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'grape/doc/logic'
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: grape-doc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.alpha
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Luzsi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: grape
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test-poc
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: " Documentation generator for Grape module compatible with Redmine and
|
84
|
+
Github formats "
|
85
|
+
email:
|
86
|
+
- adamluzsi@gmail.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- VERSION
|
96
|
+
- grape-doc.gemspec
|
97
|
+
- lib/grape-doc.rb
|
98
|
+
- lib/grape/doc.rb
|
99
|
+
- lib/grape/doc/logic.rb
|
100
|
+
- lib/grape/doc/mpatch.rb
|
101
|
+
homepage: https://github.com/adamluzsi/grape-doc
|
102
|
+
licenses: []
|
103
|
+
metadata: {}
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.3.1
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 2.2.2
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
123
|
+
summary: Documentation generator for Grape module
|
124
|
+
test_files: []
|
125
|
+
has_rdoc:
|