puppet-strings 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile +14 -5
  4. data/JSON.md +41 -11
  5. data/README.md +66 -7
  6. data/Rakefile +99 -29
  7. data/lib/puppet-strings/json.rb +2 -0
  8. data/lib/puppet-strings/markdown.rb +2 -0
  9. data/lib/puppet-strings/markdown/data_type.rb +18 -0
  10. data/lib/puppet-strings/markdown/data_types.rb +41 -0
  11. data/lib/puppet-strings/markdown/function.rb +2 -2
  12. data/lib/puppet-strings/markdown/table_of_contents.rb +1 -0
  13. data/lib/puppet-strings/markdown/templates/data_type.erb +78 -0
  14. data/lib/puppet-strings/tasks/generate.rb +3 -2
  15. data/lib/puppet-strings/version.rb +1 -1
  16. data/lib/puppet-strings/yard.rb +10 -0
  17. data/lib/puppet-strings/yard/code_objects.rb +2 -0
  18. data/lib/puppet-strings/yard/code_objects/class.rb +1 -1
  19. data/lib/puppet-strings/yard/code_objects/data_type.rb +80 -0
  20. data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +58 -0
  21. data/lib/puppet-strings/yard/code_objects/defined_type.rb +1 -1
  22. data/lib/puppet-strings/yard/code_objects/function.rb +3 -3
  23. data/lib/puppet-strings/yard/code_objects/plan.rb +1 -1
  24. data/lib/puppet-strings/yard/handlers.rb +2 -0
  25. data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +24 -0
  26. data/lib/puppet-strings/yard/handlers/ruby/base.rb +2 -2
  27. data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +236 -0
  28. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +1 -3
  29. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +2 -2
  30. data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +5 -6
  31. data/lib/puppet-strings/yard/parsers/json/parser.rb +1 -1
  32. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +14 -7
  33. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +25 -0
  34. data/lib/puppet-strings/yard/tags/overload_tag.rb +1 -1
  35. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_data_type.erb +10 -0
  36. data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +9 -0
  37. data/lib/puppet-strings/yard/templates/default/layout/html/objects.erb +2 -0
  38. data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +18 -1
  39. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/box_info.erb +10 -0
  40. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/header.erb +1 -0
  41. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/note.erb +6 -0
  42. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/overview.erb +6 -0
  43. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb +5 -0
  44. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/source.erb +12 -0
  45. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/summary.erb +4 -0
  46. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/todo.erb +6 -0
  47. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/alias_of.erb +10 -0
  48. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/box_info.erb +10 -0
  49. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/header.erb +1 -0
  50. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/note.erb +6 -0
  51. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/overview.erb +6 -0
  52. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb +17 -0
  53. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/source.erb +12 -0
  54. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/summary.erb +4 -0
  55. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/todo.erb +6 -0
  56. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +1 -0
  57. data/lib/puppet/face/strings.rb +3 -3
  58. data/spec/acceptance/emit_json_options_spec.rb +69 -0
  59. data/spec/acceptance/generate_markdown_spec.rb +13 -15
  60. data/spec/acceptance/running_strings_generate_spec.rb +78 -0
  61. data/spec/fixtures/acceptance/modules/test/metadata.json +5 -1
  62. data/spec/fixtures/acceptance/modules/test/types/elephant.pp +2 -0
  63. data/spec/fixtures/unit/markdown/output_with_data_types.md +553 -0
  64. data/spec/spec_helper.rb +3 -0
  65. data/spec/spec_helper_acceptance.rb +52 -22
  66. data/spec/spec_helper_acceptance_local.rb +10 -0
  67. data/spec/unit/puppet-strings/describe_spec.rb +7 -7
  68. data/spec/unit/puppet-strings/json_spec.rb +23 -4
  69. data/spec/unit/puppet-strings/markdown/base_spec.rb +3 -3
  70. data/spec/unit/puppet-strings/markdown_spec.rb +84 -23
  71. data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +1 -1
  72. data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +4 -4
  73. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +8 -8
  74. data/spec/unit/puppet-strings/yard/handlers/puppet/data_type_alias_handler_spec.rb +65 -0
  75. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +8 -8
  76. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +13 -13
  77. data/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb +232 -0
  78. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +36 -19
  79. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +26 -7
  80. data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +7 -7
  81. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +26 -10
  82. data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +2 -2
  83. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +42 -0
  84. data/spec/unit/puppet-strings/yard/util_spec.rb +1 -1
  85. metadata +35 -7
  86. data/spec/acceptance/emit_json_options.rb +0 -71
  87. data/spec/acceptance/lib/util.rb +0 -163
  88. data/spec/acceptance/running_strings_generate.rb +0 -54
@@ -206,4 +206,46 @@ SOURCE
206
206
  expect(statement.type).to eq("Struct\[{'a' => Integer[1, 10]}\]")
207
207
  end
208
208
  end
