puppet-strings 2.4.0 → 2.8.0

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