puppet-strings 0.4.0 → 0.99.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,41 @@
1
+ require 'spec_helper_acceptance'
2
+ require 'util'
3
+ require 'json'
4
+
5
+ include PuppetStrings::Acceptance::Util
6
+
7
+ describe 'Emitting JSON' do
8
+ expected = {
9
+ "puppet_classes" => [],
10
+ "defined_types" => [],
11
+ "resource_types" => [],
12
+ "providers" => [],
13
+ "puppet_functions" => [
14
+ "name" => "function3x",
15
+ "file" => "/etc/puppet/modules/test/lib/puppet/parser/functions/function3x.rb",
16
+ "line" => 1,
17
+ "type" => "ruby3x",
18
+ "signature" => "function3x()",
19
+ "docstring" => {
20
+ "text" => "This is the function documentation for `function3x`",
21
+ "tags" => ["tag_name" => "return", "text" => "", "types" => ["Any"]]},
22
+ "source" => "Puppet::Parser::Functions.newfunction(:function3x, :doc => \"This is the function documentation for `function3x`\") do |args|\nend"
23
+ ]
24
+ }
25
+
26
+ it 'should emit JSON to stdout when using the --emit-json-stdout option' do
27
+ test_module_path = get_test_module_path(master, /Module test/)
28
+ on master, puppet('strings', 'generate', '--emit-json-stdout', "#{test_module_path}/lib/puppet/parser/functions/function3x.rb") do
29
+ output = stdout.chomp
30
+ expect(JSON.parse(output)).to eq(expected)
31
+ end
32
+ end
33
+
34
+ it 'should write JSON to a file when using the --emit-json option' do
35
+ test_module_path = get_test_module_path(master, /Module test/)
36
+ tmpfile = master.tmpfile('json_output.json')
37
+ on master, puppet('strings', 'generate', "--emit-json #{tmpfile}", "#{test_module_path}/lib/puppet/parser/functions/function3x.rb")
38
+ output = read_file_on(master, tmpfile)
39
+ expect(JSON.parse(output)).to eq(expected)
40
+ end
41
+ end
@@ -0,0 +1,15 @@
1
+ module PuppetStrings
2
+ module Acceptance
3
+ module Util
4
+ def read_file_on(host, filename)
5
+ on(host, "cat #{filename}").stdout
6
+ end
7
+
8
+ def get_test_module_path(host, module_regex)
9
+ modules = JSON.parse(on(host, puppet('module', 'list', '--render-as', 'json')).stdout)
10
+ test_module_info = modules['modules_by_path'].values.flatten.find { |mod_info| mod_info =~ module_regex }
11
+ test_module_info.match(/\(([^)]*)\)/)[1]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,54 @@
1
+ require 'spec_helper_acceptance'
2
+ require 'util'
3
+ require 'json'
4
+
5
+ include PuppetStrings::Acceptance::Util
6
+
7
+ describe 'Generating module documentation using generate action' do
8
+ before :all do
9
+ test_module_path = get_test_module_path(master, /Module test/)
10
+ on master, puppet('strings', 'generate', "#{test_module_path}/**/*.{rb,pp}")
11
+ end
12
+
13
+ it 'should generate documentation for manifests' do
14
+ expect(read_file_on(master, '/root/doc/puppet_classes/test.html')).to include('Class: test')
15
+ end
16
+
17
+ it 'should generate documentation for puppet functions' do
18
+ puppet_version = on(master, facter('puppetversion')).stdout.chomp.to_i
19
+
20
+ if puppet_version >= 4
21
+ html_output = read_file_on(master, '/root/doc/puppet_functions_puppet/test_3A_3Aadd.html')
22
+ expect(html_output).to include('Adds two integers together.')
23
+ expect(html_output).to include('<pre class="example code"><code>test::add(1, 2) =&gt; 3</code></pre>')
24
+ expect(html_output).to include('<p>The first integer to add.</p>')
25
+ expect(html_output).to include('<p>The second integer to add.</p>')
26
+ expect(html_output).to include('<p>Returns the sum of x and y.</p>')
27
+ end
28
+ end
29
+
30
+ it 'should generate documentation for 3x functions' do
31
+ expect(read_file_on(master, '/root/doc/puppet_functions_ruby3x/function3x.html')).to include('This is the function documentation for <code>function3x</code>')
32
+ end
33
+
34
+ it 'should generate documentation for 4x functions' do
35
+ expect(read_file_on(master, '/root/doc/puppet_functions_ruby4x/function4x.html')).to include('This is a function which is used to test puppet strings')
36
+ end
37
+
38
+ it 'should generate documentation for custom types' do
39
+ html_output = read_file_on(master, '/root/doc/puppet_types/database.html')
40
+ expect(html_output).to include('<p>An example server resource type.</p>')
41
+ expect(html_output).to include('<p>The database file to use.</p>')
42
+ expect(html_output).to include('<p>Documentation for a dynamic property.</p>')
43
+ expect(html_output).to include('<p>The database server name.</p>')
44
+ expect(html_output).to include('<p>Documentation for a dynamic parameter.</p>')
45
+ expect(html_output).to include('<p>The provider supports encryption.</p>')
46
+ end
47
+
48
+ it 'should generate documentation for custom providers' do
49
+ html_output = read_file_on(master, '/root/doc/puppet_providers_database/linux.html')
50
+ expect(html_output).to include('The database provider on Linux')
51
+ expect(html_output).to include('<tt>osfamily &mdash; linux</tt>')
52
+ expect(html_output).to include('<tt>database &mdash; /usr/bin/database</tt>')
53
+ end
54
+ end
@@ -0,0 +1,9 @@
1
+ # Adds two integers together.
2
+ # @param x The first integer to add.
3
+ # @param y The second integer to add.
4
+ # @return [Integer] Returns the sum of x and y.
5
+ # @example Example of adding two integers.
6
+ # test::add(1, 2) => 3
7
+ function test::add(Integer $x, Integer $y) {
8
+ $x + $y
9
+ }
@@ -0,0 +1,5 @@
1
+ # function 4x
2
+ #
3
+ # This is a function which is used to test puppet strings
4
+ Puppet::Functions.create_function(:function4x) do
5
+ end
@@ -0,0 +1,2 @@
1
+ Puppet::Parser::Functions.newfunction(:function3x, :doc => "This is the function documentation for `function3x`") do |args|
2
+ end
@@ -0,0 +1,9 @@
1
+ Puppet::Type.type(:database).provide :linux do
2
+ confine 'osfamily' => 'linux'
3
+ defaultfor 'osfamily' => 'linux'
4
+ commands :database => '/usr/bin/database'
5
+
6
+ desc 'The database provider on Linux.'
7
+
8
+ # ...
9
+ end
@@ -0,0 +1,15 @@
1
+ # @!puppet.type.param [value1, value2, value3] my_param Documentation for a dynamic parameter.
2
+ # @!puppet.type.property [foo, bar, baz] my_prop Documentation for a dynamic property.
3
+ Puppet::Type.newtype(:database) do
4
+ desc 'An example server resource type.'
5
+ feature :encryption, 'The provider supports encryption.', methods: [:encrypt]
6
+
7
+ newparam(:address) do
8
+ isnamevar
9
+ desc 'The database server name.'
10
+ end
11
+
12
+ newproperty(:file) do
13
+ desc 'The database file to use.'
14
+ end
15
+ end
@@ -0,0 +1,27 @@
1
+ # Class: test
2
+ #
3
+ # This class exists to serve as fixture data for testing the puppet strings face
4
+ #
5
+ # @example
6
+ # class { "test": }
7
+ #
8
+ # @param package_name The name of the package
9
+ # @param service_name The name of the service
10
+ class test (
11
+ $package_name = $test::params::package_name,
12
+ $service_name = $test::params::service_name,
13
+
14
+ ) inherits test::params {
15
+
16
+ # validate parameters here
17
+
18
+ class { 'test::install': } ->
19
+ class { 'test::config': } ~>
20
+ class { 'test::service': } ->
21
+ Class['test']
22
+
23
+ File {
24
+ owner => 'user',
25
+ path => 'some/file/path',
26
+ }
27
+ }
@@ -0,0 +1,27 @@
1
+ # Testing tested classes
2
+ # docs stuff
3
+ # @param nameservers [String] Don't ask me what this does!
4
+ # @param default_lease_time [Integer[1024, 8192]] text goes here
5
+ # @param max_lease_time does stuff
6
+ class outer (
7
+ $dnsdomain,
8
+ $nameservers,
9
+ $default_lease_time = 3600,
10
+ $max_lease_time = 86400
11
+ ) {
12
+ # @param options [String[5,7]] gives user choices
13
+ # @param multicast [Boolean] foobar
14
+ # @param servers yep, that's right
15
+ class middle (
16
+ $options = "iburst",
17
+ $servers,
18
+ $multicast = false
19
+ ) {
20
+ class inner (
21
+ $choices = "uburst",
22
+ $secenekler = "weallburst",
23
+ $boxen,
24
+ $manyspell = true
25
+ ) {}
26
+ }
27
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "username-test",
3
+ "version": "0.0.1",
4
+ "author": "username",
5
+ "license": "Apache 2.0"
6
+ }
@@ -0,0 +1,348 @@
1
+ {
2
+ "puppet_classes": [
3
+ {
4
+ "name": "klass",
5
+ "file": "(stdin)",
6
+ "line": 5,
7
+ "inherits": "foo::bar",
8
+ "docstring": {
9
+ "text": "A simple class.",
10
+ "tags": [
11
+ {
12
+ "tag_name": "param",
13
+ "text": "First param.",
14
+ "types": [
15
+ "Integer"
16
+ ],
17
+ "name": "param1"
18
+ },
19
+ {
20
+ "tag_name": "param",
21
+ "text": "Second param.",
22
+ "types": [
23
+ "Any"
24
+ ],
25
+ "name": "param2"
26
+ },
27
+ {
28
+ "tag_name": "param",
29
+ "text": "Third param.",
30
+ "types": [
31
+ "String"
32
+ ],
33
+ "name": "param3"
34
+ }
35
+ ]
36
+ },
37
+ "defaults": {
38
+ "param3": "hi"
39
+ },
40
+ "source": "class klass(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {\n}"
41
+ }
42
+ ],
43
+ "defined_types": [
44
+ {
45
+ "name": "dt",
46
+ "file": "(stdin)",
47
+ "line": 12,
48
+ "docstring": {
49
+ "text": "A simple defined type.",
50
+ "tags": [
51
+ {
52
+ "tag_name": "param",
53
+ "text": "First param.",
54
+ "types": [
55
+ "Integer"
56
+ ],
57
+ "name": "param1"
58
+ },
59
+ {
60
+ "tag_name": "param",
61
+ "text": "Second param.",
62
+ "types": [
63
+ "Any"
64
+ ],
65
+ "name": "param2"
66
+ },
67
+ {
68
+ "tag_name": "param",
69
+ "text": "Third param.",
70
+ "types": [
71
+ "String"
72
+ ],
73
+ "name": "param3"
74
+ }
75
+ ]
76
+ },
77
+ "defaults": {
78
+ "param3": "hi"
79
+ },
80
+ "source": "define dt(Integer $param1, $param2, String $param3 = hi) {\n}"
81
+ }
82
+ ],
83
+ "resource_types": [
84
+ {
85
+ "name": "database",
86
+ "file": "(stdin)",
87
+ "line": 43,
88
+ "docstring": {
89
+ "text": "An example database server resource type."
90
+ },
91
+ "properties": [
92
+ {
93
+ "name": "ensure",
94
+ "description": "What state the database should be in.",
95
+ "values": [
96
+ "present",
97
+ "absent",
98
+ "up",
99
+ "down"
100
+ ],
101
+ "aliases": {
102
+ "up": "present",
103
+ "down": "absent"
104
+ },
105
+ "default": "up"
106
+ },
107
+ {
108
+ "name": "file",
109
+ "description": "The database file to use."
110
+ },
111
+ {
112
+ "name": "log_level",
113
+ "description": "The log level to use.",
114
+ "values": [
115
+ "debug",
116
+ "warn",
117
+ "error"
118
+ ],
119
+ "default": "warn"
120
+ }
121
+ ],
122
+ "parameters": [
123
+ {
124
+ "name": "address",
125
+ "description": "The database server name.",
126
+ "isnamevar": true
127
+ },
128
+ {
129
+ "name": "encryption_key",
130
+ "description": "The encryption key to use."
131
+ },
132
+ {
133
+ "name": "encrypt",
134
+ "description": "Whether or not to encrypt the database.",
135
+ "values": [
136
+ "true",
137
+ "false",
138
+ "yes",
139
+ "no"
140
+ ],
141
+ "default": "false"
142
+ }
143
+ ],
144
+ "features": [
145
+ {
146
+ "name": "encryption",
147
+ "description": "The provider supports encryption."
148
+ }
149
+ ]
150
+ }
151
+ ],
152
+ "providers": [
153
+ {
154
+ "name": "linux",
155
+ "type_name": "database",
156
+ "file": "(stdin)",
157
+ "line": 33,
158
+ "docstring": {
159
+ "text": "An example provider on Linux."
160
+ },
161
+ "confines": {
162
+ "kernel": "Linux",
163
+ "osfamily": "RedHat"
164
+ },
165
+ "features": [
166
+ "implements_some_feature",
167
+ "some_other_feature"
168
+ ],
169
+ "defaults": {
170
+ "kernel": "Linux"
171
+ },
172
+ "commands": {
173
+ "foo": "/usr/bin/foo"
174
+ }
175
+ }
176
+ ],
177
+ "puppet_functions": [
178
+ {
179
+ "name": "func",
180
+ "file": "(stdin)",
181
+ "line": 6,
182
+ "type": "puppet",
183
+ "signature": "func(Integer $param1, Any $param2, String $param3 = hi)",
184
+ "docstring": {
185
+ "text": "A simple function.",
186
+ "tags": [
187
+ {
188
+ "tag_name": "param",
189
+ "text": "First param.",
190
+ "types": [
191
+ "Integer"
192
+ ],
193
+ "name": "param1"
194
+ },
195
+ {
196
+ "tag_name": "param",
197
+ "text": "Second param.",
198
+ "types": [
199
+ "Any"
200
+ ],
201
+ "name": "param2"
202
+ },
203
+ {
204
+ "tag_name": "param",
205
+ "text": "Third param.",
206
+ "types": [
207
+ "String"
208
+ ],
209
+ "name": "param3"
210
+ },
211
+ {
212
+ "tag_name": "return",
213
+ "text": "Returns nothing.",
214
+ "types": [
215
+ "Undef"
216
+ ]
217
+ }
218
+ ]
219
+ },
220
+ "defaults": {
221
+ "param3": "hi"
222
+ },
223
+ "source": "function func(Integer $param1, $param2, String $param3 = hi) {\n}"
224
+ },
225
+ {
226
+ "name": "func3x",
227
+ "file": "(stdin)",
228
+ "line": 1,
229
+ "type": "ruby3x",
230
+ "signature": "func3x(String $first, Any $second)",
231
+ "docstring": {
232
+ "text": "An example 3.x function.",
233
+ "tags": [
234
+ {
235
+ "tag_name": "param",
236
+ "text": "The first parameter.",
237
+ "types": [
238
+ "String"
239
+ ],
240
+ "name": "first"
241
+ },
242
+ {
243
+ "tag_name": "param",
244
+ "text": "The second parameter.",
245
+ "types": [
246
+ "Any"
247
+ ],
248
+ "name": "second"
249
+ },
250
+ {
251
+ "tag_name": "return",
252
+ "text": "Returns nothing.",
253
+ "types": [
254
+ "Undef"
255
+ ]
256
+ }
257
+ ]
258
+ },
259
+ "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"
260
+ },
261
+ {
262
+ "name": "func4x",
263
+ "file": "(stdin)",
264
+ "line": 11,
265
+ "type": "ruby4x",
266
+ "docstring": {
267
+ "text": "An example 4.x function.",
268
+ "tags": [
269
+ {
270
+ "tag_name": "overload",
271
+ "signature": "func4x(Integer $param1, Any $param2, Optional[Array[String]] $param3)",
272
+ "docstring": {
273
+ "text": "The first overload.",
274
+ "tags": [
275
+ {
276
+ "tag_name": "param",
277
+ "text": "The first parameter.",
278
+ "types": [
279
+ "Integer"
280
+ ],
281
+ "name": "param1"
282
+ },
283
+ {
284
+ "tag_name": "param",
285
+ "text": "The second parameter.",
286
+ "types": [
287
+ "Any"
288
+ ],
289
+ "name": "param2"
290
+ },
291
+ {
292
+ "tag_name": "param",
293
+ "text": "The third parameter.",
294
+ "types": [
295
+ "Optional[Array[String]]"
296
+ ],
297
+ "name": "param3"
298
+ },
299
+ {
300
+ "tag_name": "return",
301
+ "text": "Returns nothing.",
302
+ "types": [
303
+ "Undef"
304
+ ]
305
+ }
306
+ ]
307
+ },
308
+ "name": "func4x"
309
+ },
310
+ {
311
+ "tag_name": "overload",
312
+ "signature": "func4x(Boolean $param, Callable &$block)",
313
+ "docstring": {
314
+ "text": "The second overload.",
315
+ "tags": [
316
+ {
317
+ "tag_name": "param",
318
+ "text": "The first parameter.",
319
+ "types": [
320
+ "Boolean"
321
+ ],
322
+ "name": "param"
323
+ },
324
+ {
325
+ "tag_name": "param",
326
+ "text": "The block parameter.",
327
+ "types": [
328
+ "Callable"
329
+ ],
330
+ "name": "&block"
331
+ },
332
+ {
333
+ "tag_name": "return",
334
+ "text": "Returns a string.",
335
+ "types": [
336
+ "String"
337
+ ]
338
+ }
339
+ ]
340
+ },
341
+ "name": "func4x"
342
+ }
343
+ ]
344
+ },
345
+ "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"
346
+ }
347
+ ]
348
+ }