puppet-strings 0.4.0 → 0.99.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 (168) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +122 -0
  3. data/COMMITTERS.md +185 -0
  4. data/CONTRIBUTING.md +89 -0
  5. data/Gemfile +38 -0
  6. data/JSON.md +511 -0
  7. data/LICENSE +13 -0
  8. data/README.md +416 -0
  9. data/Rakefile +49 -0
  10. data/lib/puppet-strings.rb +63 -0
  11. data/lib/puppet-strings/json.rb +49 -0
  12. data/lib/puppet-strings/tasks.rb +10 -0
  13. data/lib/puppet-strings/tasks/generate.rb +23 -0
  14. data/lib/puppet-strings/tasks/gh_pages.rb +43 -0
  15. data/lib/puppet-strings/yard.rb +96 -0
  16. data/lib/puppet-strings/yard/code_objects.rb +8 -0
  17. data/lib/puppet-strings/yard/code_objects/base.rb +14 -0
  18. data/lib/puppet-strings/yard/code_objects/class.rb +59 -0
  19. data/lib/puppet-strings/yard/code_objects/defined_type.rb +58 -0
  20. data/lib/puppet-strings/yard/code_objects/function.rb +93 -0
  21. data/lib/puppet-strings/yard/code_objects/group.rb +30 -0
  22. data/lib/puppet-strings/yard/code_objects/provider.rb +93 -0
  23. data/lib/puppet-strings/yard/code_objects/type.rb +146 -0
  24. data/lib/puppet-strings/yard/handlers.rb +16 -0
  25. data/lib/puppet-strings/yard/handlers/puppet/base.rb +44 -0
  26. data/lib/puppet-strings/yard/handlers/puppet/class_handler.rb +23 -0
  27. data/lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb +23 -0
  28. data/lib/puppet-strings/yard/handlers/puppet/function_handler.rb +42 -0
  29. data/lib/puppet-strings/yard/handlers/ruby/base.rb +38 -0
  30. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +357 -0
  31. data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +113 -0
  32. data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +194 -0
  33. data/lib/puppet-strings/yard/parsers.rb +7 -0
  34. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +70 -0
  35. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +146 -0
  36. data/lib/puppet-strings/yard/tags.rb +6 -0
  37. data/lib/puppet-strings/yard/tags/overload_tag.rb +109 -0
  38. data/lib/puppet-strings/yard/tags/parameter_directive.rb +24 -0
  39. data/lib/puppet-strings/yard/tags/property_directive.rb +24 -0
  40. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_class.erb +9 -0
  41. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_defined_type.erb +9 -0
  42. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_function.erb +10 -0
  43. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_provider.erb +10 -0
  44. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_type.erb +9 -0
  45. data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +64 -0
  46. data/lib/puppet-strings/yard/templates/default/layout/html/objects.erb +35 -0
  47. data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +172 -0
  48. data/lib/puppet-strings/yard/templates/default/puppet_class/html/box_info.erb +26 -0
  49. data/lib/puppet-strings/yard/templates/default/puppet_class/html/header.erb +1 -0
  50. data/lib/puppet-strings/yard/templates/default/puppet_class/html/overview.erb +6 -0
  51. data/lib/puppet-strings/yard/templates/default/puppet_class/html/setup.rb +14 -0
  52. data/lib/puppet-strings/yard/templates/default/puppet_class/html/source.erb +12 -0
  53. data/lib/puppet-strings/yard/templates/default/puppet_defined_type/html/box_info.erb +10 -0
  54. data/lib/puppet-strings/yard/templates/default/puppet_defined_type/html/header.erb +1 -0
  55. data/lib/puppet-strings/yard/templates/default/puppet_defined_type/html/overview.erb +6 -0
  56. data/lib/puppet-strings/yard/templates/default/puppet_defined_type/html/setup.rb +5 -0
  57. data/lib/puppet-strings/yard/templates/default/puppet_defined_type/html/source.erb +12 -0
  58. data/lib/puppet-strings/yard/templates/default/puppet_function/html/box_info.erb +14 -0
  59. data/lib/puppet-strings/yard/templates/default/puppet_function/html/header.erb +1 -0
  60. data/lib/puppet-strings/yard/templates/default/puppet_function/html/overview.erb +18 -0
  61. data/lib/puppet-strings/yard/templates/default/puppet_function/html/setup.rb +5 -0
  62. data/lib/puppet-strings/yard/templates/default/puppet_function/html/source.erb +12 -0
  63. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/box_info.erb +14 -0
  64. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/collection.erb +10 -0
  65. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/features.erb +12 -0
  66. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/header.erb +1 -0
  67. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/overview.erb +6 -0
  68. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/setup.rb +29 -0
  69. data/lib/puppet-strings/yard/templates/default/puppet_type/html/box_info.erb +20 -0
  70. data/lib/puppet-strings/yard/templates/default/puppet_type/html/features.erb +13 -0
  71. data/lib/puppet-strings/yard/templates/default/puppet_type/html/header.erb +1 -0
  72. data/lib/puppet-strings/yard/templates/default/puppet_type/html/overview.erb +6 -0
  73. data/lib/puppet-strings/yard/templates/default/puppet_type/html/parameters.erb +35 -0
  74. data/lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb +32 -0
  75. data/lib/puppet-strings/yard/templates/default/tags/html/puppet_overload.erb +12 -0
  76. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +15 -0
  77. data/lib/puppet/application/strings.rb +1 -0
  78. data/lib/puppet/face/strings.rb +80 -39
  79. data/spec/acceptance/emit_json_options.rb +41 -0
  80. data/spec/acceptance/lib/util.rb +15 -0
  81. data/spec/acceptance/running_strings_generate.rb +54 -0
  82. data/spec/fixtures/acceptance/modules/test/functions/add.pp +9 -0
  83. data/spec/fixtures/acceptance/modules/test/lib/puppet/functions/4x_function.rb +5 -0
  84. data/spec/fixtures/acceptance/modules/test/lib/puppet/parser/functions/function3x.rb +2 -0
  85. data/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb +9 -0
  86. data/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb +15 -0
  87. data/spec/fixtures/acceptance/modules/test/manifests/init.pp +27 -0
  88. data/spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp +27 -0
  89. data/spec/fixtures/acceptance/modules/test/metadata.json +6 -0
  90. data/spec/fixtures/unit/json/output.json +348 -0
  91. data/spec/fixtures/unit/json/output_without_puppet_function.json +301 -0
  92. data/spec/spec_helper.rb +21 -0
  93. data/spec/spec_helper_acceptance.rb +27 -0
  94. data/spec/unit/puppet-strings/json_spec.rb +136 -0
  95. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +155 -0
  96. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +155 -0
  97. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +169 -0
  98. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +613 -0
  99. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +90 -0
  100. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +214 -0
  101. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +171 -0
  102. metadata +115 -92
  103. data/lib/puppet-strings/rake_tasks.rb +0 -18
  104. data/lib/puppet_x/puppetlabs/strings.rb +0 -64
  105. data/lib/puppet_x/puppetlabs/strings/actions.rb +0 -92
  106. data/lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb +0 -79
  107. data/lib/puppet_x/puppetlabs/strings/pops/yard_transformer.rb +0 -47
  108. data/lib/puppet_x/puppetlabs/strings/util.rb +0 -65
  109. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/defined_type_object.rb +0 -33
  110. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/host_class_object.rb +0 -22
  111. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/method_object.rb +0 -62
  112. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/provider_object.rb +0 -24
  113. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/puppet_namespace_object.rb +0 -48
  114. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/type_object.rb +0 -42
  115. data/lib/puppet_x/puppetlabs/strings/yard/core_ext/yard.rb +0 -40
  116. data/lib/puppet_x/puppetlabs/strings/yard/handlers/base.rb +0 -13
  117. data/lib/puppet_x/puppetlabs/strings/yard/handlers/defined_type_handler.rb +0 -31
  118. data/lib/puppet_x/puppetlabs/strings/yard/handlers/heredoc_helper.rb +0 -80
  119. data/lib/puppet_x/puppetlabs/strings/yard/handlers/host_class_handler.rb +0 -42
  120. data/lib/puppet_x/puppetlabs/strings/yard/handlers/provider_handler.rb +0 -95
  121. data/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_3x_function_handler.rb +0 -54
  122. data/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_4x_function_handler.rb +0 -234
  123. data/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb +0 -295
  124. data/lib/puppet_x/puppetlabs/strings/yard/json_registry_store.rb +0 -85
  125. data/lib/puppet_x/puppetlabs/strings/yard/monkey_patches.rb +0 -68
  126. data/lib/puppet_x/puppetlabs/strings/yard/parser.rb +0 -30
  127. data/lib/puppet_x/puppetlabs/strings/yard/tags/directives.rb +0 -9
  128. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/docstring.erb +0 -34
  129. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/header.erb +0 -5
  130. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/parameter_details.erb +0 -6
  131. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/setup.rb +0 -1
  132. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/setup.rb +0 -49
  133. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_class.erb +0 -2
  134. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb +0 -1
  135. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb +0 -21
  136. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_provider.erb +0 -1
  137. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_type.erb +0 -1
  138. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb +0 -82
  139. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/box_info.erb +0 -22
  140. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/setup.rb +0 -1
  141. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/subclasses.erb +0 -4
  142. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/setup.rb +0 -21
  143. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/html_helper.rb +0 -139
  144. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/layout/html/setup.rb +0 -18
  145. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/html/header.erb +0 -17
  146. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/setup.rb +0 -21
  147. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/text/header.erb +0 -2
  148. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/command_details.erb +0 -8
  149. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/confine_details.erb +0 -10
  150. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/default_details.erb +0 -10
  151. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/docstring.erb +0 -34
  152. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/feature_details.erb +0 -10
  153. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/header.erb +0 -5
  154. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/setup.rb +0 -1
  155. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb +0 -50
  156. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/box_info.erb +0 -11
  157. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/header.erb +0 -5
  158. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/method_details_list.erb +0 -53
  159. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/method_summary.erb +0 -20
  160. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/setup.rb +0 -1
  161. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/setup.rb +0 -91
  162. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/template_helper.rb +0 -192
  163. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/docstring.erb +0 -34
  164. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/header.erb +0 -5
  165. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/parameter_details.erb +0 -12
  166. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/provider_details.erb +0 -10
  167. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/setup.rb +0 -1
  168. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb +0 -55