209
+
210
+ describe 'parsing type alias definitions', if: TEST_PUPPET_DATATYPES do
211
+ context 'given a type alias on a single line' do
212
+ let(:source) { <<-SOURCE
213
+ # A simple foo type.
214
+ type Module::Typename = Variant[Stdlib::Windowspath, Stdlib::Unixpath]
215
+ SOURCE
216
+ }
217
+
218
+ it 'should parse the puppet type statement' do
219
+ subject.parse
220
+ expect(subject.enumerator.size).to eq(1)
221
+ statement = subject.enumerator.first
222
+ expect(statement).to be_a(PuppetStrings::Yard::Parsers::Puppet::DataTypeAliasStatement)
223
+ expect(statement.docstring).to eq('A simple foo type.')
224
+ expect(statement.name).to eq('Module::Typename')
225
+ expect(statement.alias_of).to eq('Variant[Stdlib::Windowspath, Stdlib::Unixpath]')
226
+ end
227
+ end
228
+
229
+ context 'given a type alias over multiple lines' do
230
+ let(:source) { <<-SOURCE
231
+ # A multiline foo type
232
+ # with long docs
233
+ type OptionsWithoutName = Struct[{
234
+ value_type => Optional[ValueType],
235
+ merge => Optional[MergeType]
236
+ }]
237
+ SOURCE
238
+ }
239
+
240
+ it 'should parse the puppet type statement' do
241
+ subject.parse
242
+ expect(subject.enumerator.size).to eq(1)
243
+ statement = subject.enumerator.first
244
+ expect(statement).to be_a(PuppetStrings::Yard::Parsers::Puppet::DataTypeAliasStatement)
245
+ expect(statement.docstring).to eq("A multiline foo type\nwith long docs")
246
+ expect(statement.name).to eq('OptionsWithoutName')
247
+ expect(statement.alias_of).to eq("Struct[{\n value_type => Optional[ValueType],\n merge => Optional[MergeType]\n}]")
248
+ end
249
+ end
250
+ end
209
251
  end
@@ -19,7 +19,7 @@ describe PuppetStrings::Yard::Util do
19
19
  str = <<-STR
20
20
  %Q{this is
21
21
  a test string}
22
- STR
22
+ STR
23
23
  expect(subject.scrub_string(str)).to eq("this is\na test string")
24
24
  end
25
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-strings
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-05 00:00:00.000000000 Z
11
+ date: 2019-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard
@@ -64,6 +64,8 @@ files:
64
64
  - lib/puppet-strings/json.rb
65
65
  - lib/puppet-strings/markdown.rb
66
66
  - lib/puppet-strings/markdown/base.rb
67
+ - lib/puppet-strings/markdown/data_type.rb
68
+ - lib/puppet-strings/markdown/data_types.rb
67
69
  - lib/puppet-strings/markdown/defined_type.rb
68
70
  - lib/puppet-strings/markdown/defined_types.rb
69
71
  - lib/puppet-strings/markdown/function.rb
@@ -78,6 +80,7 @@ files:
78
80
  - lib/puppet-strings/markdown/resource_types.rb
79
81
  - lib/puppet-strings/markdown/table_of_contents.rb
80
82
  - lib/puppet-strings/markdown/templates/classes_and_defines.erb
83
+ - lib/puppet-strings/markdown/templates/data_type.erb
81
84
  - lib/puppet-strings/markdown/templates/function.erb
82
85
  - lib/puppet-strings/markdown/templates/puppet_task.erb
83
86
  - lib/puppet-strings/markdown/templates/resource_type.erb
@@ -91,6 +94,8 @@ files:
91
94
  - lib/puppet-strings/yard/code_objects.rb
92
95
  - lib/puppet-strings/yard/code_objects/base.rb
93
96
  - lib/puppet-strings/yard/code_objects/class.rb
97
+ - lib/puppet-strings/yard/code_objects/data_type.rb
98
+ - lib/puppet-strings/yard/code_objects/data_type_alias.rb
94
99
  - lib/puppet-strings/yard/code_objects/defined_type.rb
95
100
  - lib/puppet-strings/yard/code_objects/function.rb
96
101
  - lib/puppet-strings/yard/code_objects/group.rb
@@ -104,10 +109,12 @@ files:
104
109
  - lib/puppet-strings/yard/handlers/json/task_handler.rb
105
110
  - lib/puppet-strings/yard/handlers/puppet/base.rb
106
111
  - lib/puppet-strings/yard/handlers/puppet/class_handler.rb
112
+ - lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb
107
113
  - lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb
108
114
  - lib/puppet-strings/yard/handlers/puppet/function_handler.rb
109
115
  - lib/puppet-strings/yard/handlers/puppet/plan_handler.rb
110
116
  - lib/puppet-strings/yard/handlers/ruby/base.rb
117
+ - lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb
111
118
  - lib/puppet-strings/yard/handlers/ruby/function_handler.rb
112
119
  - lib/puppet-strings/yard/handlers/ruby/provider_handler.rb
