rspec_api_documentation 4.7.0 → 4.8.0

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: 5643d0ed3b32b595746931b4dddf583a56e31ed5
4
- data.tar.gz: 87115d7eac49ebc0f51fbfec49fdc9780f9e4332
3
+ metadata.gz: fdd16f01648ad082b801d8fd30ebc1cd06e55fd8
4
+ data.tar.gz: 51d343a6cf25688c651d1631ae060410cdb53b4b
5
5
  SHA512:
6
- metadata.gz: f15ff0825beca5eca22adc6dc15a044682ea9c835280246a5759bb94e5cf04360e4ba6aa0c5b554cf8c67cd6005ecbe7e2a05ea331efcf390dd08adbc1bb087e
7
- data.tar.gz: 9c0aefe90889c51b51e3ae671a3b77f5c0cba7a5d4aa38c7faa90aeb26f9a228493a8615ba772b46137fa4d51b94db98caad30e1bca5ab470492ba841e53b416
6
+ metadata.gz: 6e2c63b4378da2efa410296c6133649210f4685ceb04a0ea612e91e690e69894099c220d83f01e9a5b5d77581bb2e0aa1c37b8e21b6bbda8e6440ad1411bafd4
7
+ data.tar.gz: bb6622522c0dda680a95e7f56666d1266fb9dc793c38a02bd9e3cb3368b317859cff1360d33ac9e87d9953180f05e606eee1320096906084a63d77b1aaf88b59
@@ -43,6 +43,7 @@ module RspecApiDocumentation
43
43
  autoload :IndexHelper
44
44
  autoload :CombinedTextWriter
45
45
  autoload :CombinedJsonWriter
46
+ autoload :SlateWriter
46
47
  end
47
48
 
48
49
  module Views
@@ -56,6 +57,7 @@ module RspecApiDocumentation
56
57
  autoload :TextileExample
57
58
  autoload :MarkdownIndex
58
59
  autoload :MarkdownExample
60
+ autoload :SlateExample
59
61
  end
60
62
 
61
63
  def self.configuration
