puppet-strings 2.1.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -4
  3. data/CONTRIBUTING.md +32 -2
  4. data/README.md +81 -17
  5. data/lib/puppet-strings.rb +13 -4
  6. data/lib/puppet-strings/describe.rb +68 -0
  7. data/lib/puppet-strings/json.rb +2 -38
  8. data/lib/puppet-strings/markdown.rb +3 -1
  9. data/lib/puppet-strings/markdown/base.rb +37 -16
  10. data/lib/puppet-strings/markdown/data_type.rb +34 -0
  11. data/lib/puppet-strings/markdown/data_types.rb +41 -0
  12. data/lib/puppet-strings/markdown/function.rb +2 -2
  13. data/lib/puppet-strings/markdown/resource_type.rb +19 -2
  14. data/lib/puppet-strings/markdown/table_of_contents.rb +1 -0
  15. data/lib/puppet-strings/markdown/templates/classes_and_defines.erb +12 -4
  16. data/lib/puppet-strings/markdown/templates/data_type.erb +93 -0
  17. data/lib/puppet-strings/markdown/templates/data_type_function.erb +67 -0
  18. data/lib/puppet-strings/markdown/templates/function.erb +36 -1
  19. data/lib/puppet-strings/markdown/templates/puppet_task.erb +1 -1
  20. data/lib/puppet-strings/markdown/templates/resource_type.erb +32 -12
  21. data/lib/puppet-strings/markdown/templates/table_of_contents.erb +6 -6
  22. data/lib/puppet-strings/tasks/generate.rb +10 -3
  23. data/lib/puppet-strings/version.rb +1 -1
  24. data/lib/puppet-strings/yard.rb +16 -0
  25. data/lib/puppet-strings/yard/code_objects.rb +2 -0
  26. data/lib/puppet-strings/yard/code_objects/class.rb +2 -2
  27. data/lib/puppet-strings/yard/code_objects/data_type.rb +100 -0
  28. data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +58 -0
  29. data/lib/puppet-strings/yard/code_objects/defined_type.rb +2 -2
  30. data/lib/puppet-strings/yard/code_objects/function.rb +4 -4
  31. data/lib/puppet-strings/yard/code_objects/plan.rb +2 -2
  32. data/lib/puppet-strings/yard/code_objects/provider.rb +1 -1
  33. data/lib/puppet-strings/yard/code_objects/task.rb +1 -1
  34. data/lib/puppet-strings/yard/code_objects/type.rb +48 -6
  35. data/lib/puppet-strings/yard/handlers.rb +3 -0
  36. data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +24 -0
  37. data/lib/puppet-strings/yard/handlers/ruby/base.rb +12 -1
  38. data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +393 -0
  39. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +2 -12
  40. data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +1 -9
  41. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +3 -3
  42. data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +135 -0
  43. data/lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb +56 -0
  44. data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +9 -115
  45. data/lib/puppet-strings/yard/parsers/json/parser.rb +4 -2
  46. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +14 -7
  47. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +25 -0
  48. data/lib/puppet-strings/yard/tags.rb +2 -0
  49. data/lib/puppet-strings/yard/tags/enum_tag.rb +12 -0
  50. data/lib/puppet-strings/yard/tags/factory.rb +16 -0
  51. data/lib/puppet-strings/yard/tags/overload_tag.rb +2 -2
  52. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_data_type.erb +10 -0
  53. data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +9 -0
  54. data/lib/puppet-strings/yard/templates/default/layout/html/objects.erb +2 -0
  55. data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +18 -1
  56. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/box_info.erb +10 -0
  57. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/header.erb +1 -0
  58. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/method_details_list.erb +6 -0
  59. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/note.erb +6 -0
  60. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/overview.erb +6 -0
  61. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb +13 -0
  62. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/source.erb +12 -0
  63. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/summary.erb +4 -0
  64. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/todo.erb +6 -0
  65. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/alias_of.erb +10 -0
  66. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/box_info.erb +10 -0
  67. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/header.erb +1 -0
  68. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/note.erb +6 -0
  69. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/overview.erb +6 -0
  70. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb +17 -0
  71. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/source.erb +12 -0
  72. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/summary.erb +4 -0
  73. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/todo.erb +6 -0
  74. data/lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb +3 -1
  75. data/lib/puppet-strings/yard/templates/default/tags/html/enum.erb +17 -0
  76. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +7 -0
  77. data/lib/puppet-strings/yard/util.rb +48 -0
  78. data/lib/puppet/face/strings.rb +68 -3
  79. metadata +36 -45
  80. data/Gemfile +0 -37
  81. data/HISTORY.md +0 -218
  82. data/JSON.md +0 -802
  83. data/Rakefile +0 -93
  84. data/codecov.yml +0 -3
  85. data/misc/ANNOUNCEMENT_TEMPLATE.md +0 -40
  86. data/spec/acceptance/emit_json_options.rb +0 -71
  87. data/spec/acceptance/generate_markdown_spec.rb +0 -49
  88. data/spec/acceptance/lib/util.rb +0 -163
  89. data/spec/acceptance/running_strings_generate.rb +0 -54
  90. data/spec/fixtures/acceptance/modules/test/functions/add.pp +0 -9
  91. data/spec/fixtures/acceptance/modules/test/lib/puppet/functions/4x_function.rb +0 -5
  92. data/spec/fixtures/acceptance/modules/test/lib/puppet/parser/functions/function3x.rb +0 -2
  93. data/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb +0 -9
  94. data/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb +0 -15
  95. data/spec/fixtures/acceptance/modules/test/manifests/init.pp +0 -27
  96. data/spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp +0 -27
  97. data/spec/fixtures/acceptance/modules/test/metadata.json +0 -6
  98. data/spec/fixtures/unit/json/output.json +0 -660
  99. data/spec/fixtures/unit/json/output_with_plan.json +0 -697
  100. data/spec/fixtures/unit/json/output_without_puppet_function.json +0 -480
  101. data/spec/fixtures/unit/markdown/output.md +0 -444
  102. data/spec/fixtures/unit/markdown/output_with_plan.md +0 -478
  103. data/spec/spec_helper.rb +0 -45
  104. data/spec/spec_helper_acceptance.rb +0 -28
  105. data/spec/unit/puppet-strings/json_spec.rb +0 -229
  106. data/spec/unit/puppet-strings/markdown/base_spec.rb +0 -146
  107. data/spec/unit/puppet-strings/markdown_spec.rb +0 -283
  108. data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +0 -92
  109. data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +0 -124
  110. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +0 -217
  111. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +0 -231
  112. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +0 -315
  113. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +0 -729
  114. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +0 -139
  115. data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +0 -214
  116. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +0 -269
  117. data/spec/unit/puppet-strings/yard/parsers/json/parser_spec.rb +0 -70
  118. data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +0 -56
  119. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +0 -209
  120. data/spec/unit/puppet-strings/yard/util_spec.rb +0 -48
