puppet-strings 2.3.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +102 -4
  3. data/COMMITTERS.md +17 -17
  4. data/CONTRIBUTING.md +37 -7
  5. data/README.md +17 -12
  6. data/lib/puppet-strings.rb +5 -3
  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 +30 -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 +18 -6
  27. data/lib/puppet-strings/markdown/templates/data_type.erb +30 -7
  28. data/lib/puppet-strings/markdown/templates/data_type_function.erb +67 -0
  29. data/lib/puppet-strings/markdown/templates/function.erb +10 -1
  30. data/lib/puppet-strings/markdown/templates/puppet_task.erb +1 -1
  31. data/lib/puppet-strings/markdown/templates/resource_type.erb +35 -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 +9 -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 +8 -5
  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 +3 -1
  50. data/lib/puppet-strings/yard/code_objects/type.rb +49 -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 +225 -52
  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 +6 -3
  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 +4 -0
  75. data/lib/puppet-strings/yard/tags/enum_tag.rb +14 -0
  76. data/lib/puppet-strings/yard/tags/factory.rb +18 -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/templates/default/tags/html/enum.erb +17 -0
  86. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +6 -0
  87. data/lib/puppet-strings/yard/util.rb +7 -4
  88. data/lib/puppet/application/strings.rb +2 -0
  89. data/lib/puppet/face/strings.rb +4 -1
  90. data/lib/puppet/feature/rgen.rb +2 -0
  91. data/lib/puppet/feature/yard.rb +2 -0
  92. metadata +14 -51
  93. data/Gemfile +0 -47
  94. data/HISTORY.md +0 -218
  95. data/JSON.md +0 -832
  96. data/Rakefile +0 -168
  97. data/codecov.yml +0 -3
  98. data/misc/ANNOUNCEMENT_TEMPLATE.md +0 -40
  99. data/spec/acceptance/emit_json_options_spec.rb +0 -69
  100. data/spec/acceptance/generate_markdown_spec.rb +0 -47
  101. data/spec/acceptance/running_strings_generate_spec.rb +0 -78
  102. data/spec/fixtures/acceptance/modules/test/functions/add.pp +0 -9
  103. data/spec/fixtures/acceptance/modules/test/lib/puppet/functions/4x_function.rb +0 -5
  104. data/spec/fixtures/acceptance/modules/test/lib/puppet/parser/functions/function3x.rb +0 -2
  105. data/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb +0 -9
  106. data/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb +0 -15
  107. data/spec/fixtures/acceptance/modules/test/manifests/init.pp +0 -27
  108. data/spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp +0 -27
  109. data/spec/fixtures/acceptance/modules/test/metadata.json +0 -10
  110. data/spec/fixtures/acceptance/modules/test/types/elephant.pp +0 -2
  111. data/spec/fixtures/unit/markdown/output.md +0 -508
  112. data/spec/fixtures/unit/markdown/output_with_data_types.md +0 -553
  113. data/spec/fixtures/unit/markdown/output_with_plan.md +0 -542
  114. data/spec/spec_helper.rb +0 -49
  115. data/spec/spec_helper_acceptance.rb +0 -58
  116. data/spec/spec_helper_acceptance_local.rb +0 -10
  117. data/spec/unit/puppet-strings/describe_spec.rb +0 -141
  118. data/spec/unit/puppet-strings/json_spec.rb +0 -302
  119. data/spec/unit/puppet-strings/markdown/base_spec.rb +0 -146
  120. data/spec/unit/puppet-strings/markdown_spec.rb +0 -357
  121. data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +0 -92
  122. data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +0 -116
  123. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +0 -217
  124. data/spec/unit/puppet-strings/yard/handlers/puppet/data_type_alias_handler_spec.rb +0 -65
  125. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +0 -231
  126. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +0 -315
  127. data/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb +0 -232
  128. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +0 -746
  129. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +0 -158
  130. data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +0 -235
  131. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +0 -311
  132. data/spec/unit/puppet-strings/yard/parsers/json/parser_spec.rb +0 -72
  133. data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +0 -56
  134. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +0 -251
  135. data/spec/unit/puppet-strings/yard/util_spec.rb +0 -48