@@ -0,0 +1,32 @@
1
+ module RspecApiDocumentation
2
+ module Views
3
+ class SlateExample < MarkdownExample
4
+ def initialize(example, configuration)
5
+ super
6
+ self.template_name = "rspec_api_documentation/slate_example"
7
+ end
8
+
9
+ def curl_with_linebreaks
10
+ requests.map {|request| request[:curl].lines }.flatten.map do |line|
11
+ line.rstrip.gsub("\t", ' ').gsub(' ', '&nbsp;').gsub('\\', '&#92;')
12
+ end.join "<br>"
13
+ end
14
+
15
+ def explanation_with_linebreaks
16
+ explanation.gsub "\n", "<br>\n"
17
+ end
18
+
19
+ def write
20
+ File.open(configuration.docs_dir.join("#{FILENAME}.#{extension}"), 'w+') do |file|
21
+ file.write "# #{configuration.api_name}\n\n"
22
+ index.examples.sort_by!(&:description) unless configuration.keep_source_order
23
+
24
+ index.examples.each do |example|
25
+ markup_example = markup_example_class.new(example, configuration)
26
+ file.write markup_example.render
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,29 @@
1
+ module RspecApiDocumentation
2
+ module Writers
3
+
4
+ class SlateWriter < MarkdownWriter
5
+ FILENAME = '_generated_examples'
6
+
7
+ def self.clear_docs(docs_dir)
8
+ FileUtils.mkdir_p(docs_dir)
9
+ FileUtils.rm Dir[File.join docs_dir, "#{FILENAME}.*"]
10
+ end
11
+
12
+ def markup_example_class
13
+ RspecApiDocumentation::Views::SlateExample
14
+ end
15
+
16
+ def write
17
+ File.open(configuration.docs_dir.join("#{FILENAME}.#{extension}"), 'w+') do |file|
18
+ file.write "# #{configuration.api_name}\n\n"
19
+ index.examples.sort_by!(&:description) unless configuration.keep_source_order
20
+
21
+ index.examples.each do |example|
22
+ markup_example = markup_example_class.new(example, configuration)
23
+ file.write markup_example.render
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,86 @@
1
+ ## {{ description }}
2
+
3
+ ### Request
4
+
5
+ #### Endpoint
6
+
7
+ {{# requests}}
8
+ ```
9
+ {{ request_method }} {{ request_path }}
10
+ {{ request_headers_text }}
11
+ ```
12
+ {{/ requests}}
13
+
14
+ `{{ http_method }} {{ route }}`
15
+
16
+ {{# explanation }}
17
+
18
+ {{{ explanation_with_linebreaks }}}
19
+ {{/ explanation }}
20
+
21
+ #### Parameters
22
+
23
+ {{# requests}}
24
+ {{# request_query_parameters_text }}
25
+
26
+ ```json
27
+ {{ request_query_parameters_text }}
28
+ ```
29
+ {{/ request_query_parameters_text }}
30
+ {{# request_body }}
31
+
32
+ ```json
33
+ {{{ request_body }}}
34
+ ```
35
+ {{/ request_body }}
36
+
37
+ {{# has_parameters? }}
38
+
39
+ | Name | Description |
40
+ |:-----|:------------|
41
+ {{# parameters }}
42
+ | {{#scope}}{{scope}}[{{/scope}}{{ name }}{{#scope}}]{{/scope}} {{# required }}*required*{{/ required }} | {{{ description }}} |
43
+ {{/ parameters }}
44
+
45
+ {{/ has_parameters? }}
46
+ {{^ has_parameters? }}
47
+ None known.
48
+ {{/ has_parameters? }}
49
+
50
+ {{# response_status}}
51
+
52
+ ### Response
53
+
54
+ ```
55
+ {{ response_headers_text }}
56
+ {{ response_status }} {{ response_status_text}}
57
+ ```
58
+
59
+ {{# response_body}}
60
+
61
+ ```json
62
+ {{{ response_body }}}
63
+ ```
64
+ {{/response_body}}
65
+
66
+ {{/ response_status}}
67
+
68
+ {{# has_response_fields? }}
69
+
70
+ #### Fields
71
+
72
+ | Name | Description |
73
+ |:-----------|:--------------------|
74
+ {{# response_fields }}
75
+ | {{#scope}}{{scope}}[{{/scope}}{{ name }}{{#scope}}]{{/scope}} | {{{ description }}} |
76
+ {{/ response_fields }}
77
+
78
+ {{/ has_response_fields? }}
79
+
80
+ {{# curl }}
81
+
82
+ ### cURL
83
+
84
+ <code>{{{ curl_with_linebreaks }}}</code>
85
+ {{/ curl }}
86
+ {{/ requests}}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_api_documentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.0
4
+ version: 4.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Cahoon
@@ -10,12 +10,15 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-01-28 00:00:00.000000000 Z
13
+ date: 2016-05-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
19
22
  - - ">="
20
23
  - !ruby/object:Gem::Version
21
24
  version: 3.0.0
@@ -23,6 +26,9 @@ dependencies:
23
26
  prerelease: false
24
27
  version_requirements: !ruby/object:Gem::Requirement
25
28
  requirements:
29
+ - - "~>"
30
+ - !ruby/object:Gem::Version
31
+ version: '3.0'
26
32
  - - ">="
27
33
  - !ruby/object:Gem::Version
28
34
  version: 3.0.0
@@ -46,7 +52,7 @@ dependencies:
46
52
  requirements:
47
53
  - - "~>"
48
54
  - !ruby/object:Gem::Version
49
- version: '0.99'
55
+ version: '1.0'
50
56
  - - ">="
51
57
  - !ruby/object:Gem::Version
52
58
  version: 0.99.4
@@ -56,44 +62,24 @@ dependencies:
56
62
  requirements:
57
63
  - - "~>"
58
64
  - !ruby/object:Gem::Version
59
- version: '0.99'
65
+ version: '1.0'
60
66
  - - ">="
61
67
  - !ruby/object:Gem::Version
62
68
  version: 0.99.4
63
- - !ruby/object:Gem::Dependency
64
- name: json
65
- requirement: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '1.4'
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 1.4.6
73
- type: :runtime
74
- prerelease: false
75
- version_requirements: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "~>"
78
- - !ruby/object:Gem::Version
79
- version: '1.4'
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 1.4.6
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: bundler
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - ">="
73
+ - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: '0'
75
+ version: '1.0'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - ">="
80
+ - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: '0'
82
+ version: '1.0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: fakefs
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -113,6 +99,9 @@ dependencies:
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.4'
104
+ - - ">="
116
105
  - !ruby/object:Gem::Version
117
106
  version: 1.4.4
118
107
  type: :development
@@ -120,6 +109,9 @@ dependencies:
120
109
  version_requirements: !ruby/object:Gem::Requirement
121
110
  requirements:
122
111
  - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '1.4'
114
+ - - ">="
123
115
  - !ruby/object:Gem::Version
124
116
  version: 1.4.4
125
117
  - !ruby/object:Gem::Dependency
@@ -183,6 +175,9 @@ dependencies:
183
175
  requirement: !ruby/object:Gem::Requirement
184
176
  requirements:
185
177
  - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: 1.2.2
180
+ - - ">="
186
181
  - !ruby/object:Gem::Version
187
182
  version: 1.0.7
188
183
  type: :development
@@ -190,6 +185,9 @@ dependencies:
190
185
  version_requirements: !ruby/object:Gem::Requirement
191
186
  requirements:
192
187
  - - "~>"
188
+ - !ruby/object:Gem::Version
189
+ version: 1.2.2
190
+ - - ">="
193
191
  - !ruby/object:Gem::Version
194
192
  version: 1.0.7
195
193
  - !ruby/object:Gem::Dependency
@@ -224,6 +222,9 @@ dependencies:
224
222
  name: faraday
225
223
  requirement: !ruby/object:Gem::Requirement
226
224
  requirements:
225
+ - - "~>"
226
+ - !ruby/object:Gem::Version
227
+ version: '0.9'
227
228
  - - ">="
228
229
  - !ruby/object:Gem::Version
229
230
  version: 0.9.0
@@ -231,6 +232,9 @@ dependencies:
231
232
  prerelease: false
232
233
  version_requirements: !ruby/object:Gem::Requirement
233
234
  requirements:
235
+ - - "~>"
236
+ - !ruby/object:Gem::Version
237
+ version: '0.9'
234
238
  - - ">="
235
239
  - !ruby/object:Gem::Version
236
240
  version: 0.9.0
@@ -238,16 +242,22 @@ dependencies:
238
242
  name: thin
239
243
  requirement: !ruby/object:Gem::Requirement
240
244
  requirements:
245
+ - - "~>"
246
+ - !ruby/object:Gem::Version
247
+ version: '1.6'
241
248
  - - ">="
242
249
  - !ruby/object:Gem::Version
243
- version: '0'
250
+ version: 1.6.3
244
251
  type: :development
245
252
  prerelease: false
246
253
  version_requirements: !ruby/object:Gem::Requirement
247
254
  requirements:
255
+ - - "~>"
256
+ - !ruby/object:Gem::Version
257
+ version: '1.6'
248
258
  - - ">="
249
259
  - !ruby/object:Gem::Version
250
- version: '0'
260
+ version: 1.6.3
251
261
  description: Generate API docs from your test suite
252
262
  email:
253
263
  - chris@smartlogicsolutions.com
@@ -282,6 +292,7 @@ files:
282
292
  - lib/rspec_api_documentation/views/markdown_index.rb
283
293
  - lib/rspec_api_documentation/views/markup_example.rb
284
294
  - lib/rspec_api_documentation/views/markup_index.rb
295
+ - lib/rspec_api_documentation/views/slate_example.rb
285
296
  - lib/rspec_api_documentation/views/textile_example.rb
286
297
  - lib/rspec_api_documentation/views/textile_index.rb
287
298
  - lib/rspec_api_documentation/writers/append_json_writer.rb
@@ -294,6 +305,7 @@ files:
294
305
  - lib/rspec_api_documentation/writers/json_iodocs_writer.rb
295
306
  - lib/rspec_api_documentation/writers/json_writer.rb
296
307
  - lib/rspec_api_documentation/writers/markdown_writer.rb
308
+ - lib/rspec_api_documentation/writers/slate_writer.rb
297
309
  - lib/rspec_api_documentation/writers/textile_writer.rb
298
310
  - lib/rspec_api_documentation/writers/writer.rb
299
311
  - lib/tasks/docs.rake
@@ -301,6 +313,7 @@ files:
301
313
  - templates/rspec_api_documentation/html_index.mustache
302
314
  - templates/rspec_api_documentation/markdown_example.mustache
303
315
  - templates/rspec_api_documentation/markdown_index.mustache
316
+ - templates/rspec_api_documentation/slate_example.mustache
304
317
  - templates/rspec_api_documentation/textile_example.mustache
305
318
  - templates/rspec_api_documentation/textile_index.mustache
306
319
  homepage: http://smartlogicsolutions.com
@@ -323,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
323
336
  version: 1.3.6
324
337
  requirements: []
325
338
  rubyforge_project:
326
- rubygems_version: 2.4.5
339
+ rubygems_version: 2.5.1
327
340
  signing_key:
328
341
  specification_version: 4
329
342
  summary: A double black belt for your docs