puppet-strings 2.1.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -4
  3. data/CONTRIBUTING.md +32 -2
  4. data/README.md +81 -17
  5. data/lib/puppet-strings.rb +13 -4
  6. data/lib/puppet-strings/describe.rb +68 -0
  7. data/lib/puppet-strings/json.rb +2 -38
  8. data/lib/puppet-strings/markdown.rb +3 -1
  9. data/lib/puppet-strings/markdown/base.rb +37 -16
  10. data/lib/puppet-strings/markdown/data_type.rb +34 -0
  11. data/lib/puppet-strings/markdown/data_types.rb +41 -0
  12. data/lib/puppet-strings/markdown/function.rb +2 -2
  13. data/lib/puppet-strings/markdown/resource_type.rb +19 -2
  14. data/lib/puppet-strings/markdown/table_of_contents.rb +1 -0
  15. data/lib/puppet-strings/markdown/templates/classes_and_defines.erb +12 -4
  16. data/lib/puppet-strings/markdown/templates/data_type.erb +93 -0
  17. data/lib/puppet-strings/markdown/templates/data_type_function.erb +67 -0
  18. data/lib/puppet-strings/markdown/templates/function.erb +36 -1
  19. data/lib/puppet-strings/markdown/templates/puppet_task.erb +1 -1
  20. data/lib/puppet-strings/markdown/templates/resource_type.erb +32 -12
  21. data/lib/puppet-strings/markdown/templates/table_of_contents.erb +6 -6
  22. data/lib/puppet-strings/tasks/generate.rb +10 -3
  23. data/lib/puppet-strings/version.rb +1 -1
  24. data/lib/puppet-strings/yard.rb +16 -0
  25. data/lib/puppet-strings/yard/code_objects.rb +2 -0
  26. data/lib/puppet-strings/yard/code_objects/class.rb +2 -2
  27. data/lib/puppet-strings/yard/code_objects/data_type.rb +100 -0
  28. data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +58 -0
  29. data/lib/puppet-strings/yard/code_objects/defined_type.rb +2 -2
  30. data/lib/puppet-strings/yard/code_objects/function.rb +4 -4
  31. data/lib/puppet-strings/yard/code_objects/plan.rb +2 -2
  32. data/lib/puppet-strings/yard/code_objects/provider.rb +1 -1
  33. data/lib/puppet-strings/yard/code_objects/task.rb +1 -1
  34. data/lib/puppet-strings/yard/code_objects/type.rb +48 -6
  35. data/lib/puppet-strings/yard/handlers.rb +3 -0
  36. data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +24 -0
  37. data/lib/puppet-strings/yard/handlers/ruby/base.rb +12 -1
  38. data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +393 -0
  39. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +2 -12
  40. data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +1 -9
  41. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +3 -3
  42. data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +135 -0
  43. data/lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb +56 -0
  44. data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +9 -115
  45. data/lib/puppet-strings/yard/parsers/json/parser.rb +4 -2
  46. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +14 -7
  47. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +25 -0
  48. data/lib/puppet-strings/yard/tags.rb +2 -0
  49. data/lib/puppet-strings/yard/tags/enum_tag.rb +12 -0
  50. data/lib/puppet-strings/yard/tags/factory.rb +16 -0
  51. data/lib/puppet-strings/yard/tags/overload_tag.rb +2 -2
  52. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_data_type.erb +10 -0
  53. data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +9 -0
  54. data/lib/puppet-strings/yard/templates/default/layout/html/objects.erb +2 -0
  55. data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +18 -1
  56. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/box_info.erb +10 -0
  57. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/header.erb +1 -0
  58. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/method_details_list.erb +6 -0
  59. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/note.erb +6 -0
  60. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/overview.erb +6 -0
  61. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb +13 -0
  62. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/source.erb +12 -0
  63. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/summary.erb +4 -0
  64. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/todo.erb +6 -0
  65. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/alias_of.erb +10 -0
  66. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/box_info.erb +10 -0
  67. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/header.erb +1 -0
  68. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/note.erb +6 -0
  69. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/overview.erb +6 -0
  70. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb +17 -0
  71. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/source.erb +12 -0
  72. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/summary.erb +4 -0
  73. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/todo.erb +6 -0
  74. data/lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb +3 -1
  75. data/lib/puppet-strings/yard/templates/default/tags/html/enum.erb +17 -0
  76. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +7 -0
  77. data/lib/puppet-strings/yard/util.rb +48 -0
  78. data/lib/puppet/face/strings.rb +68 -3
  79. metadata +36 -45
  80. data/Gemfile +0 -37
  81. data/HISTORY.md +0 -218
  82. data/JSON.md +0 -802
  83. data/Rakefile +0 -93
  84. data/codecov.yml +0 -3
  85. data/misc/ANNOUNCEMENT_TEMPLATE.md +0 -40
  86. data/spec/acceptance/emit_json_options.rb +0 -71
  87. data/spec/acceptance/generate_markdown_spec.rb +0 -49
  88. data/spec/acceptance/lib/util.rb +0 -163
  89. data/spec/acceptance/running_strings_generate.rb +0 -54
  90. data/spec/fixtures/acceptance/modules/test/functions/add.pp +0 -9
  91. data/spec/fixtures/acceptance/modules/test/lib/puppet/functions/4x_function.rb +0 -5
  92. data/spec/fixtures/acceptance/modules/test/lib/puppet/parser/functions/function3x.rb +0 -2
  93. data/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb +0 -9
  94. data/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb +0 -15
  95. data/spec/fixtures/acceptance/modules/test/manifests/init.pp +0 -27
  96. data/spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp +0 -27
  97. data/spec/fixtures/acceptance/modules/test/metadata.json +0 -6
  98. data/spec/fixtures/unit/json/output.json +0 -660
  99. data/spec/fixtures/unit/json/output_with_plan.json +0 -697
  100. data/spec/fixtures/unit/json/output_without_puppet_function.json +0 -480
  101. data/spec/fixtures/unit/markdown/output.md +0 -444
  102. data/spec/fixtures/unit/markdown/output_with_plan.md +0 -478
  103. data/spec/spec_helper.rb +0 -45
  104. data/spec/spec_helper_acceptance.rb +0 -28
  105. data/spec/unit/puppet-strings/json_spec.rb +0 -229
  106. data/spec/unit/puppet-strings/markdown/base_spec.rb +0 -146
  107. data/spec/unit/puppet-strings/markdown_spec.rb +0 -283
  108. data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +0 -92
  109. data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +0 -124
  110. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +0 -217
  111. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +0 -231
  112. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +0 -315
  113. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +0 -729
  114. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +0 -139
  115. data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +0 -214
  116. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +0 -269
  117. data/spec/unit/puppet-strings/yard/parsers/json/parser_spec.rb +0 -70
  118. data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +0 -56
  119. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +0 -209
  120. data/spec/unit/puppet-strings/yard/util_spec.rb +0 -48