data/Rakefile DELETED
@@ -1,168 +0,0 @@
1
- require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
2
- require 'puppetlabs_spec_helper/tasks/fixtures'
3
- require 'bundler/gem_tasks'
4
- require 'puppet-lint/tasks/puppet-lint'
5
-
6
- require 'rspec/core/rake_task'
7
- RSpec::Core::RakeTask.new(:spec) do |t|
8
- t.exclude_pattern = "spec/acceptance/**/*.rb"
9
- end
10
-
11
- # Add our own tasks
12
- require 'puppet-strings/tasks'
13
-
14
- PuppetLint.configuration.send('disable_80chars')
15
- PuppetLint.configuration.ignore_paths = %w(acceptance/**/*.pp spec/**/*.pp pkg/**/*.pp)
16
-
17
- desc 'Validate Ruby source files and ERB templates.'
18
- task :validate do
19
- Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
20
- sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
21
- end
22
- Dir['lib/puppet-strings/yard/templates/**/*.erb'].each do |template|
23
- sh "erb -P -x -T '-' #{template} | ruby -c"
24
- end
25
- end
26
-
27
- namespace :litmus do
28
- # Install the puppet module fixture on a collection of nodes
29
- #
30
- # @param :target_node_name [Array] nodes on which to install a puppet module for testing.
31
- desc 'install_module_fixtures - build and install module fixtures'
32
- task :install_module_fixtures, [:target_node_name] do |_task, args|
33
- inventory_hash = inventory_hash_from_inventory_file
34
- target_nodes = find_targets(inventory_hash, args[:target_node_name])
35
- if target_nodes.empty?
36
- puts 'No targets found'
37
- exit 0
38
- end
39
- include BoltSpec::Run
40
- require 'pdk/module/build'
41
-
42
- module_fixture_dir = File.expand_path(File.join(File.dirname(__FILE__), 'spec', 'fixtures', 'acceptance', 'modules', 'test'))
43
- module_tar = nil
44
- Dir.chdir(module_fixture_dir) do
45
- opts = {}
46
- opts[:force] = true
47
- builder = PDK::Module::Build.new(opts)
48
- module_tar = builder.build
49
- puts 'Built'
50
- module_tar = Dir.glob('pkg/*.tar.gz').max_by { |f| File.mtime(f) }
51
- raise "Unable to find package in 'pkg/*.tar.gz'" if module_tar.nil?
52
- module_tar = File.expand_path(module_tar)
53
- end
54
-
55
- target_string = if args[:target_node_name].nil?
56
- 'all'
57
- else
58
- args[:target_node_name]
59
- end
60
- # TODO: Currently this is Linux only
61
- tmp_path = '/tmp/'
62
- run_local_command("bundle exec bolt file upload #{module_tar} #{tmp_path}#{File.basename(module_tar)} --nodes #{target_string} --inventoryfile inventory.yaml")
63
- install_module_command = "puppet module install #{tmp_path}#{File.basename(module_tar)}"
64
- result = run_command(install_module_command, target_nodes, config: nil, inventory: inventory_hash)
65
- if result.is_a?(Array)
66
- result.each do |node|
67
- puts "#{node['node']} failed #{node['result']}" if node['status'] != 'success'
68
- end
69
- else
70
- raise "Failed trying to run '#{install_module_command}' against inventory."
71
- end
72
- puts 'Installed'
73
- end
74
-
75
- def install_remote_gem(gem_name, target_nodes, inventory_hash)
76
- # TODO: Currently this is Linux only
77
- install_command = "/opt/puppetlabs/puppet/bin/gem install #{gem_name}"
78
- result = run_command(install_command, target_nodes, config: nil, inventory: inventory_hash)
79
- if result.is_a?(Array)
80
- result.each do |node|
81
- puts "#{node['node']} failed #{node['result']}" if node['status'] != 'success'
82
- end
83
- else
84
- raise "Failed trying to run '#{install_command}' against inventory."
85
- end
86
- end
87
-
88
- # Install the gem under test and required fixture on a collection of nodes
89
- #
90
- # @param :target_node_name [Array] nodes on which to install a puppet module for testing.
91
- desc 'install_gems - build and install module fixtures'
92
- task :install_gems, [:target_node_name] do |_task, args|
93
- inventory_hash = inventory_hash_from_inventory_file
94
- target_nodes = find_targets(inventory_hash, args[:target_node_name])
95
- if target_nodes.empty?
96
- puts 'No targets found'
97
- exit 0
98
- end
99
- include BoltSpec::Run
100
-
101
- # Build the gem
102
- `gem build puppet-strings.gemspec --quiet`
103
- result = $CHILD_STATUS
104
- raise "Unable to build the puppet-strings gem. Returned exit code #{result.exitstatus}" unless result.exitstatus.zero?
105
- puts 'Built'
106
- # Find the gem build artifact
107
- gem_tar = Dir.glob('puppet-strings-*.gem').max_by { |f| File.mtime(f) }
108
- raise "Unable to find package in 'puppet-strings-*.gem'" if gem_tar.nil?
109
- gem_tar = File.expand_path(gem_tar)
110
-
111
- target_string = if args[:target_node_name].nil?
112
- 'all'
113
- else
114
- args[:target_node_name]
115
- end
116
- # TODO: Currently this is Linux only
117
- tmp_path = '/tmp/'
118
- run_local_command("bundle exec bolt file upload #{gem_tar} #{tmp_path}#{File.basename(gem_tar)} --nodes #{target_string} --inventoryfile inventory.yaml")
119
-
120
-
121
- # Install dependent gems
122
- install_remote_gem('yard', target_nodes, inventory_hash)
123
- install_remote_gem('rgen', target_nodes, inventory_hash)
124
- # Install puppet-strings
125
- install_remote_gem(tmp_path + File.basename(gem_tar), target_nodes, inventory_hash)
126
- puts 'Installed'
127
- end
128
- end
129
-
130
- task(:rubocop) do
131
- require 'rubocop'
132
- cli = RuboCop::CLI.new
133
- result = cli.run(%w(-D -f s))
134
- abort unless result == RuboCop::CLI::STATUS_SUCCESS
135
- end
136
-
137
- #### CHANGELOG ####
138
- begin
139
- require 'github_changelog_generator/task'
140
- GitHubChangelogGenerator::RakeTask.new :changelog do |config|
141
- require 'puppet-strings/version'
142
- config.future_release = "v#{PuppetStrings::VERSION}"
143
- config.header = "# Changelog\n\n" \
144
- "All significant changes to this repo will be summarized in this file.\n"
145
- config.configure_sections = {
146
- added: {
147
- prefix: "Added",
148
- labels: ["enhancement"]
149
- },
150
- fixed: {
151
- prefix: "Fixed",
152
- labels: ["bugfix"]
153
- },
154
- breaking: {
155
- prefix: "Changed",
156
- labels: ["backwards-incompatible"]
157
- }
158
- }
159
- config.exclude_labels = ['maintenance']
160
- config.user = 'puppetlabs'
161
- config.project = 'puppet-strings'
162
- end
163
- rescue LoadError
164
- desc 'Install github_changelog_generator to get access to automatic changelog generation'
165
- task :changelog do
166
- raise 'Install github_changelog_generator to get access to automatic changelog generation'
167
- end
168
- end
data/codecov.yml DELETED
@@ -1,3 +0,0 @@
1
- ---
2
- # disable comments, info can be gotten from the pr status updates, and the comment editing spams the hipchat notifications
3
- comment: false
@@ -1,40 +0,0 @@
1
- Send out announcements for major new feature releases, and high-impact bugfixes to <puppet-announce@googlegroups.com>, <puppet-dev@googlegroups.com>, <puppet-users@googlegroups.com>, <voxpupuli@groups.io>, and the puppet internal mailing lists <dev@puppet.com> and <tech-discuss@puppet.com>.
2
-
3
- Before sending, do check that all links are still valid. Feel free to adjust the text to match better with the circumstances of the release, or add other news that are relevant at the time. If you make changes, consider committing them here, for the benefit of future-you.
4
-
5
- The github rendering of the markdown seems to copy&paste acceptably into Google Inbox.
6
-
7
- The [CHANGELOG](https://github.com/puppetlabs/puppet-strings/blob/master/CHANGELOG.md) is a good starting point for finding enhancements and bug-fixes.
8
-
9
- ---
10
-
11
- Subject: [ANN] Puppet Strings vX.Y.Z Release
12
-
13
- Hi all,
14
-
15
- We're pleased to announce that version X.Y.Z of the Puppet Strings is being released today.
16
-
17
- Puppet Strings provides a simple way to extract source documentation into useful docs. It is provided as a Ruby gem to be referenced within modules. See the [README](https://github.com/puppetlabs/puppet-strings#installing-puppet-strings) for documentation on how to install and use it.
18
-
19
-
20
- The new release of Puppet Strings provides the following enhancements:
21
-
22
- * A
23
- * B
24
- * C
25
-
26
- The new release also contains the following notable bugfixes:
27
-
28
- * D
29
- * E
30
- * F
31
-
32
- See the [CHANGELOG](https://github.com/puppetlabs/puppet-strings/blob/master/CHANGELOG.md) for a full list of changes
33
-
34
- We encourage all module developers to review puppet-strings and use it when creating modules.
35
-
36
- Please let us know of your experiences with Puppet Strings, either here, on [Slack](https://slack.puppet.com/) (#forge-modules), or on the [github repo](https://github.com/puppetlabs/puppet-strings).
37
-
38
-
39
- Thanks,
40
- YOUR NAME
@@ -1,69 +0,0 @@
1
- require 'spec_helper_acceptance'
2
-
3
- describe 'Emitting JSON' do
4
- before(:all) do
5
- @test_module_path = sut_module_path(/Module test/)
6
- @remote_tmp_path = sut_tmp_path
7
- end
8
-
9
- let(:expected) do
10
- {
11
- "puppet_classes" => [],
12
- "data_types" => [],
13
- "data_type_aliases" => [],
14
- "defined_types" => [],
15
- "resource_types" => [],
16
- "providers" => [],
17
- "puppet_functions" => [
18
- "name" => "function3x",
19
- "file" => "#{@test_module_path}/lib/puppet/parser/functions/function3x.rb",
20
- "line" => 1,
21
- "type" => "ruby3x",
22
- "signatures" => [
23
- {
24
- "signature" =>"function3x()",
25
- "docstring" => {
26
- "text" => "This is the function documentation for `function3x`",
27
- "tags" => [
28
- {
29
- "tag_name"=>"return",
30
- "text"=>"",
31
- "types"=>["Any"]
32
- }
33
- ]
34
- }
35
- },
36
- ],
37
- "docstring" => {
38
- "text" => "This is the function documentation for `function3x`",
39
- "tags" => ["tag_name" => "return", "text" => "", "types" => ["Any"]]},
40
- "source" => "Puppet::Parser::Functions.newfunction(:function3x, :doc => \"This is the function documentation for `function3x`\") do |args|\nend"
41
- ],
42
- "puppet_tasks" => [],
43
- "puppet_plans" => []
44
- }
45
- end
46
-
47
- [
48
- { :title => '--format json and STDOUT', :cmd_line => '--format json' },
49
- { :title => '--emit-json-stdout', :cmd_line => '--emit-json-stdout' }
50
- ].each do |testcase|
51
- it "should emit JSON to stdout when using #{testcase[:title]}" do
52
- output = PuppetLitmus::Serverspec.run_shell("puppet strings generate #{testcase[:cmd_line]} \"#{@test_module_path}/lib/puppet/parser/functions/function3x.rb\"").stdout.chomp
53
- expect(JSON.parse(output)).to eq(expected)
54
- end
55
- end
56
-
57
- [
58
- { :title => '--format json and --out', :cmd_line => '--format json --out "TMPFILE"' },
59
- { :title => '--emit-json', :cmd_line => '--emit-json "TMPFILE"' },
60
- ].each do |testcase|
61
- it "should write JSON to a file when using #{testcase[:title]}" do
62
- tmpfile = File.join(@remote_tmp_path, 'json_output.json')
63
- cmd = "puppet strings generate #{testcase[:cmd_line].gsub('TMPFILE', tmpfile)} \"#{@test_module_path}/lib/puppet/parser/functions/function3x.rb\""
64
- PuppetLitmus::Serverspec.run_shell(cmd)
65
- output = JSON.parse(file(tmpfile).content)
66
- expect(output).to eq(expected)
67
- end
68
- end
69
- end
@@ -1,47 +0,0 @@
1
- require 'spec_helper_acceptance'
2
-
3
- describe 'Generating Markdown' do
4
- before(:all) do
5
- @test_module_path = sut_module_path(/Module test/)
6
- @remote_tmp_path = sut_tmp_path
7
- end
8
-
9
- expected = <<-EOF
10
- # Reference
11
-
12
- ## Classes
13
- * [`test`](#test): This class exists to serve as fixture data for testing the puppet strings face
14
-
15
- ## Classes
16
-
17
- ### test
18
-
19
- #### Examples
20
- ```puppet
21
- class { "test": }
22
- ```
23
-
24
- #### Parameters
25
-
26
- ##### `package_name`
27
-
28
- The name of the package
29
-
30
- ##### `service_name`
31
-
32
- The name of the service
33
-
34
- EOF
35
-
36
- it 'should render Markdown to stdout when using --format markdown' do
37
- skip('This test is broken. Does not output to STDOUT by default.')
38
- output = PuppetLitmus::Serverspec.run_shell("puppet strings generate --format markdown \"#{@test_module_path}/manifests/init.pp\"").stdout.chomp
39
- expect(output).to eq(expected)
40
- end
41
-
42
- it 'should write Markdown to a file when using --format markdown and --out' do
43
- tmpfile = File.join(@remote_tmp_path, 'md_output.md')
44
- remote = PuppetLitmus::Serverspec.run_shell("puppet strings generate --format markdown --out \"#{tmpfile}\" \"#{@test_module_path}/manifests/init.pp\"")
45
- expect(file(tmpfile)).to contain expected
46
- end
47
- end
@@ -1,78 +0,0 @@
1
- require 'spec_helper_acceptance'
2
- include PuppetLitmus # rubocop:disable Style/MixinUsage This is fine
3
-
4
- describe 'Generating module documentation using generate action' do
5
- before :all do
6
- # TODO: Linux only
7
- @sut_work_dir = PuppetLitmus::Serverspec.run_shell("pwd").stdout.chomp
8
-
9
- test_module_path = sut_module_path(/Module test/)
10
- PuppetLitmus::Serverspec.run_shell("puppet strings generate \"#{test_module_path}/**/*.{rb,pp}\"")
11
- end
12
-
13
- def expect_file_contain(path, expected_contents)
14
- file_path = File.join(@sut_work_dir, path)
15
- file_content = file(file_path).content
16
- expected_contents.each do |expected|
17
- expect(file_content).to include(expected)
18
- end
19
- end
20
-
21
- it 'should generate documentation for manifests' do
22
- expect_file_contain('doc/puppet_classes/test.html', ['Class: test'])
23
- end
24
-
25
- it 'should generate documentation for puppet functions' do
26
- skip('This test is failing. Appear to be legitimate failures.')
27
- expect_file_contain('doc/puppet_functions_puppet/test_3A_3Aadd.html', [
28
- 'Adds two integers together.',
29
- # These tests are failing. Appear to be legitimate failures.
30
- '<p>The first integer to add.</p>',
31
- '<p>The second integer to add.</p>',
32
- '<p>Returns the sum of x and y.</p>'
33
- ])
34
- end
35
-
36
- it 'should generate documentation for 3x functions' do
37
- expect_file_contain('doc/puppet_functions_ruby3x/function3x.html', ['This is the function documentation for <code>function3x</code>'])
38
- end
39
-
40
- it 'should generate documentation for 4x functions' do
41
- expect_file_contain('doc/puppet_functions_ruby4x/function4x.html', ['This is a function which is used to test puppet strings'])
42
- end
43
-
44
- it 'should generate documentation for custom types' do
45
- expect_file_contain('doc/puppet_types/database.html', [
46
- '<p>An example server resource type.</p>',
47
- '<p>The database file to use.</p>',
48
- '<p>Documentation for a dynamic property.</p>',
49
- '<p>The database server name.</p>',
50
- '<p>Documentation for a dynamic parameter.</p>',
51
- '<p>The provider supports encryption.</p>',
52
- ])
53
- end
54
-
55
- it 'should generate documentation for custom providers' do
56
- expect_file_contain('doc/puppet_providers_database/linux.html', [
57
- 'The database provider on Linux',
58
- '<tt>osfamily &mdash; linux</tt>',
59
- '<tt>database &mdash; /usr/bin/database</tt>',
60
- ])
61
- end
62
-
63
- it 'should generate documentation for puppet data types' do
64
- expect_file_contain('doc/puppet_types/database.html', [
65
- 'Resource Type: database',
66
- 'type/database.rb',
67
- 'An example server resource type.',
68
- ])
69
- end
70
-
71
- it 'should generate documentation for puppet data type aliases' do
72
- expect_file_contain('doc/puppet_data_type_aliases/Test_3A_3AElephant.html', [
73
- 'Data Type: Test::Elephant',
74
- 'types/elephant.pp',
75
- 'A simple elephant type.',
76
- ])
77
- end
78
- end
@@ -1,9 +0,0 @@
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
- }
@@ -1,5 +0,0 @@
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
@@ -1,2 +0,0 @@
1
- Puppet::Parser::Functions.newfunction(:function3x, :doc => "This is the function documentation for `function3x`") do |args|
2
- end
@@ -1,9 +0,0 @@
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