data/Rakefile DELETED
@@ -1,93 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- #require 'puppetlabs_spec_helper/rake_tasks'
3
- require 'puppet-lint/tasks/puppet-lint'
4
-
5
- # Add our own tasks
6
- require 'puppet-strings/tasks'
7
-
8
- PuppetLint.configuration.send('disable_80chars')
9
- PuppetLint.configuration.ignore_paths = %w(acceptance/**/*.pp spec/**/*.pp pkg/**/*.pp)
10
-
11
- desc 'Validate Ruby source files and ERB templates.'
12
- task :validate do
13
- Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
14
- sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
15
- end
16
- Dir['lib/puppet-strings/yard/templates/**/*.erb'].each do |template|
17
- sh "erb -P -x -T '-' #{template} | ruby -c"
18
- end
19
- end
20
-
21
- task :acceptance do
22
- require 'beaker-hostgenerator'
23
-
24
- install_type = 'aio'
25
- target = ENV['platform']
26
- abs = if ENV['BEAKER_ABS'] then 'abs' else 'vmpooler' end
27
- if ! target
28
- STDERR.puts 'TEST_TARGET environment variable is not set'
29
- STDERR.puts 'setting to default value of "centos7-64ma".'
30
- target = "centos7-64ma{type=#{install_type}}"
31
- end
32
-
33
- unless target =~ /type=/
34
- puts "INFO: adding 'type=#{install_type}' to host config"
35
- target += "{type=#{install_type}}"
36
- end
37
-
38
- cli = BeakerHostGenerator::CLI.new([target, '--hypervisor', abs])
39
- nodeset_dir = 'spec/acceptance/nodesets'
40
- nodeset = "#{nodeset_dir}/#{target}.yml"
41
- FileUtils.mkdir_p(nodeset_dir)
42
- File.open(nodeset, 'w') do |fh|
43
- fh.print(cli.execute)
44
- end
45
- puts "nodeset file:"
46
- puts nodeset
47
- sh 'gem build puppet-strings.gemspec'
48
- sh 'puppet module build spec/fixtures/acceptance/modules/test'
49
- if ENV['BEAKER_keyfile']
50
- sh "BEAKER_set=#{target} rspec spec/acceptance/*.rb"
51
- else
52
- sh "BEAKER_keyfile=$HOME/.ssh/id_rsa-acceptance BEAKER_set=#{target} rspec spec/acceptance/*.rb"
53
- end
54
- end
55
-
56
- task(:rubocop) do
57
- require 'rubocop'
58
- cli = RuboCop::CLI.new
59
- cli.run(%w(-D -f s))
60
- end
61
-
62
- #### CHANGELOG ####
63
- begin
64
- require 'github_changelog_generator/task'
65
- GitHubChangelogGenerator::RakeTask.new :changelog do |config|
66
- require 'puppet-strings/version'
67
- config.future_release = "v#{PuppetStrings::VERSION}"
68
- config.header = "# Changelog\n\n" \
69
- "All significant changes to this repo will be summarized in this file.\n"
70
- config.configure_sections = {
71
- added: {
72
- prefix: "Added",
73
- labels: ["enhancement"]
74
- },
75
- fixed: {
76
- prefix: "Fixed",
77
- labels: ["bugfix"]
78
- },
79
- breaking: {
80
- prefix: "Changed",
81
- labels: ["backwards-incompatible"]
82
- }
83
- }
84
- config.exclude_labels = ['maintenance']
85
- config.user = 'puppetlabs'
86
- config.project = 'puppet-strings'
87
- end
88
- rescue LoadError
89
- desc 'Install github_changelog_generator to get access to automatic changelog generation'
90
- task :changelog do
91
- raise 'Install github_changelog_generator to get access to automatic changelog generation'
92
- end
93
- end
@@ -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,71 +0,0 @@
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
- "signatures" => [
19
- {
20
- "signature" =>"function3x()",
21
- "docstring" => {
22
- "text" => "This is the function documentation for `function3x`",
23
- "tags" => [
24
- {
25
- "tag_name"=>"return",
26
- "text"=>"",
27
- "types"=>["Any"]
28
- }
29
- ]
30
- }
31
- },
32
- ],
33
- "docstring" => {
34
- "text" => "This is the function documentation for `function3x`",
35
- "tags" => ["tag_name" => "return", "text" => "", "types" => ["Any"]]},
36
- "source" => "Puppet::Parser::Functions.newfunction(:function3x, :doc => \"This is the function documentation for `function3x`\") do |args|\nend"
37
- ]
38
- }
39
-
40
- it 'should emit JSON to stdout when using --format json and --stdout' do
41
- test_module_path = get_test_module_path(master, /Module test/)
42
- on master, puppet('strings', 'generate', '--format json', "#{test_module_path}/lib/puppet/parser/functions/function3x.rb") do
43
- output = stdout.chomp
44
- expect(JSON.parse(output)).to eq(expected)
45
- end
46
- end
47
-
48
- it 'should write JSON to a file when using --format json and --out' do
49
- test_module_path = get_test_module_path(master, /Module test/)
50
- tmpfile = master.tmpfile('json_output.json')
51
- on master, puppet('strings', 'generate', '--format json', "--out #{tmpfile}", "#{test_module_path}/lib/puppet/parser/functions/function3x.rb")
52
- output = read_file_on(master, tmpfile)
53
- expect(JSON.parse(output)).to eq(expected)
54
- end
55
-
56
- it 'should emit JSON to stdout when using --emit-json-stdout' do
57
- test_module_path = get_test_module_path(master, /Module test/)
58
- on master, puppet('strings', 'generate', '--emit-json-stdout', "#{test_module_path}/lib/puppet/parser/functions/function3x.rb") do
59
- output = stdout.chomp
60
- expect(JSON.parse(output)).to eq(expected)
61
- end
62
- end
63
-
64
- it 'should write JSON to a file when using --emit-json' do
65
- test_module_path = get_test_module_path(master, /Module test/)
66
- tmpfile = master.tmpfile('json_output.json')
67
- on master, puppet('strings', 'generate', '--emit-json', tmpfile, "#{test_module_path}/lib/puppet/parser/functions/function3x.rb")
68
- output = read_file_on(master, tmpfile)
69
- expect(JSON.parse(output)).to eq(expected)
70
- end
71
- end
@@ -1,49 +0,0 @@
1
- require 'spec_helper_acceptance'
2
- require 'util'
3
-
4
- include PuppetStrings::Acceptance::Util
5
-
6
- describe 'Generating Markdown' do
7
- expected = <<-EOF
8
- # Reference
9
-
10
- ## Classes
11
- * [`test`](#test): This class exists to serve as fixture data for testing the puppet strings face
12
-
13
- ## Classes
14
-
15
- ### test
16
-
17
- #### Examples
18
- ```puppet
19
- class { "test": }
20
- ```
21
-
22
- #### Parameters
23
-
24
- ##### `package_name`
25
-
26
- The name of the package
27
-
28
- ##### `service_name`
29
-
30
- The name of the service
31
-
32
- EOF
33
-
34
- it 'should render Markdown to stdout when using --format markdown and --stdout' do
35
- test_module_path = get_test_module_path(master, /Module test/)
36
- on master, puppet('strings', 'generate', '--format markdown', "#{test_module_path}/manifests/init.pp") do
37
- output = stdout.chomp
38
- expect(JSON.parse(output)).to eq(expected)
39
- end
40
- end
41
-
42
- it 'should write Markdown to a file when using --format markdown and --out' do
43
- test_module_path = get_test_module_path(master, /Module test/)
44
- tmpfile = master.tmpfile('md_output.md')
45
- on master, puppet('strings', 'generate', '--format markdown', "--out #{tmpfile}", "#{test_module_path}/manifests/init.pp")
46
- output = read_file_on(master, tmpfile)
47
- expect(JSON.parse(output)).to eq(expected)
48
- end
49
- end
@@ -1,163 +0,0 @@
1
- module PuppetStrings
2
- module Acceptance
3
- module Util
4
- GEOTRUST_GLOBAL_CA = <<-EOM
5
- -----BEGIN CERTIFICATE-----
6
- MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
7
- MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
8
- YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG
9
- EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg
10
- R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9
11
- 9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq
12
- fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv
13
- iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU
14
- 1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+
15
- bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW
16
- MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA
17
- ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l
18
- uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn
19
- Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS
20
- tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF
21
- PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un
22
- hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
23
- 5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
24
- -----END CERTIFICATE-----
25
- EOM
26
-
27
- USERTRUST_NETWORK_CA = <<-EOM
28
- -----BEGIN CERTIFICATE-----
29
- MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCB
30
- lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug
31
- Q2l0eTEeMBwGA1UEChMVVGhlI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BwMGBggrBgEF
47
- BQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM
48
- //bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28Gpgoiskli
49
- CE7/yMgUsogWXecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gE
50
- CJChicsZUN/KHAG8HQQZexB2lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t
51
- 3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kniCrVWFCVH/A7HFe7fRQ5YiuayZSS
52
- KqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67nfhmqA==
53
- -----END CERTIFICATE-----
54
- EOM
55
-
56
- EQUIFAX_CA = <<-EOM
57
- -----BEGIN CERTIFICATE-----
58
- MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
59
- UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy
60
- dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1
61
- MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx
62
- dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B
63
- AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f
64
- BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A
65
- cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC
66
- AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQ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/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
87
- xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
88
- 1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
89
- snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
90
- U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
91
- 9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
92
- BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
93
- AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
94
- yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
95
- 38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
96
- AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
97
- DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
98
- HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
99
- -----END CERTIFICATE-----
100
- EOM
101
-
102
- def read_file_on(host, filename)
103
- on(host, "cat #{filename}").stdout
104
- end
105
-
106
- def get_test_module_path(host, module_regex)
107
- modules = JSON.parse(on(host, puppet('module', 'list', '--render-as', 'json')).stdout)
108
- test_module_info = modules['modules_by_path'].values.flatten.find { |mod_info| mod_info =~ module_regex }
109
- test_module_info.match(/\(([^)]*)\)/)[1]
110
- end
111
-
112
- def install_ca_certs(host)
113
- return unless host.platform =~ /windows/
114
-
115
- step "Installing Geotrust CA cert"
116
- create_remote_file(host, "geotrustglobal.pem", GEOTRUST_GLOBAL_CA)
117
- on host, "chmod 644 geotrustglobal.pem"
118
- on host, "cmd /c certutil -v -addstore Root `cygpath -w geotrustglobal.pem`"
119
-
120
- step "Installing Usertrust Network CA cert"
121
- create_remote_file(host, "usertrust-network.pem", USERTRUST_NETWORK_CA)
122
- on host, "chmod 644 usertrust-network.pem"
123
- on host, "cmd /c certutil -v -addstore Root `cygpath -w usertrust-network.pem`"
124
-
125
- step "Installing Equifax CA cert"
126
- create_remote_file(host, "equifax.pem", EQUIFAX_CA)
127
- on host, "chmod 644 equifax.pem"
128
- on host, "cmd /c certutil -v -addstore Root `cygpath -w equifax.pem`"
129
-
130
- step "Installing Globalsign CA cert"
131
- create_remote_file(host, "globalsign.pem", GLOBALSIGN_CA)
132
- on host, "chmod 644 globalsign.pem"
133
- on host, "cmd /c certutil -v -addstore Root `cygpath -w globalsign.pem`"
134
- on host, "cp globalsign.pem \"$(cygpath \"#{find_windows_rubygems_ssl_certs_dir(host)}\")\""
135
- end
136
-
137
- def find_windows_rubygems_ssl_certs_dir(host)
138
- return unless host.platform =~ /windows/
139
- ssl_certs_dir = File.dirname(on(host, "#{gem_command(host)} which rubygems").stdout.strip) << '/rubygems/ssl_certs'
140
- end
141
- end
142
-
143
- module CommandUtils
144
- def ruby_command(host)
145
- "env PATH=\"#{host['privatebindir']}:${PATH}\" ruby"
146
- end
147
- module_function :ruby_command
148
-
149
- def gem_command(host, type='aio')
150
- if type == 'aio'
151
- if host['platform'] =~ /windows/
152
- "PATH=\"#{host['privatebindir']}:${PATH}\" cmd /c gem"
153
- else
154
- "PATH=\"#{host['privatebindir']}:${PATH}\" gem"
155
- end
156
- else
157
- on(host, 'which gem').stdout.chomp
158
- end
159
- end
160
- module_function :gem_command
161
- end
162
- end
163
- end
@@ -1,54 +0,0 @@
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