puppet_readme_generator 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/lib/puppet_readme_generator/version.rb +1 -1
- data/lib/puppet_readme_generator.rb +66 -27
- 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: 11ba11909aa54848a0b43a9909400c631663993d
|
4
|
+
data.tar.gz: 92ed07c0a6134e264f188bae8d70d7dddc4ae517
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a16d21bff53fa4a2e5af2840b817e254f1d0660d8e8b803278eb62bac34a5fa5a841e6870b5607b296de8d10782305e4b2d7aaca90c34a4720c9871a72e9efb
|
7
|
+
data.tar.gz: 53a750b20dfaf63ce7f3d47bacfbecb887252944f9e49a6c77fb90fee2d6721d3dde128c93d561ec5da4aeeb80bf6ddd61522e0a573d0a74620a47f719148c66
|
@@ -15,24 +15,44 @@ module PuppetReadmeGenerator
|
|
15
15
|
output = []
|
16
16
|
output << "# #{puppet_module}\n"
|
17
17
|
output << "#### Table of Contents\n"
|
18
|
-
output << '1. [Description](#description)'
|
19
|
-
output << '2. [Classes](#classes)'
|
20
|
-
output << '3. [Defined Types](#defined-types)'
|
21
18
|
|
22
|
-
|
23
|
-
output << main_class.text
|
24
|
-
output << ''
|
19
|
+
count = 1
|
25
20
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
unless main_class.nil?
|
22
|
+
output << "#{count}. [Description](#description)"
|
23
|
+
count += 1
|
24
|
+
end
|
25
|
+
|
26
|
+
if classes.length > 0
|
27
|
+
output << "#{count}. [Classes](#classes)"
|
28
|
+
count += 1
|
30
29
|
end
|
31
30
|
|
32
|
-
|
33
|
-
|
31
|
+
if defined_types.length > 0
|
32
|
+
output << "#{count}. [Defined Types](#defined-types)"
|
33
|
+
count += 1
|
34
|
+
end
|
35
|
+
|
36
|
+
unless main_class.nil?
|
37
|
+
output << '## Description'
|
38
|
+
output << main_class.text
|
34
39
|
output << ''
|
35
|
-
|
40
|
+
end
|
41
|
+
|
42
|
+
if classes.length > 0
|
43
|
+
output << '## Classes'
|
44
|
+
classes.each do |c|
|
45
|
+
output << ''
|
46
|
+
output << c.markdown
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
if defined_types.length > 0
|
51
|
+
output << '## DefinedTypes'
|
52
|
+
defined_types.each do |dt|
|
53
|
+
output << ''
|
54
|
+
output << dt.markdown
|
55
|
+
end
|
36
56
|
end
|
37
57
|
|
38
58
|
output.join("\n")
|
@@ -100,9 +120,12 @@ module PuppetReadmeGenerator
|
|
100
120
|
def examples
|
101
121
|
if @examples.nil?
|
102
122
|
@examples = []
|
103
|
-
|
104
|
-
|
105
|
-
|
123
|
+
begin
|
124
|
+
@c['docstring']['tags'].each do |t|
|
125
|
+
next unless t['tag_name'] == 'example'
|
126
|
+
@examples << Example.new(t, self)
|
127
|
+
end
|
128
|
+
rescue NoMethodError
|
106
129
|
end
|
107
130
|
end
|
108
131
|
@examples
|
@@ -111,9 +134,12 @@ module PuppetReadmeGenerator
|
|
111
134
|
def params
|
112
135
|
if @params.nil?
|
113
136
|
@params = []
|
114
|
-
|
115
|
-
|
116
|
-
|
137
|
+
begin
|
138
|
+
@c['docstring']['tags'].each do |t|
|
139
|
+
next unless t['tag_name'] == 'param'
|
140
|
+
@params << Param.new(t, self)
|
141
|
+
end
|
142
|
+
rescue NoMethodError
|
117
143
|
end
|
118
144
|
end
|
119
145
|
@params
|
@@ -125,14 +151,18 @@ module PuppetReadmeGenerator
|
|
125
151
|
output << text
|
126
152
|
output << ''
|
127
153
|
|
128
|
-
|
129
|
-
|
130
|
-
|
154
|
+
if params.length > 0
|
155
|
+
output << "#### Parameters\n"
|
156
|
+
params.each do |p|
|
157
|
+
output << p.markdown
|
158
|
+
end
|
131
159
|
end
|
132
160
|
|
133
|
-
|
134
|
-
|
135
|
-
|
161
|
+
if examples.length > 0
|
162
|
+
output << "#### Examples\n"
|
163
|
+
examples.each do |e|
|
164
|
+
output << e.markdown
|
165
|
+
end
|
136
166
|
end
|
137
167
|
|
138
168
|
output.join("\n")
|
@@ -158,8 +188,17 @@ module PuppetReadmeGenerator
|
|
158
188
|
def markdown
|
159
189
|
output = []
|
160
190
|
output << "##### `#{@t['name']}`\n"
|
161
|
-
|
162
|
-
|
191
|
+
|
192
|
+
if not @t['text'].nil? and @t['text'].length > 0
|
193
|
+
output << "* #{@t['text']}"
|
194
|
+
end
|
195
|
+
|
196
|
+
ptype = @t['types']
|
197
|
+
if not ptype.nil? and ptype.length > 1
|
198
|
+
output << "* Type: `#{ptype}`"
|
199
|
+
elsif not ptype.nil? and ptype.length == 1
|
200
|
+
output << "* Type: `#{ptype.first}`"
|
201
|
+
end
|
163
202
|
default = @p.defaults[@t['name']]
|
164
203
|
output << "* Default: `#{default}`" unless default.nil?
|
165
204
|
output << ''
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet_readme_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Simon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|