puppet-strings 1.2.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/CONTRIBUTING.md +3 -7
  4. data/JSON.md +126 -8
  5. data/README.md +16 -498
  6. data/lib/puppet-strings.rb +6 -0
  7. data/lib/puppet-strings/json.rb +2 -0
  8. data/lib/puppet-strings/markdown.rb +6 -1
  9. data/lib/puppet-strings/markdown/puppet_plan.rb +14 -0
  10. data/lib/puppet-strings/markdown/puppet_plans.rb +37 -0
  11. data/lib/puppet-strings/markdown/puppet_task.rb +24 -0
  12. data/lib/puppet-strings/markdown/puppet_tasks.rb +34 -0
  13. data/lib/puppet-strings/markdown/table_of_contents.rb +3 -1
  14. data/lib/puppet-strings/markdown/templates/classes_and_defines.erb +8 -5
  15. data/lib/puppet-strings/markdown/templates/function.erb +2 -3
  16. data/lib/puppet-strings/markdown/templates/puppet_task.erb +28 -0
  17. data/lib/puppet-strings/markdown/templates/resource_type.erb +9 -5
  18. data/lib/puppet-strings/markdown/templates/table_of_contents.erb +5 -0
  19. data/lib/puppet-strings/monkey_patches/display_object_command.rb +11 -0
  20. data/lib/puppet-strings/yard.rb +15 -1
  21. data/lib/puppet-strings/yard/code_objects.rb +2 -0
  22. data/lib/puppet-strings/yard/code_objects/plan.rb +56 -0
  23. data/lib/puppet-strings/yard/code_objects/task.rb +70 -0
  24. data/lib/puppet-strings/yard/handlers.rb +6 -0
  25. data/lib/puppet-strings/yard/handlers/json/base.rb +5 -0
  26. data/lib/puppet-strings/yard/handlers/json/task_handler.rb +31 -0
  27. data/lib/puppet-strings/yard/handlers/puppet/base.rb +1 -1
  28. data/lib/puppet-strings/yard/handlers/puppet/class_handler.rb +1 -1
  29. data/lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb +1 -1
  30. data/lib/puppet-strings/yard/handlers/puppet/function_handler.rb +1 -1
  31. data/lib/puppet-strings/yard/handlers/puppet/plan_handler.rb +27 -0
  32. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +4 -1
  33. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +12 -2
  34. data/lib/puppet-strings/yard/parsers.rb +4 -0
  35. data/lib/puppet-strings/yard/parsers/json/parser.rb +33 -0
  36. data/lib/puppet-strings/yard/parsers/json/task_statement.rb +35 -0
  37. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +11 -0
  38. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +14 -0
  39. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_plan.erb +9 -0
  40. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_task.erb +9 -0
  41. data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +18 -0
  42. data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +42 -2
  43. data/lib/puppet-strings/yard/templates/default/puppet_plan/html/box_info.erb +10 -0
  44. data/lib/puppet-strings/yard/templates/default/puppet_plan/html/header.erb +1 -0
  45. data/lib/puppet-strings/yard/templates/default/puppet_plan/html/overview.erb +6 -0
  46. data/lib/puppet-strings/yard/templates/default/puppet_plan/html/setup.rb +11 -0
  47. data/lib/puppet-strings/yard/templates/default/puppet_plan/html/source.erb +12 -0
  48. data/lib/puppet-strings/yard/templates/default/puppet_plan/html/summary.erb +4 -0
  49. data/lib/puppet-strings/yard/templates/default/puppet_task/html/box_info.erb +9 -0
  50. data/lib/puppet-strings/yard/templates/default/puppet_task/html/header.erb +1 -0
  51. data/lib/puppet-strings/yard/templates/default/puppet_task/html/input.erb +5 -0
  52. data/lib/puppet-strings/yard/templates/default/puppet_task/html/overview.erb +6 -0
  53. data/lib/puppet-strings/yard/templates/default/puppet_task/html/parameters.erb +16 -0
  54. data/lib/puppet-strings/yard/templates/default/puppet_task/html/setup.rb +22 -0
  55. data/lib/puppet-strings/yard/templates/default/puppet_task/html/supports_noop.erb +3 -0
  56. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +3 -1
  57. data/lib/puppet-strings/yard/util.rb +14 -0
  58. data/spec/fixtures/unit/json/output.json +50 -0
  59. data/spec/fixtures/unit/json/output_with_plan.json +689 -0
  60. data/spec/fixtures/unit/markdown/output.md +63 -8
  61. data/spec/fixtures/unit/markdown/output_with_plan.md +472 -0
  62. data/spec/spec_helper.rb +5 -2
  63. data/spec/unit/puppet-strings/json_spec.rb +42 -2
  64. data/spec/unit/puppet-strings/markdown_spec.rb +41 -8
  65. data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +92 -0
  66. data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +124 -0
  67. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +1 -1
  68. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +19 -12
  69. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +33 -0
  70. data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +8 -7
  71. data/spec/unit/puppet-strings/yard/parsers/json/parser_spec.rb +70 -0
  72. data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +56 -0
  73. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +1 -1
  74. data/spec/unit/puppet-strings/yard/util_spec.rb +17 -0
  75. metadata +38 -5
  76. data/MAINTAINERS +0 -17
