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
data/JSON.md DELETED
@@ -1,802 +0,0 @@
1
- Puppet Strings JSON Data
2
- ========================
3
-
4
- Puppet Strings can generate JSON to STDOUT with the `--format` option:
5
- ```shell
6
- puppet strings generate --format json
7
- ```
8
-
9
- Document Schema
10
- ===============
11
-
12
- At the top level, there are seven arrays in the JSON document:
13
-
14
- | Document Key | Description |
15
- | ---------------- | ----------------------------------------------------------------------------- |
16
- | puppet_classes | The list of Puppet classes that were parsed. |
17
- | defined_types | The list of defined types that were parsed. |
18
- | resource_types | The list of resource types that were parsed. |
19
- | providers | The list of resource providers that were parsed. |
20
- | puppet_functions | The list of Puppet functions (4.x, 4.x and Puppet language) that were parsed. |
21
- | puppet_tasks | The list of Puppet tasks that were parsed. |
22
- | puppet_plans | The list of Puppet plans that were parsed. |
23
-
24
- Puppet Classes
25
- --------------
26
-
27
- Each entry in the `puppet_classes` list is an object with the following attributes:
28
-
29
- | Attribute Key | Description |
30
- | ------------- | ----------------------------------------------------- |
31
- | name | The name of the Puppet class. |
32
- | file | The file defining the Puppet class. |
33
- | line | The line where the Puppet class is defined. |
34
- | inherits | The name of the Puppet class the class inherits from. |
35
- | docstring | The *DocString* object for the class (see below). |
36
- | defaults | The map of parameter names to default values. |
37
- | source | The Puppet source code for the class. |
38
-
39
- Defined Types
40
- -------------
41
-
42
- Each entry in the `defined_types` list is an object with the following attributes:
43
-
44
- | Attribute Key | Description |
45
- | ------------- | -------------------------------------------------------- |
46
- | name | The name of the defined type. |
47
- | file | The file defining the defined type. |
48
- | line | The line where the defined type is defined. |
49
- | docstring | The *DocString* object for the defined type (see below). |
50
- | defaults | The map of parameter names to default values. |
51
- | source | The Puppet source code for the defined type. |
52
-
53
- Resource Types
54
- --------------
55
-
56
- Each entry in the `resource_types` list is an object with the following attributes:
57
-
58
- | Attribute Key | Description |
59
- | ------------- | --------------------------------------------------------- |
60
- | name | The name of the resource type. |
61
- | file | The file defining the resource type. |
62
- | line | The line where the resource type is defined. |
63
- | docstring | The *DocString* object for the resource type (see below). |
64
- | properties | The list of properties for the resource type (see below). |
65
- | parameters | The list of parameters for the resource type (see below). |
66
- | features | The list of features for the resource type (see below). |
67
-
68
- Each entry in the `properties` list is an object with the following attributes:
69
-
70
- | Attribute Key | Description |
71
- | ------------- | ------------------------------------------------------- |
72
- | name | The name of the property. |
73
- | description | The description of the property. |
74
- | values | The array of acceptable string values for the property. |
75
- | aliases | The map of new values aliased to existing values. |
76
- | isnamevar | True if the property is a namevar or false if not. |
77
- | default | The default value for the property. |
78
-
79
- Each entry in the `parameters` list is an object with the following attributes:
80
-
81
- | Attribute Key | Description |
82
- | ------------- | -------------------------------------------------------- |
83
- | name | The name of the parameter. |
84
- | description | The description of the parameter. |
85
- | values | The array of acceptable string values for the parameter. |
86
- | aliases | The map of new values aliased to existing values. |
87
- | isnamevar | True if the parameter is a namevar or false if not. |
88
- | default | The default value for the parameter. |
89
-
90
- Each entry in the `features` list is an object with the following attributes:
91
-
92
- | Attribute Key | Description |
93
- | ------------- | ------------------------------- |
94
- | name | The name of the feature. |
95
- | description | The description of the feature. |
96
-
97
- Providers
98
- ---------
99
-
100
- Each entry in the `providers` list is an object with the following attributes:
101
-
102
- | Attribute Key | Description |
103
- | ------------- | ---------------------------------------------------- |
104
- | name | The name of the provider. |
105
- | type_name | The name of the resource type of the provider. |
106
- | file | The file defining the provider. |
107
- | line | The line where the provider is defined. |
108
- | docstring | The *DocString* object for the provider (see below). |
109
- | confines | The string map of confines for the provider. |
110
- | features | The list of features implemented by the provider. |
111
- | defaults | The list of lists of "default for" for the provider. |
112
- | commands | The string map of commands for the provider. |
113
-
114
- Puppet Functions
115
- ----------------
116
-
117
- Each entry in the `puppet_functions` list is an object with the following attributes:
118
-
119
- | Attribute Key | Description |
120
- | ------------- | ----------------------------------------------------------------------------- |
121
- | name | The name of the function. |
122
- | file | The file defining the function. |
123
- | line | The line where the function is defined. |
124
- | type | The function type (e.g. ruby3x, ruby4x, puppet). |
125
- | signatures | A list of Puppet signatures of the function, including overloads if present. |
126
- | docstring | The *DocString* object for the function (see below). |
127
- | defaults | The map of parameter names to default values. |
128
- | source | The source code for the function. |
129
-
130
- Puppet Tasks
131
- ------------
132
-
133
- Each entry in the `puppet_tasks` list is an object with the following attributes:
134
-
135
- | Attribute Key | Description |
136
- | ------------- | ----------------------------------------------------------------------------- |
137
- | name | The name of the task. |
138
- | file | The file defining the task. |
139
- | line | The line where the task is defined. |
140
- | docstring | The *DocString* object for the task (see below). |
141
- | source | The source code for the task. |
142
- | supports_noop | Whether the task supports noop mode |
143
- | input_method | Maps to the `input_method` key in the task json |
144
-
145
- Puppet Plans
146
- ------------
147
-
148
- Each entry in the `puppet_plans` list is an object with the following attributes:
149
-
150
- | Attribute Key | Description |
151
- | ------------- | ----------------------------------------------------------------------------- |
152
- | name | The name of the plan. |
153
- | file | The file defining the plan. |
154
- | line | The line where the plan is defined. |
155
- | docstring | The *DocString* object for the plan (see below). |
156
- | defaults | The map of parameter names to default values. |
157
- | source | The source code for the plan. |
158
-
159
- Signature Objects
160
- -----------------
161
-
162
- The `signatures` key is a function-specific list containing an object for each signature of a
163
- function. Each object includes the `signature` itself, as well as each of its `param` and `return`
164
- tags. Puppet 4.x functions with overloads will contain multiple signatures, while other function
165
- types will contain only one.
166
-
167
- Each signature is represented as an object with the following attributes:
168
-
169
- | Attribute Key | Description |
170
- | ------------- | -------------------------------------------------------------------------------------------------- |
171
- | signature | The signature of the function. |
172
- | docstring | The *DocString* object describing the signature, which includes `text`, `param` and `return` tags. |
173
-
174
- DocString Objects
175
- -----------------
176
-
177
- For the above types, their docstrings are represented as an object with the following attributes:
178
-
179
- | Attribute Key | Description |
180
- | ------------- | --------------------------------------------------- |
181
- | text | The textual part of the DocString. |
182
- | tags | The array of tag objects, if any are present. |
183
-
184
- Each entry in the `tags` list is an object with the following properties:
185
-
186
- | Attribute Key | Description |
187
- | ------------- | ------------------------------------------------------- |
188
- | tag_name | The name of the tag (e.g. param, return, etc.). |
189
- | text | The descriptive text of the tag. |
190
- | types | The array of types associated with the tag. |
191
- | name | The name associated with the tag (e.g. parameter name). |
192
-
193
- For Puppet 4.x functions with overloads, `overload` tags will contain three additional attributes:
194
-
195
- | Attribute Key | Description |
196
- | ------------- | ----------------------------------------------- |
197
- | signature | The Puppet signature of the overload. |
198
- | docstring | The *DocString* object describing the overload. |
199
- | defaults | The map of parameter names to default values. |
200
-
201
-
202
- Example JSON Document
203
- ---------------------
204
-
205
- An example JSON document describing a Puppet class, defined type, resource type, provider, and Puppet functions:
206
-
207
- ```json
208
- {
209
- "puppet_classes": [
210
- {
211
- "name": "foo",
212
- "file": "site.pp",
213
- "line": 5,
214
- "inherits": "foo::bar",
215
- "docstring": {
216
- "text": "A simple class.",
217
- "tags": [
218
- {
219
- "tag_name": "param",
220
- "text": "First param.",
221
- "types": [
222
- "Integer"
223
- ],
224
- "name": "param1"
225
- },
226
- {
227
- "tag_name": "param",
228
- "text": "Second param.",
229
- "types": [
230
- "Any"
231
- ],
232
- "name": "param2"
233
- },
234
- {
235
- "tag_name": "param",
236
- "text": "Third param.",
237
- "types": [
238
- "String"
239
- ],
240
- "name": "param3"
241
- }
242
- ]
243
- },
244
- "defaults": {
245
- "param3": "hi"
246
- },
247
- "source": "class foo(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {\n}"
248
- }
249
- ],
250
- "defined_types": [
251
- {
252
- "name": "dt",
253
- "file": "site.pp",
254
- "line": 12,
255
- "docstring": {
256
- "text": "A simple defined type.",
257
- "tags": [
258
- {
259
- "tag_name": "param",
260
- "text": "First param.",
261
- "types": [
262
- "Integer"
263
- ],
264
- "name": "param1"
265
- },
266
- {
267
- "tag_name": "param",
268
- "text": "Second param.",
269
- "types": [
270
- "Any"
271
- ],
272
- "name": "param2"
273
- },
274
- {
275
- "tag_name": "param",
276
- "text": "Third param.",
277
- "types": [
278
- "String"
279
- ],
280
- "name": "param3"
281
- }
282
- ]
283
- },
284
- "defaults": {
285
- "param3": "hi"
286
- },
287
- "source": "define dt(Integer $param1, $param2, String $param3 = hi) {\n}"
288
- }
289
- ],
290
- "resource_types": [
291
- {
292
- "name": "database",
293
- "file": "database.rb",
294
- "line": 43,
295
- "docstring": {
296
- "text": "An example database server resource type."
297
- },
298
- "properties": [
299
- {
300
- "name": "ensure",
301
- "description": "What state the database should be in.",
302
- "values": [
303
- "present",
304
- "absent",
305
- "up",
306
- "down"
307
- ],
308
- "aliases": {
309
- "up": "present",
310
- "down": "absent"
311
- },
312
- "default": "up"
313
- },
314
- {
315
- "name": "file",
316
- "description": "The database file to use."
317
- },
318
- {
319
- "name": "log_level",
320
- "description": "The log level to use.",
321
- "values": [
322
- "debug",
323
- "warn",
324
- "error"
325
- ],
326
- "default": "warn"
327
- }
328
- ],
329
- "parameters": [
330
- {
331
- "name": "address",
332
- "description": "The database server name.",
333
- "isnamevar": true
334
- },
335
- {
336
- "name": "encryption_key",
337
- "description": "The encryption key to use."
338
- },
339
- {
340
- "name": "encrypt",
341
- "description": "Whether or not to encrypt the database.",
342
- "values": [
343
- "true",
344
- "false",
345
- "yes",
346
- "no"
347
- ],
348
- "default": "false"
349
- }
350
- ],
351
- "features": [
352
- {
353
- "name": "encryption",
354
- "description": "The provider supports encryption."
355
- }
356
- ]
357
- }
358
- ],
359
- "providers": [
360
- {
361
- "name": "linux",
362
- "type_name": "database",
363
- "file": "linux.rb",
364
- "line": 33,
365
- "docstring": {
366
- "text": "An example provider on Linux."
367
- },
368
- "confines": {
369
- "kernel": "Linux",
370
- "osfamily": "RedHat"
371
- },
372
- "features": [
373
- "implements_some_feature",
374
- "some_other_feature"
375
- ],
376
- "defaults": [
377
- [
378
- [
379
- "kernel",
380
- "Linux"
381
- ]
382
- ],
383
- [
384
- [
385
- "osfamily",
386
- "RedHat",
387
- ],
388
- [
389
- "operatingsystemmajrelease",
390
- "7"
391
- ]
392
- ]
393
- ],
394
- "commands": {
395
- "foo": "/usr/bin/foo"
396
- }
397
- }
398
- ],
399
- "puppet_functions": [
400
- {
401
- "name": "func",
402
- "file": "site.pp",
403
- "line": 20,
404
- "type": "puppet",
405
- "signatures": [
406
- {
407
- "signature": "func(Integer $param1, Any $param2, String $param3 = hi)",
408
- "docstring": {
409
- "text": "A simple function.",
410
- "tags": [
411
- {
412
- "tag_name": "param",
413
- "text": "First param.",
414
- "types": [
415
- "Integer"
416
- ],
417
- "name": "param1"
418
- },
419
- {
420
- "tag_name": "param",
421
- "text": "Second param.",
422
- "types": [
423
- "Any"
424
- ],
425
- "name": "param2"
426
- },
427
- {
428
- "tag_name": "param",
429
- "text": "Third param.",
430
- "types": [
431
- "String"
432
- ],
433
- "name": "param3"
434
- },
435
- {
436
- "tag_name": "return",
437
- "text": "Returns nothing.",
438
- "types": [
439
- "Undef"
440
- ]
441
- }
442
- ]
443
- }
444
- }
445
- ],
446
- "docstring": {
447
- "text": "A simple function.",
448
- "tags": [
449
- {
450
- "tag_name": "param",
451
- "text": "First param.",
452
- "types": [
453
- "Integer"
454
- ],
455
- "name": "param1"
456
- },
457
- {
458
- "tag_name": "param",
459
- "text": "Second param.",
460
- "types": [
461
- "Any"
462
- ],
463
- "name": "param2"
464
- },
465
- {
466
- "tag_name": "param",
467
- "text": "Third param.",
468
- "types": [
469
- "String"
470
- ],
471
- "name": "param3"
472
- },
473
- {
474
- "tag_name": "return",
475
- "text": "Returns nothing.",
476
- "types": [
477
- "Undef"
478
- ]
479
- }
480
- ]
481
- },
482
- "defaults": {
483
- "param3": "hi"
484
- },
485
- "source": "function func(Integer $param1, $param2, String $param3 = hi) {\n}"
486
- },
487
- {
488
- "name": "func3x",
489
- "file": "func3x.rb",
490
- "line": 1,
491
- "type": "ruby3x",
492
- "signatures": [
493
- {
494
- "signature": "func3x(String $first, Any $second)",
495
- "docstring": {
496
- "text": "An example 3.x function.",
497
- "tags": [
498
- {
499
- "tag_name": "param",
500
- "text": "The first parameter.",
501
- "types": [
502
- "String"
503
- ],
504
- "name": "first"
505
- },
506
- {
507
- "tag_name": "param",
508
- "text": "The second parameter.",
509
- "types": [
510
- "Any"
511
- ],
512
- "name": "second"
513
- },
514
- {
515
- "tag_name": "return",
516
- "text": "Returns nothing.",
517
- "types": [
518
- "Undef"
519
- ]
520
- }
521
- ]
522
- }
523
- }
524
- ],
525
- "docstring": {
526
- "text": "An example 3.x function.",
527
- "tags": [
528
- {
529
- "tag_name": "param",
530
- "text": "The first parameter.",
531
- "types": [
532
- "String"
533
- ],
534
- "name": "first"
535
- },
536
- {
537
- "tag_name": "param",
538
- "text": "The second parameter.",
539
- "types": [
540
- "Any"
541
- ],
542
- "name": "second"
543
- },
544
- {
545
- "tag_name": "return",
546
- "text": "Returns nothing.",
547
- "types": [
548
- "Undef"
549
- ]
550
- }
551
- ]
552
- },
553
- "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"
554
- },
555
- {
556
- "name": "func4x",
557
- "file": "func4x.rb",
558
- "line": 11,
559
- "type": "ruby4x",
560
- "signatures": [
561
- {
562
- "signature": "func4x(Integer $param1, Any $param2, Optional[Array[String]] $param3)",
563
- "docstring": {
564
- "text": "The first overload.",
565
- "tags": [
566
- {
567
- "tag_name": "param",
568
- "text": "The first parameter.",
569
- "types": [
570
- "Integer"
571
- ],
572
- "name": "param1"
573
- },
574
- {
575
- "tag_name": "param",
576
- "text": "The second parameter.",
577
- "types": [
578
- "Any"
579
- ],
580
- "name": "param2"
581
- },
582
- {
583
- "tag_name": "param",
584
- "text": "The third parameter.",
585
- "types": [
586
- "Optional[Array[String]]"
587
- ],
588
- "name": "param3"
589
- },
590
- {
591
- "tag_name": "return",
592
- "text": "Returns nothing.",
593
- "types": [
594
- "Undef"
595
- ]
596
- }
597
- ]
598
- }
599
- },
600
- {
601
- "signature": "func4x(Boolean $param, Callable &$block)",
602
- "docstring": {
603
- "text": "The second overload.",
604
- "tags": [
605
- {
606
- "tag_name": "param",
607
- "text": "The first parameter.",
608
- "types": [
609
- "Boolean"
610
- ],
611
- "name": "param"
612
- },
613
- {
614
- "tag_name": "param",
615
- "text": "The block parameter.",
616
- "types": [
617
- "Callable"
618
- ],
619
- "name": "&block"
620
- },
621
- {
622
- "tag_name": "return",
623
- "text": "Returns a string.",
624
- "types": [
625
- "String"
626
- ]
627
- }
628
- ]
629
- }
630
- }
631
- ],
632
- "docstring": {
633
- "text": "An example 4.x function.",
634
- "tags": [
635
- {
636
- "tag_name": "overload",
637
- "signature": "func4x(Integer $param1, Any $param2, Optional[Array[String]] $param3)",
638
- "docstring": {
639
- "text": "The first overload.",
640
- "tags": [
641
- {
642
- "tag_name": "param",
643
- "text": "The first parameter.",
644
- "types": [
645
- "Integer"
646
- ],
647
- "name": "param1"
648
- },
649
- {
650
- "tag_name": "param",
651
- "text": "The second parameter.",
652
- "types": [
653
- "Any"
654
- ],
655
- "name": "param2"
656
- },
657
- {
658
- "tag_name": "param",
659
- "text": "The third parameter.",
660
- "types": [
661
- "Optional[Array[String]]"
662
- ],
663
- "name": "param3"
664
- },
665
- {
666
- "tag_name": "return",
667
- "text": "Returns nothing.",
668
- "types": [
669
- "Undef"
670
- ]
671
- }
672
- ]
673
- },
674
- "name": "func4x"
675
- },
676
- {
677
- "tag_name": "overload",
678
- "signature": "func4x(Boolean $param, Callable &$block)",
679
- "docstring": {
680
- "text": "The second overload.",
681
- "tags": [
682
- {
683
- "tag_name": "param",
684
- "text": "The first parameter.",
685
- "types": [
686
- "Boolean"
687
- ],
688
- "name": "param"
689
- },
690
- {
691
- "tag_name": "param",
692
- "text": "The block parameter.",
693
- "types": [
694
- "Callable"
695
- ],
696
- "name": "&block"
697
- },
698
- {
699
- "tag_name": "return",
700
- "text": "Returns a string.",
701
- "types": [
702
- "String"
703
- ]
704
- }
705
- ]
706
- },
707
- "name": "func4x"
708
- }
709
- ]
710
- },
711
- "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 [Undef] Returns nothing.\n dispatch :foo do\n param 'Integer', :param1\n param 'Any', :param2\n optional_param 'Array[String]', :param3\n end\n\n # The second overload.\n # @param param The first parameter.\n # @param block The block parameter.\n # @return [String] Returns a string.\n dispatch :other do\n param 'Boolean', :param\n block_param\n end\nend"
712
- }
713
- ],
714
- "puppet_tasks": [
715
- {
716
- "name": "(stdin)",
717
- "file": "(stdin)",
718
- "line": 0,
719
- "docstring": {
720
- "text": "Allows you to backup your database to local file.",
721
- "tags": [
722
- {
723
- "name": "database",
724
- "tag_name": "param",
725
- "text": "Database to connect to",
726
- "types": [
727
- "Optional[String[1]]"
728
- ]
729
- },
730
- {
731
- "name": "user",
732
- "tag_name": "param",
733
- "text": "The user",
734
- "types": [
735
- "Optional[String[1]]"
736
- ]
737
- },
738
- {
739
- "name": "password",
740
- "tag_name": "param",
741
- "text": "The password",
742
- "types": [
743
- "Optional[String[1]]"
744
- ]
745
- },
746
- {
747
- "name": "sql",
748
- "tag_name": "param",
749
- "text": "Path to file you want backup to",
750
- "types": [
751
- "String[1]"
752
- ]
753
- }
754
- ]
755
- },
756
- "source": "{\n \"description\": \"Allows you to backup your database to local file.\",\n \"input_method\": \"stdin\",\n \"parameters\": {\n \"database\": {\n \"description\": \"Database to connect to\",\n \"type\": \"Optional[String[1]]\"\n },\n \"user\": {\n \"description\": \"The user\",\n \"type\": \"Optional[String[1]]\"\n },\n \"password\": {\n \"description\": \"The password\",\n \"type\": \"Optional[String[1]]\"\n },\n \"sql\": {\n \"description\": \"Path to file you want backup to\",\n \"type\": \"String[1]\"\n }\n }\n}\n",
757
- "supports_noop": false,
758
- "input_method": "stdin"
759
- }
760
- ],
761
- "puppet_plans": [
762
- {
763
- "name": "plann",
764
- "file": "(stdin)",
765
- "line": 5,
766
- "docstring": {
767
- "text": "A simple plan.",
768
- "tags": [
769
- {
770
- "tag_name": "param",
771
- "text": "First param.",
772
- "types": [
773
- "String"
774
- ],
775
- "name": "param1"
776
- },
777
- {
778
- "tag_name": "param",
779
- "text": "Second param.",
780
- "types": [
781
- "Any"
782
- ],
783
- "name": "param2"
784
- },
785
- {
786
- "tag_name": "param",
787
- "text": "Third param.",
788
- "types": [
789
- "Integer"
790
- ],
791
- "name": "param3"
792
- }
793
- ]
794
- },
795
- "defaults": {
796
- "param3": "1"
797
- },
798
- "source": "plan plann(String $param1, $param2, Integer $param3 = 1) {\n}"
799
- }
800
- ]
801
- }
802
- ```