@@ -1,480 +0,0 @@
1
- {
2
- "puppet_classes": [
3
- {
4
- "name": "klass",
5
- "file": "(stdin)",
6
- "line": 5,
7
- "inherits": "foo::bar",
8
- "docstring": {
9
- "text": "A simple class.",
10
- "tags": [
11
- {
12
- "tag_name": "todo",
13
- "text": "Do a thing"
14
- },
15
- {
16
- "tag_name": "note",
17
- "text": "Some note"
18
- },
19
- {
20
- "tag_name": "param",
21
- "text": "First param.",
22
- "types": [
23
- "Integer"
24
- ],
25
- "name": "param1"
26
- },
27
- {
28
- "tag_name": "param",
29
- "text": "Second param.",
30
- "types": [
31
- "Any"
32
- ],
33
- "name": "param2"
34
- },
35
- {
36
- "tag_name": "param",
37
- "text": "Third param.",
38
- "types": [
39
- "String"
40
- ],
41
- "name": "param3"
42
- }
43
- ]
44
- },
45
- "defaults": {
46
- "param3": "hi"
47
- },
48
- "source": "class klass(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {\n}"
49
- }
50
- ],
51
- "defined_types": [
52
- {
53
- "name": "dt",
54
- "file": "(stdin)",
55
- "line": 12,
56
- "docstring": {
57
- "text": "A simple defined type.",
58
- "tags": [
59
- {
60
- "tag_name": "param",
61
- "text": "First param.",
62
- "types": [
63
- "Integer"
64
- ],
65
- "name": "param1"
66
- },
67
- {
68
- "tag_name": "param",
69
- "text": "Second param.",
70
- "types": [
71
- "Any"
72
- ],
73
- "name": "param2"
74
- },
75
- {
76
- "tag_name": "param",
77
- "text": "Third param.",
78
- "types": [
79
- "String"
80
- ],
81
- "name": "param3"
82
- }
83
- ]
84
- },
85
- "defaults": {
86
- "param3": "hi"
87
- },
88
- "source": "define dt(Integer $param1, $param2, String $param3 = hi) {\n}"
89
- }
90
- ],
91
- "resource_types": [
92
- {
93
- "name": "database",
94
- "file": "(stdin)",
95
- "line": 54,
96
- "docstring": {
97
- "text": "An example database server resource type."
98
- },
99
- "properties": [
100
- {
101
- "name": "ensure",
102
- "description": "What state the database should be in.",
103
- "values": [
104
- "present",
105
- "absent",
106
- "up",
107
- "down"
108
- ],
109
- "aliases": {
110
- "up": "present",
111
- "down": "absent"
112
- },
113
- "default": "up"
114
- },
115
- {
116
- "name": "file",
117
- "description": "The database file to use."
118
- },
119
- {
120
- "name": "log_level",
121
- "description": "The log level to use.",
122
- "values": [
123
- "debug",
124
- "warn",
125
- "error"
126
- ],
127
- "default": "warn"
128
- }
129
- ],
130
- "parameters": [
131
- {
132
- "name": "address",
133
- "description": "The database server name.",
134
- "isnamevar": true
135
- },
136
- {
137
- "name": "encryption_key",
138
- "description": "The encryption key to use."
139
- },
140
- {
141
- "name": "encrypt",
142
- "description": "Whether or not to encrypt the database.",
143
- "values": [
144
- "true",
145
- "false",
146
- "yes",
147
- "no"
148
- ],
149
- "default": "false"
150
- }
151
- ],
152
- "features": [
153
- {
154
- "name": "encryption",
155
- "description": "The provider supports encryption."
156
- }
157
- ]
158
- }
159
- ],
160
- "providers": [
161
- {
162
- "name": "linux",
163
- "type_name": "database",
164
- "file": "(stdin)",
165
- "line": 43,
166
- "docstring": {
167
- "text": "An example provider on Linux."
168
- },
169
- "confines": {
170
- "kernel": "Linux",
171
- "osfamily": "RedHat"
172
- },
173
- "features": [
174
- "implements_some_feature",
175
- "some_other_feature"
176
- ],
177
- "defaults": [
178
- [
179
- [
180
- "kernel",
181
- "Linux"
182
- ]
183
- ],
184
- [
185
- [
186
- "osfamily",
187
- "RedHat"
188
- ],
189
- [
190
- "operatingsystemmajrelease",
191
- "7"
192
- ]
193
- ]
194
- ],
195
- "commands": {
196
- "foo": "/usr/bin/foo"
197
- }
198
- }
199
- ],
200
- "puppet_functions": [
201
- {
202
- "name": "func3x",
203
- "file": "(stdin)",
204
- "line": 1,
205
- "type": "ruby3x",
206
- "signatures": [
207
- {
208
- "signature": "func3x(String $first, Any $second)",
209
- "docstring": {
210
- "text": "An example 3.x function.",
211
- "tags": [
212
- {
213
- "tag_name": "param",
214
- "text": "The first parameter.",
215
- "types": [
216
- "String"
217
- ],
218
- "name": "first"
219
- },
220
- {
221
- "tag_name": "param",
222
- "text": "The second parameter.",
223
- "types": [
224
- "Any"
225
- ],
226
- "name": "second"
227
- },
228
- {
229
- "tag_name": "return",
230
- "text": "Returns nothing.",
231
- "types": [
232
- "Undef"
233
- ]
234
- }
235
- ]
236
- }
237
- }
238
- ],
239
- "docstring": {
240
- "text": "An example 3.x function.",
241
- "tags": [
242
- {
243
- "tag_name": "param",
244
- "text": "The first parameter.",
245
- "types": [
246
- "String"
247
- ],
248
- "name": "first"
249
- },
250
- {
251
- "tag_name": "param",
252
- "text": "The second parameter.",
253
- "types": [
254
- "Any"
255
- ],
256
- "name": "second"
257
- },
258
- {
259
- "tag_name": "return",
260
- "text": "Returns nothing.",
261
- "types": [
262
- "Undef"
263
- ]
264
- }
265
- ]
266
- },
267
- "source": "Puppet::Parser::Functions.newfunction(:func3x, doc: <<-DOC\nAn example 3.x function.\n@param [String] first The first parameter.\n@param second The second parameter.\n@return [Undef] Returns nothing.\nDOC\n) do |*args|\nend"
268
- },
269
- {
270
- "name": "func4x",
271
- "file": "(stdin)",
272
- "line": 11,
273
- "type": "ruby4x",
274
- "signatures": [
275
- {
276
- "signature": "func4x(Integer $param1, Any $param2, Optional[Array[String]] $param3)",
277
- "docstring": {
278
- "text": "The first overload.",
279
- "tags": [
280
- {
281
- "tag_name": "param",
282
- "text": "The first parameter.",
283
- "types": [
284
- "Integer"
285
- ],
286
- "name": "param1"
287
- },
288
- {
289
- "tag_name": "param",
290
- "text": "The second parameter.",
291
- "types": [
292
- "Any"
293
- ],
294
- "name": "param2"
295
- },
296
- {
297
- "tag_name": "param",
298
- "text": "The third parameter.",
299
- "types": [
300
- "Optional[Array[String]]"
301
- ],
302
- "name": "param3"
303
- },
304
- {
305
- "tag_name": "return",
306
- "text": "Returns nothing.",
307
- "types": [
308
- "Undef"
309
- ]
310
- }
311
- ]
312
- }
313
- },
314
- {
315
- "signature": "func4x(Boolean $param, Callable &$block)",
316
- "docstring": {
317
- "text": "",
318
- "tags": [
319
- {
320
- "tag_name": "param",
321
- "text": "The first parameter.",
322
- "types": [
323
- "Boolean"
324
- ],
325
- "name": "param"
326
- },
327
- {
328
- "tag_name": "param",
329
- "text": "The block parameter.",
330
- "types": [
331
- "Callable"
332
- ],
333
- "name": "&block"
334
- },
335
- {
336
- "tag_name": "return",
337
- "text": "Returns a string.",
338
- "types": [
339
- "String"
340
- ]
341
- }
342
- ]
343
- }
344
- }
345
- ],
346
- "docstring": {
347
- "text": "An example 4.x function.",
348
- "tags": [
349
- {
350
- "tag_name": "overload",
351
- "signature": "func4x(Integer $param1, Any $param2, Optional[Array[String]] $param3)",
352
- "docstring": {
353
- "text": "The first overload.",
354
- "tags": [
355
- {
356
- "tag_name": "param",
357
- "text": "The first parameter.",
358
- "types": [
359
- "Integer"
360
- ],
361
- "name": "param1"
362
- },
363
- {
364
- "tag_name": "param",
365
- "text": "The second parameter.",
366
- "types": [
367
- "Any"
368
- ],
369
- "name": "param2"
370
- },
371
- {
372
- "tag_name": "param",
373
- "text": "The third parameter.",
374
- "types": [
375
- "Optional[Array[String]]"
376
- ],
377
- "name": "param3"
378
- },
379
- {
380
- "tag_name": "return",
381
- "text": "Returns nothing.",
382
- "types": [
383
- "Undef"
384
- ]
385
- }
386
- ]
387
- },
388
- "name": "func4x"
389
- },
390
- {
391
- "tag_name": "overload",
392
- "signature": "func4x(Boolean $param, Callable &$block)",
393
- "docstring": {
394
- "text": "",
395
- "tags": [
396
- {
397
- "tag_name": "param",
398
- "text": "The first parameter.",
399
- "types": [
400
- "Boolean"
401
- ],
402
- "name": "param"
403
- },
404
- {
405
- "tag_name": "param",
406
- "text": "The block parameter.",
407
- "types": [
408
- "Callable"
409
- ],
410
- "name": "&block"
411
- },
412
- {
413
- "tag_name": "return",
414
- "text": "Returns a string.",
415
- "types": [
416
- "String"
417
- ]
418
- }
419
- ]
420
- },
421
- "name": "func4x"
422
- }
423
- ]
424
- },
425
- "source": "Puppet::Functions.create_function(:func4x) do\n # The first overload.\n # @param param1 The first parameter.\n # @param param2 The second parameter.\n # @param param3 The third parameter.\n # @return Returns nothing.\n dispatch :foo do\n param 'Integer', :param1\n param 'Any', :param2\n optional_param 'Array[String]', :param3\n return_type 'Undef'\n end\n\n # @param param The first parameter.\n # @param block The block parameter.\n # @return Returns a string.\n dispatch :other do\n param 'Boolean', :param\n block_param\n return_type 'String'\n end\nend"
426
- },
427
- {
428
- "name": "func4x_1",
429
- "file": "(stdin)",
430
- "line": 35,
431
- "type": "ruby4x",
432
- "signatures": [
433
- {
434
- "signature": "func4x_1(Integer $param1)",
435
- "docstring": {
436
- "text": "An example 4.x function with only one signature.",
437
- "tags": [
438
- {
439
- "tag_name": "param",
440
- "text": "The first parameter.",
441
- "types": [
442
- "Integer"
443
- ],
444
- "name": "param1"
445
- },
446
- {
447
- "tag_name": "return",
448
- "text": "Returns nothing.",
449
- "types": [
450
- "Undef"
451
- ]
452
- }
453
- ]
454
- }
455
- }
456
- ],
457
- "docstring": {
458
- "text": "An example 4.x function with only one signature.",
459
- "tags": [
460
- {
461
- "tag_name": "param",
462
- "text": "The first parameter.",
463
- "types": [
464
- "Integer"
465
- ],
466
- "name": "param1"
467
- },
468
- {
469
- "tag_name": "return",
470
- "text": "Returns nothing.",
471
- "types": [
472
- "Undef"
473
- ]
474
- }
475
- ]
476
- },
477
- "source": "Puppet::Functions.create_function(:func4x_1) do\n # @param param1 The first parameter.\n # @return [Undef] Returns nothing.\n dispatch :foobarbaz do\n param 'Integer', :param1\n end\nend"
478
- }
479
- ]
480
- }