data/JSON.md ADDED
@@ -0,0 +1,511 @@
1
+ Puppet Strings JSON Data
2
+ ========================
3
+
4
+ Puppet Strings has two flags to the `generate` action that can be used to emit JSON data:
5
+
6
+ * `--emit-json <file>`: Emits the JSON data to the given file.
7
+ * `--emit-json-stdout`: Emits the JSON data to STDOUT.
8
+
9
+ Document Schema
10
+ ===============
11
+
12
+ At the top level, there are five 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 (3.x, 4.x and Puppet language) that were parsed. |
21
+
22
+ Puppet Classes
23
+ --------------
24
+
25
+ Each entry in the `puppet_classes` list is an object with the following attributes:
26
+
27
+ | Attribute Key | Description |
28
+ | ------------- | ----------------------------------------------------- |
29
+ | name | The name of the Puppet class. |
30
+ | file | The file defining the Puppet class. |
31
+ | line | The line where the Puppet class is defined. |
32
+ | inherits | The name of the Puppet class the class inherits from. |
33
+ | docstring | The *DocString* object for the class (see below). |
34
+ | defaults | The map of parameter names to default values. |
35
+ | source | The Puppet source code for the class. |
36
+
37
+ Defined Types
38
+ -------------
39
+
40
+ Each entry in the `defined_types` list is an object with the following attributes:
41
+
42
+ | Attribute Key | Description |
43
+ | ------------- | -------------------------------------------------------- |
44
+ | name | The name of the defined type. |
45
+ | file | The file defining the defined type. |
46
+ | line | The line where the defined type is defined. |
47
+ | docstring | The *DocString* object for the defined type (see below). |
48
+ | defaults | The map of parameter names to default values. |
49
+ | source | The Puppet source code for the defined type. |
50
+
51
+ Resource Types
52
+ --------------
53
+
54
+ Each entry in the `resource_types` list is an object with the following attributes:
55
+
56
+ | Attribute Key | Description |
57
+ | ------------- | --------------------------------------------------------- |
58
+ | name | The name of the resource type. |
59
+ | file | The file defining the resource type. |
60
+ | line | The line where the resource type is defined. |
61
+ | docstring | The *DocString* object for the resource type (see below). |
62
+ | properties | The list of properties for the resource type (see below). |
63
+ | parameters | The list of parameters for the resource type (see below). |
64
+ | features | The list of features for the resource type (see below). |
65
+
66
+ Each entry in the `properties` list is an object with the following attributes:
67
+
68
+ | Attribute Key | Description |
69
+ | ------------- | ------------------------------------------------------- |
70
+ | name | The name of the property. |
71
+ | description | The description of the property. |
72
+ | values | The array of acceptable string values for the property. |
73
+ | aliases | The map of new values aliased to existing values. |
74
+ | isnamevar | True if the property is a namevar or false if not. |
75
+ | default | The default value for the property. |
76
+
77
+ Each entry in the `parameters` list is an object with the following attributes:
78
+
79
+ | Attribute Key | Description |
80
+ | ------------- | -------------------------------------------------------- |
81
+ | name | The name of the parameter. |
82
+ | description | The description of the parameter. |
83
+ | values | The array of acceptable string values for the parameter. |
84
+ | aliases | The map of new values aliased to existing values. |
85
+ | isnamevar | True if the parameter is a namevar or false if not. |
86
+ | default | The default value for the parameter. |
87
+
88
+ Each entry in the `features` list is an object with the following attributes:
89
+
90
+ | Attribute Key | Description |
91
+ | ------------- | ------------------------------- |
92
+ | name | The name of the feature. |
93
+ | description | The description of the feature. |
94
+
95
+ Providers
96
+ ---------
97
+
98
+ Each entry in the `providers` list is an object with the following attributes:
99
+
100
+ | Attribute Key | Description |
101
+ | ------------- | ---------------------------------------------------- |
102
+ | name | The name of the provider. |
103
+ | type_name | The name of the resource type of the provider. |
104
+ | file | The file defining the provider. |
105
+ | line | The line where the provider is defined. |
106
+ | docstring | The *DocString* object for the provider (see below). |
107
+ | confines | The string map of confines for the provider. |
108
+ | features | The list of features implemented by the provider. |
109
+ | defaults | The string map of "default for" for the provider. |
110
+ | commands | The string map of commands for the provider. |
111
+
112
+ Puppet Functions
113
+ ----------------
114
+
115
+ Each entry in the `puppet_functions` list is an object with the following attributes:
116
+
117
+ | Attribute Key | Description |
118
+ | ------------- | ---------------------------------------------------- |
119
+ | name | The name of the function. |
120
+ | file | The file defining the provider. |
121
+ | line | The line where the provider is defined. |
122
+ | type | The function type (e.g. ruby3x, ruby4x, puppet). |
123
+ | signature | The Puppet signature of the function (no overloads). |
124
+ | docstring | The *DocString* object for the function (see below). |
125
+ | defaults | The map of parameter names to default values. |
126
+ | source | The source code for the function. |
127
+
128
+ DocString Objects
129
+ -----------------
130
+
131
+ For the above types, their docstrings are represented as an object with the following attributes:
132
+
133
+ | Attribute Key | Description DocString |
134
+ | ------------- | --------------------------------------------------- |
135
+ | text | The textual part of the DocString. |
136
+ | tags | The array of tag objects, if any are present. |
137
+
138
+ Each entry in the `tags` list is an object with the following properties:
139
+
140
+ | Attribute Key | Description |
141
+ | ------------- | ------------------------------------------------------- |
142
+ | tag_name | The name of the tag (e.g. param, return, etc.). |
143
+ | text | The descriptive text of the tag. |
144
+ | types | The array of types associated with the tag. |
145
+ | name | The name associated with the tag (e.g. parameter name). |
146
+
147
+ For Puppet 4.x functions with overloads, `overload` tags will contain three additional attributes:
148
+
149
+ | Attribute Key | Description |
150
+ | ------------- | ----------------------------------------------- |
151
+ | signature | The Puppet signature of the overload. |
152
+ | docstring | The *DocString* object describing the overload. |
153
+ | defaults | The map of parameter names to default values. |
154
+
155
+
156
+ Example JSON Document
157
+ ---------------------
158
+
159
+ An example JSON document describing a Puppet class, defined type, resource type, provider, and Puppet functions:
160
+
161
+ ```json
162
+ {
163
+ "puppet_classes": [
164
+ {
165
+ "name": "foo",
166
+ "file": "site.pp",
167
+ "line": 5,
168
+ "inherits": "foo::bar",
169
+ "docstring": {
170
+ "text": "A simple class.",
171
+ "tags": [
172
+ {
173
+ "tag_name": "param",
174
+ "text": "First param.",
175
+ "types": [
176
+ "Integer"
177
+ ],
178
+ "name": "param1"
179
+ },
180
+ {
181
+ "tag_name": "param",
182
+ "text": "Second param.",
183
+ "types": [
184
+ "Any"
185
+ ],
186
+ "name": "param2"
187
+ },
188
+ {
189
+ "tag_name": "param",
190
+ "text": "Third param.",
191
+ "types": [
192
+ "String"
193
+ ],
194
+ "name": "param3"
195
+ }
196
+ ]
197
+ },
198
+ "defaults": {
199
+ "param3": "hi"
200
+ },
201
+ "source": "class foo(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {\n}"
202
+ }
203
+ ],
204
+ "defined_types": [
205
+ {
206
+ "name": "dt",
207
+ "file": "site.pp",
208
+ "line": 12,
209
+ "docstring": {
210
+ "text": "A simple defined type.",
211
+ "tags": [
212
+ {
213
+ "tag_name": "param",
214
+ "text": "First param.",
215
+ "types": [
216
+ "Integer"
217
+ ],
218
+ "name": "param1"
219
+ },
220
+ {
221
+ "tag_name": "param",
222
+ "text": "Second param.",
223
+ "types": [
224
+ "Any"
225
+ ],
226
+ "name": "param2"
227
+ },
228
+ {
229
+ "tag_name": "param",
230
+ "text": "Third param.",
231
+ "types": [
232
+ "String"
233
+ ],
234
+ "name": "param3"
235
+ }
236
+ ]
237
+ },
238
+ "defaults": {
239
+ "param3": "hi"
240
+ },
241
+ "source": "define dt(Integer $param1, $param2, String $param3 = hi) {\n}"
242
+ }
243
+ ],
244
+ "resource_types": [
245
+ {
246
+ "name": "database",
247
+ "file": "database.rb",
248
+ "line": 43,
249
+ "docstring": {
250
+ "text": "An example database server resource type."
251
+ },
252
+ "properties": [
253
+ {
254
+ "name": "ensure",
255
+ "description": "What state the database should be in.",
256
+ "values": [
257
+ "present",
258
+ "absent",
259
+ "up",
260
+ "down"
261
+ ],
262
+ "aliases": {
263
+ "up": "present",
264
+ "down": "absent"
265
+ },
266
+ "default": "up"
267
+ },
268
+ {
269
+ "name": "file",
270
+ "description": "The database file to use."
271
+ },
272
+ {
273
+ "name": "log_level",
274
+ "description": "The log level to use.",
275
+ "values": [
276
+ "debug",
277
+ "warn",
278
+ "error"
279
+ ],
280
+ "default": "warn"
281
+ }
282
+ ],
283
+ "parameters": [
284
+ {
285
+ "name": "address",
286
+ "description": "The database server name.",
287
+ "isnamevar": true
288
+ },
289
+ {
290
+ "name": "encryption_key",
291
+ "description": "The encryption key to use."
292
+ },
293
+ {
294
+ "name": "encrypt",
295
+ "description": "Whether or not to encrypt the database.",
296
+ "values": [
297
+ "true",
298
+ "false",
299
+ "yes",
300
+ "no"
301
+ ],
302
+ "default": "false"
303
+ }
304
+ ],
305
+ "features": [
306
+ {
307
+ "name": "encryption",
308
+ "description": "The provider supports encryption."
309
+ }
310
+ ]
311
+ }
312
+ ],
313
+ "providers": [
314
+ {
315
+ "name": "linux",
316
+ "type_name": "database",
317
+ "file": "linux.rb",
318
+ "line": 33,
319
+ "docstring": {
320
+ "text": "An example provider on Linux."
321
+ },
322
+ "confines": {
323
+ "kernel": "Linux",
324
+ "osfamily": "RedHat"
325
+ },
326
+ "features": [
327
+ "implements_some_feature",
328
+ "some_other_feature"
329
+ ],
330
+ "defaults": {
331
+ "kernel": "Linux"
332
+ },
333
+ "commands": {
334
+ "foo": "/usr/bin/foo"
335
+ }
336
+ }
337
+ ],
338
+ "puppet_functions": [
339
+ {
340
+ "name": "func",
341
+ "file": "site.pp",
342
+ "line": 20,
343
+ "type": "puppet",
344
+ "signature": "func(Integer $param1, Any $param2, String $param3 = hi)",
345
+ "docstring": {
346
+ "text": "A simple function.",
347
+ "tags": [
348
+ {
349
+ "tag_name": "param",
350
+ "text": "First param.",
351
+ "types": [
352
+ "Integer"
353
+ ],
354
+ "name": "param1"
355
+ },
356
+ {
357
+ "tag_name": "param",
358
+ "text": "Second param.",
359
+ "types": [
360
+ "Any"
361
+ ],
362
+ "name": "param2"
363
+ },
364
+ {
365
+ "tag_name": "param",
366
+ "text": "Third param.",
367
+ "types": [
368
+ "String"
369
+ ],
370
+ "name": "param3"
371
+ },
372
+ {
373
+ "tag_name": "return",
374
+ "text": "Returns nothing.",
375
+ "types": [
376
+ "Undef"
377
+ ]
378
+ }
379
+ ]
380
+ },
381
+ "defaults": {
382
+ "param3": "hi"
383
+ },
384
+ "source": "function func(Integer $param1, $param2, String $param3 = hi) {\n}"
385
+ },
386
+ {
387
+ "name": "func3x",
388
+ "file": "func3x.rb",
389
+ "line": 1,
390
+ "type": "ruby3x",
391
+ "signature": "func3x(String $first, Any $second)",
392
+ "docstring": {
393
+ "text": "An example 3.x function.",
394
+ "tags": [
395
+ {
396
+ "tag_name": "param",
397
+ "text": "The first parameter.",
398
+ "types": [
399
+ "String"
400
+ ],
401
+ "name": "first"
402
+ },
403
+ {
404
+ "tag_name": "param",
405
+ "text": "The second parameter.",
406
+ "types": [
407
+ "Any"
408
+ ],
409
+ "name": "second"
410
+ },
411
+ {
412
+ "tag_name": "return",
413
+ "text": "Returns nothing.",
414
+ "types": [
415
+ "Undef"
416
+ ]
417
+ }
418
+ ]
419
+ },
420
+ "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"
421
+ },
422
+ {
423
+ "name": "func4x",
424
+ "file": "func4x.rb",
425
+ "line": 11,
426
+ "type": "ruby4x",
427
+ "docstring": {
428
+ "text": "An example 4.x function.",
429
+ "tags": [
430
+ {
431
+ "tag_name": "overload",
432
+ "signature": "func4x(Integer $param1, Any $param2, Optional[Array[String]] $param3)",
433
+ "docstring": {
434
+ "text": "The first overload.",
435
+ "tags": [
436
+ {
437
+ "tag_name": "param",
438
+ "text": "The first parameter.",
439
+ "types": [
440
+ "Integer"
441
+ ],
442
+ "name": "param1"
443
+ },
444
+ {
445
+ "tag_name": "param",
446
+ "text": "The second parameter.",
447
+ "types": [
448
+ "Any"
449
+ ],
450
+ "name": "param2"
451
+ },
452
+ {
453
+ "tag_name": "param",
454
+ "text": "The third parameter.",
455
+ "types": [
456
+ "Optional[Array[String]]"
457
+ ],
458
+ "name": "param3"
459
+ },
460
+ {
461
+ "tag_name": "return",
462
+ "text": "Returns nothing.",
463
+ "types": [
464
+ "Undef"
465
+ ]
466
+ }
467
+ ]
468
+ },
469
+ "name": "func4x"
470
+ },
471
+ {
472
+ "tag_name": "overload",
473
+ "signature": "func4x(Boolean $param, Callable &$block)",
474
+ "docstring": {
475
+ "text": "The second overload.",
476
+ "tags": [
477
+ {
478
+ "tag_name": "param",
479
+ "text": "The first parameter.",
480
+ "types": [
481
+ "Boolean"
482
+ ],
483
+ "name": "param"
484
+ },
485
+ {
486
+ "tag_name": "param",
487
+ "text": "The block parameter.",
488
+ "types": [
489
+ "Callable"
490
+ ],
491
+ "name": "&block"
492
+ },
493
+ {
494
+ "tag_name": "return",
495
+ "text": "Returns a string.",
496
+ "types": [
497
+ "String"
498
+ ]
499
+ }
500
+ ]
501
+ },
502
+ "name": "func4x"
503
+ }
504
+ ]
505
+ },
506
+ "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"
507
+ }
508
+ ]
509
+ }
510
+ ```
511
+