dox 1.3.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +6 -3
- data/.ruby-version +1 -1
- data/.travis.yml +7 -11
- data/CHANGES.md +19 -1
- data/Gemfile +1 -1
- data/README.md +109 -124
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/dox.gemspec +14 -13
- data/lib/dox.rb +9 -1
- data/lib/dox/config.rb +39 -5
- data/lib/dox/dsl/action.rb +10 -4
- data/lib/dox/dsl/documentation.rb +4 -0
- data/lib/dox/dsl/resource.rb +0 -2
- data/lib/dox/dsl/syntax.rb +1 -0
- data/lib/dox/entities/action.rb +33 -13
- data/lib/dox/entities/example.rb +11 -1
- data/lib/dox/entities/resource.rb +4 -6
- data/lib/dox/entities/resource_group.rb +2 -3
- data/lib/dox/formatter.rb +10 -11
- data/lib/dox/formatters/multipart.rb +2 -0
- data/lib/dox/formatters/plain.rb +5 -1
- data/lib/dox/printers/action_printer.rb +18 -27
- data/lib/dox/printers/base_printer.rb +36 -17
- data/lib/dox/printers/document_printer.rb +37 -7
- data/lib/dox/printers/example_request_printer.rb +69 -0
- data/lib/dox/printers/example_response_printer.rb +86 -0
- data/lib/dox/printers/resource_group_printer.rb +7 -7
- data/lib/dox/printers/resource_printer.rb +12 -7
- data/lib/dox/util/http.rb +64 -0
- data/lib/dox/version.rb +1 -1
- metadata +78 -21
- data/lib/dox/printers/example_printer.rb +0 -100
data/lib/dox/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Melita Kokot
|
@@ -29,46 +29,46 @@ dependencies:
|
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: codeclimate-test-reporter
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: json
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - "
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
|
-
name: pry
|
71
|
+
name: pry-nav
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - ">="
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
85
|
+
name: pry-rails
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - ">="
|
@@ -96,7 +96,63 @@ dependencies:
|
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
|
-
name:
|
99
|
+
name: pry-stack_explorer
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rake
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rspec
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '3.0'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '3.0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: rubocop
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: simplecov
|
100
156
|
requirement: !ruby/object:Gem::Requirement
|
101
157
|
requirements:
|
102
158
|
- - ">="
|
@@ -174,7 +230,8 @@ files:
|
|
174
230
|
- lib/dox/printers/action_printer.rb
|
175
231
|
- lib/dox/printers/base_printer.rb
|
176
232
|
- lib/dox/printers/document_printer.rb
|
177
|
-
- lib/dox/printers/
|
233
|
+
- lib/dox/printers/example_request_printer.rb
|
234
|
+
- lib/dox/printers/example_response_printer.rb
|
178
235
|
- lib/dox/printers/resource_group_printer.rb
|
179
236
|
- lib/dox/printers/resource_printer.rb
|
180
237
|
- lib/dox/util/http.rb
|
@@ -200,8 +257,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
257
|
version: '0'
|
201
258
|
requirements: []
|
202
259
|
rubyforge_project:
|
203
|
-
rubygems_version: 2.
|
260
|
+
rubygems_version: 2.7.6.2
|
204
261
|
signing_key:
|
205
262
|
specification_version: 4
|
206
|
-
summary: Generates API documentation for rspec in
|
263
|
+
summary: Generates API documentation for rspec in OpenAPI format.
|
207
264
|
test_files: []
|
@@ -1,100 +0,0 @@
|
|
1
|
-
require 'rexml/document'
|
2
|
-
|
3
|
-
module Dox
|
4
|
-
module Printers
|
5
|
-
class ExamplePrinter < BasePrinter
|
6
|
-
def print(example)
|
7
|
-
self.example = example
|
8
|
-
print_example_request
|
9
|
-
print_example_response
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
attr_accessor :example
|
15
|
-
|
16
|
-
def print_example_request
|
17
|
-
@output.puts example_request_title
|
18
|
-
@output.puts example_request_headers
|
19
|
-
return unless example.request_body.present?
|
20
|
-
|
21
|
-
@output.puts example_request_body
|
22
|
-
end
|
23
|
-
|
24
|
-
def print_example_response
|
25
|
-
@output.puts example_response_title
|
26
|
-
|
27
|
-
if example.response_headers.present?
|
28
|
-
@output.puts example_response_headers
|
29
|
-
end
|
30
|
-
|
31
|
-
return unless example.response_body.present?
|
32
|
-
@output.puts example_response_body
|
33
|
-
end
|
34
|
-
|
35
|
-
def example_request_title
|
36
|
-
<<-HEREDOC
|
37
|
-
|
38
|
-
+ Request #{example.request_identifier}
|
39
|
-
**#{example.request_method.upcase}** `#{CGI.unescape(example.request_fullpath)}`
|
40
|
-
HEREDOC
|
41
|
-
end
|
42
|
-
|
43
|
-
def example_request_headers
|
44
|
-
<<-HEREDOC
|
45
|
-
|
46
|
-
+ Headers
|
47
|
-
|
48
|
-
#{indent_lines(12, print_headers(example.request_headers))}
|
49
|
-
HEREDOC
|
50
|
-
end
|
51
|
-
|
52
|
-
def example_request_body
|
53
|
-
<<-HEREDOC
|
54
|
-
|
55
|
-
+ Body
|
56
|
-
|
57
|
-
#{indent_lines(12, example.request_body)}
|
58
|
-
HEREDOC
|
59
|
-
end
|
60
|
-
|
61
|
-
def example_response_title
|
62
|
-
<<-HEREDOC
|
63
|
-
|
64
|
-
+ Response #{example.response_status}
|
65
|
-
HEREDOC
|
66
|
-
end
|
67
|
-
|
68
|
-
def example_response_headers
|
69
|
-
<<-HEREDOC
|
70
|
-
|
71
|
-
+ Headers
|
72
|
-
|
73
|
-
#{indent_lines(12, print_headers(example.response_headers))}
|
74
|
-
HEREDOC
|
75
|
-
end
|
76
|
-
|
77
|
-
def example_response_body
|
78
|
-
<<-HEREDOC
|
79
|
-
|
80
|
-
+ Body
|
81
|
-
|
82
|
-
#{indent_lines(12, example.response_body)}
|
83
|
-
HEREDOC
|
84
|
-
end
|
85
|
-
|
86
|
-
def print_headers(headers)
|
87
|
-
headers.map do |key, value|
|
88
|
-
"#{key}: #{value}"
|
89
|
-
end.join("\n")
|
90
|
-
end
|
91
|
-
|
92
|
-
def indent_lines(number_of_spaces, string)
|
93
|
-
string
|
94
|
-
.split("\n")
|
95
|
-
.map { |a| a.prepend(' ' * number_of_spaces) }
|
96
|
-
.join("\n")
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|