@@ -1,20 +1,36 @@
1
1
  # Reference
2
+ <!-- DO NOT EDIT: This document was generated by Puppet Strings -->
2
3
 
3
4
  ## Classes
5
+
4
6
  ### Public Classes
7
+
5
8
  * [`klass`](#klass): A simple class.
9
+
6
10
  ### Private Classes
11
+
7
12
  * `noparams`: Overview for class noparams
13
+
8
14
  ## Defined types
15
+
9
16
  * [`klass::dt`](#klassdt): A simple defined type.
17
+
10
18
  ## Resource types
19
+
11
20
  * [`apt_key`](#apt_key): Example resource type using the new API.
12
21
  * [`database`](#database): An example database server type.
22
+
13
23
  ## Functions
24
+
14
25
  * [`func`](#func): A simple Puppet function.
15
26
  * [`func3x`](#func3x): Documentation for an example 3.x function.
16
27
  * [`func4x`](#func4x): An example 4.x function.
17
28
  * [`func4x_1`](#func4x_1): An example 4.x function with only one signature.
29
+
30
+ ## Tasks
31
+
32
+ * [`(stdin)`](#(stdin)): Allows you to backup your database to local file.
33
+
18
34
  ## Classes
19
35
 
20
36
  ### klass
@@ -26,9 +42,10 @@ An overview for a simple class.
26
42
  * **See also**
27
43
  www.puppet.com
28
44
 
29
-
30
45
  #### Examples
46
+
31
47
  ##### This is an example
48
+
32
49
  ```puppet
33
50
  class { 'klass':
34
51
  param1 => 1,
@@ -37,6 +54,7 @@ class { 'klass':
37
54
  ```
38
55
 
39
56
  ##### This is another example
57
+
40
58
  ```puppet
41
59
  class { 'klass':
42
60
  param1 => 1,
@@ -44,7 +62,6 @@ class { 'klass':
44
62
  }
45
63
  ```
46
64
 
47
-
48
65
  #### Parameters
49
66
 
50
67
  The following parameters are available in the `klass` class.
@@ -78,7 +95,6 @@ Third param.
78
95
 
79
96
  Default value: 'hi'
80
97
 
81
-
82
98
  ## Defined types
83
99
 
84
100
  ### klass::dt
@@ -90,9 +106,10 @@ An overview for a simple defined type.
90
106
  * **See also**
91
107
  www.puppet.com
92
108
 
93
-
94
109
  #### Examples
110
+
95
111
  ##### Here's an example of this type:
112
+
96
113
  ```puppet
97
114
  klass::dt { 'foo':
98
115
  param1 => 33,
@@ -100,7 +117,6 @@ klass::dt { 'foo':
100
117
  }
101
118
  ```
102
119
 
103
-
104
120
  #### Parameters
105
121
 
106
122
  The following parameters are available in the `klass::dt` defined type.
@@ -140,7 +156,6 @@ Fourth param.
140
156
 
141
157
  Default value: `true`
142
158
 
143
-
144
159
  ## Resource types
145
160
 
146
161
  ### apt_key
@@ -153,7 +168,9 @@ If Puppet is given the location of a key file which looks like an absolute
153
168
  path this type will autorequire that file.
154
169
 
155
170
  #### Examples
171
+
156
172
  ##### here's an example
173
+
157
174
  ```puppet
158
175
  apt_key { '6F6B15509CF8E59E6E469F327F438280EF8D349F':
159
176
  source => 'http://apt.puppetlabs.com/pubkey.gpg'
@@ -189,13 +206,14 @@ _*this data type contains a regex that may not be accurately reflected in genera
189
206
 
190
207
  The ID of the key you want to manage.
191
208
 
192
-
193
209
  ### database
194
210
 
195
211
  An example database server type.
196
212
 
197
213
  #### Examples
214
+
198
215
  ##### here's an example
216
+
199
217
  ```puppet
200
218
  database { 'foo':
201
219
  address => 'qux.baz.bar',
@@ -250,10 +268,10 @@ Whether or not to encrypt the database.
250
268
 
251
269
  Default value: `false`
252
270
 
253
-
254
271
  ## Functions
255
272
 
256
273
  ### func
274
+
257
275
  Type: Puppet Language
258
276
 
259
277
  A simple Puppet function.
@@ -290,6 +308,7 @@ Options:
290
308
  * **:param3opt** `Array`: Something about this option
291
309
 
292
310
  ### func3x
311
+
293
312
  Type: Ruby 3.x API
294
313
 
295
314
  Documentation for an example 3.x function.
@@ -313,6 +332,7 @@ Data type: `Integer`
313
332
  The second parameter.
314
333
 
315
334
  ### func4x
335
+
316
336
  Type: Ruby 4.x API
317
337
 
318
338
  An example 4.x function.
@@ -365,6 +385,7 @@ Data type: `Callable`
365
385
  The block parameter.
366
386
 
367
387
  ### func4x_1
388
+
368
389
  Type: Ruby 4.x API
369
390
 
370
391
  An example 4.x function with only one signature.
@@ -381,3 +402,37 @@ Data type: `Integer`
381
402
 
382
403
  The first parameter.
383
404
 
405
+ ## Tasks
406
+
407
+ ### (stdin)
408
+
409
+ Allows you to backup your database to local file.
410
+
411
+ **Supports noop?** false
412
+
413
+ #### Parameters
414
+
415
+ ##### `database`
416
+
417
+ Data type: `Optional[String[1]]`
418
+
419
+ Database to connect to
420
+
421
+ ##### `user`
422
+
423
+ Data type: `Optional[String[1]]`
424
+
425
+ The user
426
+
427
+ ##### `password`
428
+
429
+ Data type: `Optional[String[1]]`
430
+
431
+ The password
432
+
433
+ ##### `sql`
434
+
435
+ Data type: `String[1]`
436
+
437
+ Path to file you want backup to
438
+
@@ -0,0 +1,472 @@
1
+ # Reference
2
+ <!-- DO NOT EDIT: This document was generated by Puppet Strings -->
3
+
4
+ ## Classes
5
+
6
+ ### Public Classes
7
+
8
+ * [`klass`](#klass): A simple class.
9
+
10
+ ### Private Classes
11
+
12
+ * `noparams`: Overview for class noparams
13
+
14
+ ## Defined types
15
+
16
+ * [`klass::dt`](#klassdt): A simple defined type.
17
+
18
+ ## Resource types
19
+
20
+ * [`apt_key`](#apt_key): Example resource type using the new API.
21
+ * [`database`](#database): An example database server type.
22
+
23
+ ## Functions
24
+
25
+ * [`func`](#func): A simple Puppet function.
26
+ * [`func3x`](#func3x): Documentation for an example 3.x function.
27
+ * [`func4x`](#func4x): An example 4.x function.
28
+ * [`func4x_1`](#func4x_1): An example 4.x function with only one signature.
29
+
30
+ ## Tasks
31
+
32
+ * [`(stdin)`](#(stdin)): Allows you to backup your database to local file.
33
+
34
+ ## Plans
35
+
36
+ * [`plann`](#plann): A simple plan.
37
+
38
+ ## Classes
39
+
40
+ ### klass
41
+
42
+ An overview for a simple class.
43
+
44
+ * **Since** 1.0.0
45
+
46
+ * **See also**
47
+ www.puppet.com
48
+
49
+ #### Examples
50
+
51
+ ##### This is an example
52
+
53
+ ```puppet
54
+ class { 'klass':
55
+ param1 => 1,
56
+ param3 => 'foo',
57
+ }
58
+ ```
59
+
60
+ ##### This is another example
61
+
62
+ ```puppet
63
+ class { 'klass':
64
+ param1 => 1,
65
+ param3 => 'foo',
66
+ }
67
+ ```
68
+
69
+ #### Parameters
70
+
71
+ The following parameters are available in the `klass` class.
72
+
73
+ ##### `param1`
74
+
75
+ Data type: `Integer`
76
+
77
+ First param.
78
+
79
+ Default value: 1
80
+
81
+ ##### `param2`
82
+
83
+ Data type: `Any`
84
+
85
+ Second param.
86
+
87
+ Options:
88
+
89
+ * **:opt1** `String`: something about opt1
90
+ * **:opt2** `Hash`: a hash of stuff
91
+
92
+ Default value: `undef`
93
+
94
+ ##### `param3`
95
+
96
+ Data type: `String`
97
+
98
+ Third param.
99
+
100
+ Default value: 'hi'
101
+
102
+ ## Defined types
103
+
104
+ ### klass::dt
105
+
106
+ An overview for a simple defined type.
107
+
108
+ * **Since** 1.1.0
109
+
110
+ * **See also**
111
+ www.puppet.com
112
+
113
+ #### Examples
114
+
115
+ ##### Here's an example of this type:
116
+
117
+ ```puppet
118
+ klass::dt { 'foo':
119
+ param1 => 33,
120
+ param4 => false,
121
+ }
122
+ ```
123
+
124
+ #### Parameters
125
+
126
+ The following parameters are available in the `klass::dt` defined type.
127
+
128
+ ##### `param1`
129
+
130
+ Data type: `Integer`
131
+
132
+ First param.
133
+
134
+ Default value: 44
135
+
136
+ ##### `param2`
137
+
138
+ Data type: `Any`
139
+
140
+ Second param.
141
+
142
+ Options:
143
+
144
+ * **:opt1** `String`: something about opt1
145
+ * **:opt2** `Hash`: a hash of stuff
146
+
147
+ ##### `param3`
148
+
149
+ Data type: `String`
150
+
151
+ Third param.
152
+
153
+ Default value: 'hi'
154
+
155
+ ##### `param4`
156
+
157
+ Data type: `Boolean`
158
+
159
+ Fourth param.
160
+
161
+ Default value: `true`
162
+
163
+ ## Resource types
164
+
165
+ ### apt_key
166
+
167
+ This type provides Puppet with the capabilities to manage GPG keys needed
168
+ by apt to perform package validation. Apt has it's own GPG keyring that can
169
+ be manipulated through the `apt-key` command.
170
+ **Autorequires**:
171
+ If Puppet is given the location of a key file which looks like an absolute
172
+ path this type will autorequire that file.
173
+
174
+ #### Examples
175
+
176
+ ##### here's an example
177
+
178
+ ```puppet
179
+ apt_key { '6F6B15509CF8E59E6E469F327F438280EF8D349F':
180
+ source => 'http://apt.puppetlabs.com/pubkey.gpg'
181
+ }
182
+ ```
183
+
184
+ #### Properties
185
+
186
+ The following properties are available in the `apt_key` type.
187
+
188
+ ##### `ensure`
189
+
190
+ Data type: `Enum[present, absent]`
191
+
192
+ Whether this apt key should be present or absent on the target system.
193
+
194
+ ##### `created`
195
+
196
+ Data type: `String`
197
+
198
+ Date the key was created, in ISO format.
199
+
200
+ #### Parameters
201
+
202
+ The following parameters are available in the `apt_key` type.
203
+
204
+ ##### `id`
205
+
206
+ namevar
207
+
208
+ Data type: `Variant[Pattern[/A(0x)?[0-9a-fA-F]{8}Z/], Pattern[/A(0x)?[0-9a-fA-F]{16}Z/], Pattern[/A(0x)?[0-9a-fA-F]{40}Z/]]`
209
+ _*this data type contains a regex that may not be accurately reflected in generated documentation_
210
+
211
+ The ID of the key you want to manage.
212
+
213
+ ### database
214
+
215
+ An example database server type.
216
+
217
+ #### Examples
218
+
219
+ ##### here's an example
220
+
221
+ ```puppet
222
+ database { 'foo':
223
+ address => 'qux.baz.bar',
224
+ }
225
+ ```
226
+
227
+ #### Properties
228
+
229
+ The following properties are available in the `database` type.
230
+
231
+ ##### `ensure`
232
+
233
+ Valid values: present, absent, up, down
234
+
235
+ Aliases: "up"=>"present", "down"=>"absent"
236
+
237
+ What state the database should be in.
238
+
239
+ Default value: up
240
+
241
+ ##### `file`
242
+
243
+ The database file to use.
244
+
245
+ ##### `log_level`
246
+
247
+ Valid values: debug, warn, error
248
+
249
+ The log level to use.
250
+
251
+ Default value: warn
252
+
253
+ #### Parameters
254
+
255
+ The following parameters are available in the `database` type.
256
+
257
+ ##### `address`
258
+
259
+ namevar
260
+
261
+ The database server name.
262
+
263
+ ##### `encryption_key`
264
+
265
+ The encryption key to use.
266
+
267
+ ##### `encrypt`
268
+
269
+ Valid values: `true`, `false`, yes, no
270
+
271
+ Whether or not to encrypt the database.
272
+
273
+ Default value: `false`
274
+
275
+ ## Functions
276
+
277
+ ### func
278
+
279
+ Type: Puppet Language
280
+
281
+ A simple Puppet function.
282
+
283
+ #### `func(Integer $param1, Any $param2, String $param3 = hi)`
284
+
285
+ A simple Puppet function.
286
+
287
+ Returns: `Undef` Returns nothing.
288
+
289
+ Raises:
290
+ * `SomeError` this is some error
291
+
292
+ ##### `param1`
293
+
294
+ Data type: `Integer`
295
+
296
+ First param.
297
+
298
+ ##### `param2`
299
+
300
+ Data type: `Any`
301
+
302
+ Second param.
303
+
304
+ ##### `param3`
305
+
306
+ Data type: `String`
307
+
308
+ Third param.
309
+
310
+ Options:
311
+
312
+ * **:param3opt** `Array`: Something about this option
313
+
314
+ ### func3x
315
+
316
+ Type: Ruby 3.x API
317
+
318
+ Documentation for an example 3.x function.
319
+
320
+ #### `func3x(String $param1, Integer $param2)`
321
+
322
+ Documentation for an example 3.x function.
323
+
324
+ Returns: `Undef`
325
+
326
+ ##### `param1`
327
+
328
+ Data type: `String`
329
+
330
+ The first parameter.
331
+
332
+ ##### `param2`
333
+
334
+ Data type: `Integer`
335
+
336
+ The second parameter.
337
+
338
+ ### func4x
339
+
340
+ Type: Ruby 4.x API
341
+
342
+ An example 4.x function.
343
+
344
+ #### `func4x(Integer $param1, Any $param2, Optional[Array[String]] $param3)`
345
+
346
+ An overview for the first overload.
347
+
348
+ Returns: `Undef` Returns nothing.
349
+
350
+ ##### `param1`
351
+
352
+ Data type: `Integer`
353
+
354
+ The first parameter.
355
+
356
+ ##### `param2`
357
+
358
+ Data type: `Any`
359
+
360
+ The second parameter.
361
+
362
+ Options:
363
+
364
+ * **:option** `String`: an option
365
+ * **:option2** `String`: another option
366
+
367
+ ##### `param3`
368
+
369
+ Data type: `Optional[Array[String]]`
370
+
371
+ The third parameter.
372
+
373
+ #### `func4x(Boolean $param, Callable &$block)`
374
+
375
+ An overview for the second overload.
376
+
377
+ Returns: `String` Returns a string.
378
+
379
+ ##### `param`
380
+
381
+ Data type: `Boolean`
382
+
383
+ The first parameter.
384
+
385
+ ##### `&block`
386
+
387
+ Data type: `Callable`
388
+
389
+ The block parameter.
390
+
391
+ ### func4x_1
392
+
393
+ Type: Ruby 4.x API
394
+
395
+ An example 4.x function with only one signature.
396
+
397
+ #### `func4x_1(Integer $param1)`
398
+
399
+ An example 4.x function with only one signature.
400
+
401
+ Returns: `Undef` Returns nothing.
402
+
403
+ ##### `param1`
404
+
405
+ Data type: `Integer`
406
+
407
+ The first parameter.
408
+
409
+ ## Tasks
410
+
411
+ ### (stdin)
412
+
413
+ Allows you to backup your database to local file.
414
+
415
+ **Supports noop?** false
416
+
417
+ #### Parameters
418
+
419
+ ##### `database`
420
+
421
+ Data type: `Optional[String[1]]`
422
+
423
+ Database to connect to
424
+
425
+ ##### `user`
426
+
427
+ Data type: `Optional[String[1]]`
428
+
429
+ The user
430
+
431
+ ##### `password`
432
+
433
+ Data type: `Optional[String[1]]`
434
+
435
+ The password
436
+
437
+ ##### `sql`
438
+
439
+ Data type: `String[1]`
440
+
441
+ Path to file you want backup to
442
+
443
+ ## Plans
444
+
445
+ ### plann
446
+
447
+ A simple plan.
448
+
449
+ #### Parameters
450
+
451
+ The following parameters are available in the `plann` plan.
452
+
453
+ ##### `param1`
454
+
455
+ Data type: `String`
456
+
457
+ First param.
458
+
459
+ ##### `param2`
460
+
461
+ Data type: `Any`
462
+
463
+ Second param.
464
+
465
+ ##### `param3`
466
+
467
+ Data type: `Integer`
468
+
469
+ Third param.
470
+
471
+ Default value: 1
472
+