113
120
  - lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb
@@ -126,6 +133,7 @@ files:
126
133
  - lib/puppet-strings/yard/tags/summary_tag.rb
127
134
  - lib/puppet-strings/yard/templates/default/fulldoc/html/css/common.css
128
135
  - lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_class.erb
136
+ - lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_data_type.erb
129
137
  - lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_defined_type.erb
130
138
  - lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_function.erb
131
139
  - lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_plan.erb
@@ -144,6 +152,23 @@ files:
144
152
  - lib/puppet-strings/yard/templates/default/puppet_class/html/source.erb
145
153
  - lib/puppet-strings/yard/templates/default/puppet_class/html/summary.erb
146
154
  - lib/puppet-strings/yard/templates/default/puppet_class/html/todo.erb
155
+ - lib/puppet-strings/yard/templates/default/puppet_data_type/html/box_info.erb
156
+ - lib/puppet-strings/yard/templates/default/puppet_data_type/html/header.erb
157
+ - lib/puppet-strings/yard/templates/default/puppet_data_type/html/note.erb
158
+ - lib/puppet-strings/yard/templates/default/puppet_data_type/html/overview.erb
159
+ - lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb
160
+ - lib/puppet-strings/yard/templates/default/puppet_data_type/html/source.erb
161
+ - lib/puppet-strings/yard/templates/default/puppet_data_type/html/summary.erb
162
+ - lib/puppet-strings/yard/templates/default/puppet_data_type/html/todo.erb
163
+ - lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/alias_of.erb
164
+ - lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/box_info.erb
165
+ - lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/header.erb
166
+ - lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/note.erb
167
+ - lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/overview.erb
168
+ - lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb
169
+ - lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/source.erb
170
+ - lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/summary.erb
171
+ - lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/todo.erb
147
172
  - lib/puppet-strings/yard/templates/default/puppet_defined_type/html/box_info.erb
148
173
  - lib/puppet-strings/yard/templates/default/puppet_defined_type/html/header.erb
149
174
  - lib/puppet-strings/yard/templates/default/puppet_defined_type/html/note.erb
@@ -199,10 +224,9 @@ files:
199
224
  - lib/puppet/feature/rgen.rb
200
225
  - lib/puppet/feature/yard.rb
201
226
  - misc/ANNOUNCEMENT_TEMPLATE.md
202
- - spec/acceptance/emit_json_options.rb
227
+ - spec/acceptance/emit_json_options_spec.rb
203
228
  - spec/acceptance/generate_markdown_spec.rb
204
- - spec/acceptance/lib/util.rb
205
- - spec/acceptance/running_strings_generate.rb
229
+ - spec/acceptance/running_strings_generate_spec.rb
206
230
  - spec/fixtures/acceptance/modules/test/functions/add.pp
207
231
  - spec/fixtures/acceptance/modules/test/lib/puppet/functions/4x_function.rb
208
232
  - spec/fixtures/acceptance/modules/test/lib/puppet/parser/functions/function3x.rb
@@ -211,10 +235,13 @@ files:
211
235
  - spec/fixtures/acceptance/modules/test/manifests/init.pp
212
236
  - spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp
213
237
  - spec/fixtures/acceptance/modules/test/metadata.json
238
+ - spec/fixtures/acceptance/modules/test/types/elephant.pp
214
239
  - spec/fixtures/unit/markdown/output.md
240
+ - spec/fixtures/unit/markdown/output_with_data_types.md
215
241
  - spec/fixtures/unit/markdown/output_with_plan.md
216
242
  - spec/spec_helper.rb
217
243
  - spec/spec_helper_acceptance.rb
244
+ - spec/spec_helper_acceptance_local.rb
218
245
  - spec/unit/puppet-strings/describe_spec.rb
219
246
  - spec/unit/puppet-strings/json_spec.rb
220
247
  - spec/unit/puppet-strings/markdown/base_spec.rb
@@ -222,8 +249,10 @@ files:
222
249
  - spec/unit/puppet-strings/yard/code_objects/task_spec.rb
223
250
  - spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb
224
251
  - spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb
252
+ - spec/unit/puppet-strings/yard/handlers/puppet/data_type_alias_handler_spec.rb
225
253
  - spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb
226
254
  - spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb
255
+ - spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb
227
256
  - spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb
228
257
  - spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb
229
258
  - spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb
@@ -252,8 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
281
  version: '0'
253
282
  requirements:
254
283
  - puppet, >= 4.0.0
255
- rubyforge_project:
256
- rubygems_version: 2.5.1
284
+ rubygems_version: 3.0.4
257
285
  signing_key:
258
286
  specification_version: 4
259
287
  summary: Puppet documentation via YARD
@@ -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,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
- Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho
32
- dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3Qt
33
- SGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgxOTIyWjCBlzELMAkG
34
- A1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IEx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ux2x8gkasJ
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