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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78159d4d2d7852fadb62e8caf6b7aad1dbd0f772
4
- data.tar.gz: 4fcba1b40c4a766cfb9d2d06e48e2563c75bd6b1
3
+ metadata.gz: 3f00e6cadd228f64cd7fb2099ade14e6492f3089
4
+ data.tar.gz: 9996410f37a28e87a478bdafb9cb0ff75b65debb
5
5
  SHA512:
6
- metadata.gz: b7780a35011633490200162fda618beb50ff8e82052c631690b99927fd82c4380d21d05a2fca12080373e32fc39b0041aaba4f2c067c8cc0142371c183991f22
7
- data.tar.gz: 193c15ecde4b52289c5148b1b84aa4859f5561319b84c55ffcc7e40f1d2189962fb6e8632f0b62feab0c65e86ed54b2911be75fa3c2d64c6997f45ec4bfa1cf6
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, it's in alpha stage!
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.0
1
+ 0.1.1
@@ -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;alias generate new
128
+ end
129
+
130
+ def generate(*args)
131
+ Generator.new(*args).save
132
+ end;alias save generate
124
133
 
125
134
  end
126
135
 
@@ -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
- File.mkdir doc_folder_path unless File.exist?(doc_folder_path)
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
@@ -8,6 +8,8 @@ describe 'Doc generating' do
8
8
  File.write File.join(RackTestPoc.root,'test','sample.html'),
9
9
  var.document.to_textile.to_html
10
10
 
11
+ GrapeDoc.generate
12
+
11
13
  end
12
14
 
13
15
  end
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi