droutes 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/droutes/documentation_generator.rb +23 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9ee275f75f3f7d41c1ca47ff00d5e21374f00c0
|
4
|
+
data.tar.gz: 8f7a4017c5547d13e72ea09cc10efb4d1feba0e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7a35a2e01f9966a7b82105f7e47f68f54a45bb3dbde6fda2885b50db0a05ac78ea6f0b5fa8f4e8f2d40c6d106dcd7bef8b21dca889385e0b3c4f9853123ac13
|
7
|
+
data.tar.gz: 14aaced7ffabc0cf9fffcf29c5887009eea4d1bc0992b18812d8414ae84f9b97b3f532e1db50f77bf7f1f0a13e6b509fdd1b5332605078f05188f980b0bacda3
|
@@ -107,12 +107,34 @@ DOC
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def comments_doc(doc)
|
110
|
+
params_dl = '<dl class="dl-horizontal params">'
|
111
|
+
example_json = ''
|
112
|
+
doc.tags("param").each do |param|
|
113
|
+
params_dl += " <dt>#{param.name}</dt><dd>[#{param.types.join('|')}] #{param.text}</dd>"
|
114
|
+
eg_param = param.types.first
|
115
|
+
eg_text = if ["String", "Symbol"].include?(eg_param)
|
116
|
+
'"some string"'
|
117
|
+
elsif ["Fixnum", "Integer", "Int"].include?(eg_param)
|
118
|
+
rand(100)
|
119
|
+
elsif ["Float", "Double", "Numeric"].include?(eg_param)
|
120
|
+
(rand * 100.0).round(2)
|
121
|
+
elsif eg_param == "Hash"
|
122
|
+
'{}'
|
123
|
+
elsif eg_param == "Arrray"
|
124
|
+
'[]'
|
125
|
+
end
|
126
|
+
example_json += "\n \"#{param.name}\": #{eg_text},"
|
127
|
+
end
|
128
|
+
unless example_json.blank?
|
129
|
+
example_json = "<p>Example JSON Body</p><pre><code>{#{example_json}\n}</code></pre>"
|
130
|
+
end
|
110
131
|
<<DOC
|
111
132
|
<p class="summary">#{doc.summary}</p>
|
112
133
|
<dl class="dl-horizontal params">
|
113
|
-
#{
|
134
|
+
#{params_dl}
|
114
135
|
#{(ret = doc.tags("return").first) and "<dt>[return]</dt><dd>#{ret.text}</dd>"}
|
115
136
|
</dl>
|
137
|
+
#{example_json}
|
116
138
|
DOC
|
117
139
|
end
|
118
140
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: droutes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Margison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Generating documentation for REST endpoints for client developers can
|
14
14
|
be a pain, but droutes can make it easy.
|