grape-doc 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -1
- data/VERSION +1 -1
- data/lib/grape/doc/generator.rb +12 -3
- data/lib/grape/doc/helper.rb +1 -1
- data/test/test_doc_gen.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f00e6cadd228f64cd7fb2099ade14e6492f3089
|
4
|
+
data.tar.gz: 9996410f37a28e87a478bdafb9cb0ff75b65debb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 488d1cf71281297eb741814477060490592ca15d58ed1b9590eae3516ca6a841f2ab4b2179a5325dea6ff25677e54ff22d1e22f43bd32223138ae2db912bb0d9
|
7
|
+
data.tar.gz: 21333f8855c6ffb17cae84e5d86903a7fc31f148ee4121136cee56ecd76e087015d3204d831861ba7b5e10a6a9785abbdc96624951febf58ed8731c1191f88ed
|
data/README.md
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
Grape-Doc
|
2
2
|
========
|
3
3
|
|
4
|
-
Grape documentation generator
|
4
|
+
Grape documentation generator
|
5
|
+
|
6
|
+
install:
|
7
|
+
|
8
|
+
gem install grape-doc
|
9
|
+
|
10
|
+
Gemfile:
|
11
|
+
|
12
|
+
gem 'grape-doc'
|
13
|
+
|
14
|
+
Simple Use:
|
15
|
+
|
16
|
+
GrapeDoc.generate
|
17
|
+
|
18
|
+
#> this will create an api_doc.html in the project folder/doc
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/grape/doc/generator.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module GrapeDoc
|
2
2
|
class Generator
|
3
3
|
|
4
|
+
attr_accessor :file_path
|
4
5
|
def initialize(opts={})
|
5
6
|
|
6
7
|
raise(ArgumentError,'invalid options given') unless opts.class <= Hash
|
@@ -10,6 +11,8 @@ module GrapeDoc
|
|
10
11
|
}.merge(opts)
|
11
12
|
)
|
12
13
|
|
14
|
+
self.file_path= opts[:path] || opts['path'] || File.join(Helpers.doc_folder_path,'api_doc.html')
|
15
|
+
|
13
16
|
process_head
|
14
17
|
process_table_of_content
|
15
18
|
process_endpoints
|
@@ -21,9 +24,11 @@ module GrapeDoc
|
|
21
24
|
end
|
22
25
|
|
23
26
|
def save
|
24
|
-
File.write File.join(Helpers.doc_folder_path,'api_doc.html'),
|
25
|
-
RedCloth.new(document.to_textile).to_html
|
26
27
|
|
28
|
+
File.write self.file_path,
|
29
|
+
document.to_textile.to_html
|
30
|
+
|
31
|
+
true;rescue;false
|
27
32
|
end;alias save! save
|
28
33
|
|
29
34
|
private
|
@@ -120,7 +125,11 @@ module GrapeDoc
|
|
120
125
|
|
121
126
|
def new(*args)
|
122
127
|
Generator.new(*args)
|
123
|
-
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def generate(*args)
|
131
|
+
Generator.new(*args).save
|
132
|
+
end;alias save generate
|
124
133
|
|
125
134
|
end
|
126
135
|
|
data/lib/grape/doc/helper.rb
CHANGED
@@ -12,7 +12,7 @@ module GrapeDoc
|
|
12
12
|
def doc_folder_path
|
13
13
|
@doc_folder_path ||= -> {
|
14
14
|
doc_folder_path = File.join(RackTestPoc.root,'doc')
|
15
|
-
|
15
|
+
Dir.mkdir doc_folder_path unless File.exist?(doc_folder_path)
|
16
16
|
return doc_folder_path
|
17
17
|
|
18
18
|
}.call
|
data/test/test_doc_gen.rb
CHANGED