puppet-strings 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +18 -3
- data/Gemfile +3 -2
- data/Rakefile +5 -0
- data/lib/puppet-strings.rb +10 -1
- data/lib/puppet-strings/describe.rb +68 -0
- data/lib/puppet-strings/json.rb +0 -38
- data/lib/puppet-strings/markdown/base.rb +18 -16
- data/lib/puppet-strings/markdown/templates/function.erb +26 -0
- data/lib/puppet-strings/markdown/templates/resource_type.erb +4 -0
- data/lib/puppet-strings/tasks/generate.rb +7 -1
- data/lib/puppet-strings/version.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/class.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/defined_type.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/function.rb +3 -3
- data/lib/puppet-strings/yard/code_objects/plan.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/provider.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/type.rb +3 -2
- data/lib/puppet-strings/yard/handlers.rb +1 -0
- data/lib/puppet-strings/yard/handlers/ruby/base.rb +11 -0
- data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +1 -9
- data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +1 -9
- data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +1 -1
- data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +130 -0
- data/lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb +56 -0
- data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +3 -115
- data/lib/puppet-strings/yard/parsers/json/parser.rb +3 -1
- data/lib/puppet-strings/yard/tags/overload_tag.rb +1 -1
- data/lib/puppet-strings/yard/util.rb +48 -0
- data/lib/puppet/face/strings.rb +66 -1
- data/spec/fixtures/unit/markdown/output.md +64 -0
- data/spec/fixtures/unit/markdown/output_with_plan.md +64 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/puppet-strings/describe_spec.rb +141 -0
- data/spec/unit/puppet-strings/json_spec.rb +65 -11
- data/spec/unit/puppet-strings/markdown_spec.rb +13 -0
- data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +4 -12
- data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +1 -1
- data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +21 -0
- data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +26 -0
- data/spec/unit/puppet-strings/yard/parsers/json/parser_spec.rb +5 -3
- metadata +7 -6
- data/spec/fixtures/unit/json/output.json +0 -660
- data/spec/fixtures/unit/json/output_with_plan.json +0 -697
- data/spec/fixtures/unit/json/output_without_puppet_function.json +0 -480
@@ -202,28 +202,82 @@ path this type will autorequire that file.
|
|
202
202
|
SOURCE
|
203
203
|
end
|
204
204
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
205
|
+
RSpec.shared_examples "correct JSON" do
|
206
|
+
it 'should include data for Puppet Classes' do
|
207
|
+
puppet_class_json = YARD::Registry.all(:puppet_class).sort_by!(&:name).map!(&:to_hash).to_json
|
208
|
+
|
209
|
+
expect(json_output).to include_json(puppet_class_json)
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'should include data for Puppet Defined Types' do
|
213
|
+
defined_types_json = YARD::Registry.all(:puppet_defined_type).sort_by!(&:name).map!(&:to_hash).to_json
|
214
|
+
|
215
|
+
expect(json_output).to include_json(defined_types_json)
|
216
|
+
end
|
217
|
+
|
218
|
+
it 'should include data for Puppet Resouce Types' do
|
219
|
+
resource_types_json = YARD::Registry.all(:puppet_type).sort_by!(&:name).map!(&:to_hash).to_json
|
220
|
+
|
221
|
+
expect(json_output).to include_json(resource_types_json)
|
222
|
+
end
|
223
|
+
|
224
|
+
it 'should include data for Puppet Providers' do
|
225
|
+
providers_json = YARD::Registry.all(:puppet_provider).sort_by!(&:name).map!(&:to_hash).to_json
|
226
|
+
|
227
|
+
expect(json_output).to include_json(providers_json)
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'should include data for Puppet Functions', if: TEST_PUPPET_FUNCTIONS do
|
231
|
+
puppet_functions_json = YARD::Registry.all(:puppet_function).sort_by!(&:name).map!(&:to_hash).to_json
|
232
|
+
|
233
|
+
expect(json_output).to include_json(puppet_functions_json)
|
234
|
+
end
|
235
|
+
|
236
|
+
it 'should include data for Puppet Tasks' do
|
237
|
+
puppet_tasks_json = YARD::Registry.all(:puppet_task).sort_by!(&:name).map!(&:to_hash).to_json
|
238
|
+
|
239
|
+
expect(json_output).to include_json(puppet_tasks_json)
|
240
|
+
end
|
241
|
+
|
242
|
+
it 'should include data for Puppet Plans', if: TEST_PUPPET_PLANS do
|
243
|
+
puppet_plans_json = YARD::Registry.all(:puppet_plan).sort_by!(&:name).map!(&:to_hash).to_json
|
244
|
+
|
245
|
+
expect(json_output).to include_json(puppet_plans_json)
|
210
246
|
end
|
211
247
|
end
|
212
|
-
let(:baseline_path) { File.join(File.dirname(__FILE__), "../../fixtures/unit/json/#{filename}") }
|
213
|
-
let(:baseline) { File.read(baseline_path) }
|
214
248
|
|
215
249
|
describe 'rendering JSON to a file' do
|
216
|
-
|
250
|
+
let(:json_output) do
|
251
|
+
json_output = nil
|
252
|
+
|
217
253
|
Tempfile.open('json') do |file|
|
218
254
|
PuppetStrings::Json.render(file.path)
|
219
|
-
|
255
|
+
|
256
|
+
json_output = File.read(file.path)
|
220
257
|
end
|
258
|
+
|
259
|
+
json_output
|
221
260
|
end
|
261
|
+
|
262
|
+
include_examples "correct JSON"
|
222
263
|
end
|
223
264
|
|
224
265
|
describe 'rendering JSON to stdout' do
|
225
|
-
|
226
|
-
|
266
|
+
let(:json_output) { @json_output }
|
267
|
+
|
268
|
+
before(:each) do
|
269
|
+
output = StringIO.new
|
270
|
+
|
271
|
+
old_stdout = $stdout
|
272
|
+
$stdout = output
|
273
|
+
|
274
|
+
PuppetStrings::Json.render(nil)
|
275
|
+
|
276
|
+
$stdout = old_stdout
|
277
|
+
|
278
|
+
@json_output = output.string
|
227
279
|
end
|
280
|
+
|
281
|
+
include_examples "correct JSON"
|
228
282
|
end
|
229
283
|
end
|
@@ -108,12 +108,20 @@ SOURCE
|
|
108
108
|
# @option param3 [Array] :param3opt Something about this option
|
109
109
|
# @raise SomeError this is some error
|
110
110
|
# @return [Undef] Returns nothing.
|
111
|
+
# @example Test
|
112
|
+
# $result = func(1, 2)
|
111
113
|
function func(Integer $param1, $param2, String $param3 = hi) {
|
112
114
|
}
|
113
115
|
SOURCE
|
114
116
|
|
115
117
|
YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby)
|
116
118
|
# An example 4.x function.
|
119
|
+
#
|
120
|
+
# @example Calling the function
|
121
|
+
# $result = func4x(1, 'foo')
|
122
|
+
#
|
123
|
+
# @example Calling the function with all args
|
124
|
+
# $result = func4x(1, 'foo', ['bar'])
|
117
125
|
Puppet::Functions.create_function(:func4x) do
|
118
126
|
# An overview for the first overload.
|
119
127
|
# @raise SomeError this is some error
|
@@ -123,6 +131,9 @@ Puppet::Functions.create_function(:func4x) do
|
|
123
131
|
# @option param2 [String] :option2 another option
|
124
132
|
# @param param3 The third parameter.
|
125
133
|
# @return Returns nothing.
|
134
|
+
# @example Calling the function foo
|
135
|
+
# $result = func4x(1, 'foooo')
|
136
|
+
#
|
126
137
|
dispatch :foo do
|
127
138
|
param 'Integer', :param1
|
128
139
|
param 'Any', :param2
|
@@ -134,6 +145,8 @@ Puppet::Functions.create_function(:func4x) do
|
|
134
145
|
# @param param The first parameter.
|
135
146
|
# @param block The block parameter.
|
136
147
|
# @return Returns a string.
|
148
|
+
# @example Calling the function bar
|
149
|
+
# $result = func4x(1, 'bar', ['foo'])
|
137
150
|
dispatch :other do
|
138
151
|
param 'Boolean', :param
|
139
152
|
block_param
|
@@ -7,15 +7,7 @@ describe PuppetStrings::Yard::Handlers::JSON::TaskHandler do
|
|
7
7
|
YARD::Registry.all(:puppet_task)
|
8
8
|
}
|
9
9
|
|
10
|
-
describe 'parsing
|
11
|
-
let(:source) { 'notice hi' }
|
12
|
-
|
13
|
-
it 'no defined types should be in the registry' do
|
14
|
-
expect(subject.empty?).to eq(true)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'parsing source with a syntax error' do
|
10
|
+
describe 'parsing task metadata with a syntax error' do
|
19
11
|
let(:source) { <<-SOURCE
|
20
12
|
{
|
21
13
|
"input_method": "stdin",
|
@@ -35,7 +27,7 @@ SOURCE
|
|
35
27
|
end
|
36
28
|
end
|
37
29
|
|
38
|
-
describe 'parsing
|
30
|
+
describe 'parsing task metadata with a missing description' do
|
39
31
|
let(:source) { <<-SOURCE
|
40
32
|
{
|
41
33
|
"input_method": "stdin",
|
@@ -66,7 +58,7 @@ SOURCE
|
|
66
58
|
end
|
67
59
|
end
|
68
60
|
|
69
|
-
describe 'parsing
|
61
|
+
describe 'parsing task metadata with a description' do
|
70
62
|
let(:source) { <<-SOURCE
|
71
63
|
{
|
72
64
|
"description": "Allows you to backup your database to local file.",
|
@@ -102,7 +94,7 @@ SOURCE
|
|
102
94
|
end
|
103
95
|
end
|
104
96
|
|
105
|
-
describe 'parsing
|
97
|
+
describe 'parsing task metadata with a missing parameter description' do
|
106
98
|
let(:source) { <<-SOURCE
|
107
99
|
{
|
108
100
|
"description": "Allows you to backup your database to local file.",
|
@@ -211,4 +211,25 @@ SOURCE
|
|
211
211
|
end
|
212
212
|
end
|
213
213
|
end
|
214
|
+
|
215
|
+
describe 'parsing a type with title_patterns' do
|
216
|
+
let(:source) { <<-SOURCE
|
217
|
+
Puppet::ResourceApi.register_type(
|
218
|
+
name: 'database',
|
219
|
+
docs: 'An example database server resource type.',
|
220
|
+
title_patterns: [
|
221
|
+
{
|
222
|
+
pattern: %r{(?<name>.*)},
|
223
|
+
desc: 'Generic title match',
|
224
|
+
}
|
225
|
+
]
|
226
|
+
)
|
227
|
+
SOURCE
|
228
|
+
}
|
229
|
+
|
230
|
+
it 'should not emit a warning' do
|
231
|
+
expect{ subject }.not_to output(/\[warn\].*unexpected construct regexp_literal/).to_stdout_from_any_process
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
214
235
|
end
|
@@ -72,6 +72,32 @@ SOURCE
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
describe 'parsing a type with a param with arguments' do
|
76
|
+
let(:source) { <<-SOURCE
|
77
|
+
Puppet::Type.newtype(:database) do
|
78
|
+
feature :encryption, 'The provider supports encryption.', methods: [:encrypt]
|
79
|
+
|
80
|
+
newparam(:encryption_key, :parent => Puppet::Parameter::Boolean, required_features: :encryption) do
|
81
|
+
desc 'The encryption key to use.'
|
82
|
+
defaultto false
|
83
|
+
end
|
84
|
+
end
|
85
|
+
SOURCE
|
86
|
+
}
|
87
|
+
|
88
|
+
it 'should correctly detect the required_feature' do
|
89
|
+
expect(subject.size).to eq(1)
|
90
|
+
object = subject.first
|
91
|
+
expect(object.parameters[0].required_features).to eq('encryption')
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should correctly detect a boolean parent' do
|
95
|
+
expect(subject.size).to eq(1)
|
96
|
+
object = subject.first
|
97
|
+
expect(object.parameters[0].default).to eq('false')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
75
101
|
describe 'parsing a type definition' do
|
76
102
|
let(:source) { <<-SOURCE
|
77
103
|
# @!puppet.type.param [value1, value2] dynamic_param Documentation for a dynamic parameter.
|
@@ -6,7 +6,7 @@ describe PuppetStrings::Yard::Parsers::JSON::Parser do
|
|
6
6
|
let(:file) { 'test.json' }
|
7
7
|
|
8
8
|
describe 'initialization of the parser' do
|
9
|
-
let(:source) { '
|
9
|
+
let(:source) { '{}' }
|
10
10
|
|
11
11
|
it 'should store the original source' do
|
12
12
|
expect(subject.source).to eq(source)
|
@@ -18,6 +18,7 @@ describe PuppetStrings::Yard::Parsers::JSON::Parser do
|
|
18
18
|
|
19
19
|
it 'should have no relevant statements' do
|
20
20
|
subject.parse
|
21
|
+
|
21
22
|
expect(subject.enumerator.empty?).to be_truthy
|
22
23
|
end
|
23
24
|
end
|
@@ -34,7 +35,7 @@ SOURCE
|
|
34
35
|
end
|
35
36
|
|
36
37
|
|
37
|
-
describe 'parsing
|
38
|
+
describe 'parsing valid task metadata JSON' do
|
38
39
|
let(:source) { <<SOURCE
|
39
40
|
{
|
40
41
|
"description": "Allows you to backup your database to local file.",
|
@@ -60,8 +61,9 @@ SOURCE
|
|
60
61
|
}
|
61
62
|
SOURCE
|
62
63
|
}
|
63
|
-
it 'should parse the
|
64
|
+
it 'should parse the JSON and extract a TaskStatement' do
|
64
65
|
subject.parse
|
66
|
+
|
65
67
|
expect(subject.enumerator.size).to eq(1)
|
66
68
|
statement = subject.enumerator.first
|
67
69
|
expect(statement).to be_instance_of(PuppetStrings::Yard::Parsers::JSON::TaskStatement)
|
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.
|
4
|
+
version: 2.2.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:
|
11
|
+
date: 2019-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- Rakefile
|
61
61
|
- codecov.yml
|
62
62
|
- lib/puppet-strings.rb
|
63
|
+
- lib/puppet-strings/describe.rb
|
63
64
|
- lib/puppet-strings/json.rb
|
64
65
|
- lib/puppet-strings/markdown.rb
|
65
66
|
- lib/puppet-strings/markdown/base.rb
|
@@ -110,6 +111,8 @@ files:
|
|
110
111
|
- lib/puppet-strings/yard/handlers/ruby/function_handler.rb
|
111
112
|
- lib/puppet-strings/yard/handlers/ruby/provider_handler.rb
|
112
113
|
- lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb
|
114
|
+
- lib/puppet-strings/yard/handlers/ruby/type_base.rb
|
115
|
+
- lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb
|
113
116
|
- lib/puppet-strings/yard/handlers/ruby/type_handler.rb
|
114
117
|
- lib/puppet-strings/yard/parsers.rb
|
115
118
|
- lib/puppet-strings/yard/parsers/json/parser.rb
|
@@ -208,13 +211,11 @@ files:
|
|
208
211
|
- spec/fixtures/acceptance/modules/test/manifests/init.pp
|
209
212
|
- spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp
|
210
213
|
- spec/fixtures/acceptance/modules/test/metadata.json
|
211
|
-
- spec/fixtures/unit/json/output.json
|
212
|
-
- spec/fixtures/unit/json/output_with_plan.json
|
213
|
-
- spec/fixtures/unit/json/output_without_puppet_function.json
|
214
214
|
- spec/fixtures/unit/markdown/output.md
|
215
215
|
- spec/fixtures/unit/markdown/output_with_plan.md
|
216
216
|
- spec/spec_helper.rb
|
217
217
|
- spec/spec_helper_acceptance.rb
|
218
|
+
- spec/unit/puppet-strings/describe_spec.rb
|
218
219
|
- spec/unit/puppet-strings/json_spec.rb
|
219
220
|
- spec/unit/puppet-strings/markdown/base_spec.rb
|
220
221
|
- spec/unit/puppet-strings/markdown_spec.rb
|
@@ -252,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
252
253
|
requirements:
|
253
254
|
- puppet, >= 4.0.0
|
254
255
|
rubyforge_project:
|
255
|
-
rubygems_version: 2.
|
256
|
+
rubygems_version: 2.5.1
|
256
257
|
signing_key:
|
257
258
|
specification_version: 4
|
258
259
|
summary: Puppet documentation via YARD
|
@@ -1,660 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"puppet_classes": [
|
3
|
-
{
|
4
|
-
"name": "klass",
|
5
|
-
"file": "(stdin)",
|
6
|
-
"line": 7,
|
7
|
-
"inherits": "foo::bar",
|
8
|
-
"docstring": {
|
9
|
-
"text": "A simple class.",
|
10
|
-
"tags": [
|
11
|
-
{
|
12
|
-
"tag_name": "todo",
|
13
|
-
"text": "Do a thing"
|
14
|
-
},
|
15
|
-
{
|
16
|
-
"tag_name": "note",
|
17
|
-
"text": "Some note"
|
18
|
-
},
|
19
|
-
{
|
20
|
-
"tag_name": "param",
|
21
|
-
"text": "First param.",
|
22
|
-
"types": [
|
23
|
-
"Integer"
|
24
|
-
],
|
25
|
-
"name": "param1"
|
26
|
-
},
|
27
|
-
{
|
28
|
-
"tag_name": "param",
|
29
|
-
"text": "Second param.",
|
30
|
-
"types": [
|
31
|
-
"Any"
|
32
|
-
],
|
33
|
-
"name": "param2"
|
34
|
-
},
|
35
|
-
{
|
36
|
-
"tag_name": "param",
|
37
|
-
"text": "Third param.",
|
38
|
-
"types": [
|
39
|
-
"String"
|
40
|
-
],
|
41
|
-
"name": "param3"
|
42
|
-
}
|
43
|
-
]
|
44
|
-
},
|
45
|
-
"defaults": {
|
46
|
-
"param3": "hi"
|
47
|
-
},
|
48
|
-
"source": "class klass(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {\n}"
|
49
|
-
}
|
50
|
-
],
|
51
|
-
"defined_types": [
|
52
|
-
{
|
53
|
-
"name": "dt",
|
54
|
-
"file": "(stdin)",
|
55
|
-
"line": 14,
|
56
|
-
"docstring": {
|
57
|
-
"text": "A simple defined type.",
|
58
|
-
"tags": [
|
59
|
-
{
|
60
|
-
"tag_name": "param",
|
61
|
-
"text": "First param.",
|
62
|
-
"types": [
|
63
|
-
"Integer"
|
64
|
-
],
|
65
|
-
"name": "param1"
|
66
|
-
},
|
67
|
-
{
|
68
|
-
"tag_name": "param",
|
69
|
-
"text": "Second param.",
|
70
|
-
"types": [
|
71
|
-
"Any"
|
72
|
-
],
|
73
|
-
"name": "param2"
|
74
|
-
},
|
75
|
-
{
|
76
|
-
"tag_name": "param",
|
77
|
-
"text": "Third param.",
|
78
|
-
"types": [
|
79
|
-
"String"
|
80
|
-
],
|
81
|
-
"name": "param3"
|
82
|
-
}
|
83
|
-
]
|
84
|
-
},
|
85
|
-
"defaults": {
|
86
|
-
"param3": "hi"
|
87
|
-
},
|
88
|
-
"source": "define dt(Integer $param1, $param2, String $param3 = hi) {\n}"
|
89
|
-
}
|
90
|
-
],
|
91
|
-
"resource_types": [
|
92
|
-
{
|
93
|
-
"name": "apt_key",
|
94
|
-
"file": "(stdin)",
|
95
|
-
"line": 92,
|
96
|
-
"docstring": {
|
97
|
-
"text": "This type provides Puppet with the capabilities to manage GPG keys needed\nby apt to perform package validation. Apt has it's own GPG keyring that can\nbe manipulated through the `apt-key` command.\n**Autorequires**:\nIf Puppet is given the location of a key file which looks like an absolute\npath this type will autorequire that file.",
|
98
|
-
"tags": [
|
99
|
-
{
|
100
|
-
"tag_name": "summary",
|
101
|
-
"text": "Example resource type using the new API."
|
102
|
-
},
|
103
|
-
{
|
104
|
-
"tag_name": "raise",
|
105
|
-
"text": "SomeError"
|
106
|
-
},
|
107
|
-
{
|
108
|
-
"tag_name": "example",
|
109
|
-
"text": "apt_key { '6F6B15509CF8E59E6E469F327F438280EF8D349F':\n source => 'http://apt.puppetlabs.com/pubkey.gpg'\n}",
|
110
|
-
"name": "here's an example"
|
111
|
-
}
|
112
|
-
]
|
113
|
-
},
|
114
|
-
"properties": [
|
115
|
-
{
|
116
|
-
"name": "ensure",
|
117
|
-
"description": "Whether this apt key should be present or absent on the target system.",
|
118
|
-
"data_type": "Enum[present, absent]"
|
119
|
-
},
|
120
|
-
{
|
121
|
-
"name": "created",
|
122
|
-
"description": "Date the key was created, in ISO format.",
|
123
|
-
"data_type": "String"
|
124
|
-
}
|
125
|
-
],
|
126
|
-
"parameters": [
|
127
|
-
{
|
128
|
-
"name": "id",
|
129
|
-
"description": "The ID of the key you want to manage.",
|
130
|
-
"data_type": "Variant[Pattern[/A(0x)?[0-9a-fA-F]{8}Z/], Pattern[/A(0x)?[0-9a-fA-F]{16}Z/], Pattern[/A(0x)?[0-9a-fA-F]{40}Z/]]",
|
131
|
-
"isnamevar": true
|
132
|
-
}
|
133
|
-
]
|
134
|
-
},
|
135
|
-
{
|
136
|
-
"name": "database",
|
137
|
-
"file": "(stdin)",
|
138
|
-
"line": 54,
|
139
|
-
"docstring": {
|
140
|
-
"text": "An example database server resource type."
|
141
|
-
},
|
142
|
-
"properties": [
|
143
|
-
{
|
144
|
-
"name": "ensure",
|
145
|
-
"description": "What state the database should be in.",
|
146
|
-
"values": [
|
147
|
-
"present",
|
148
|
-
"absent",
|
149
|
-
"up",
|
150
|
-
"down"
|
151
|
-
],
|
152
|
-
"aliases": {
|
153
|
-
"up": "present",
|
154
|
-
"down": "absent"
|
155
|
-
},
|
156
|
-
"default": "up"
|
157
|
-
},
|
158
|
-
{
|
159
|
-
"name": "file",
|
160
|
-
"description": "The database file to use."
|
161
|
-
},
|
162
|
-
{
|
163
|
-
"name": "log_level",
|
164
|
-
"description": "The log level to use.",
|
165
|
-
"values": [
|
166
|
-
"debug",
|
167
|
-
"warn",
|
168
|
-
"error"
|
169
|
-
],
|
170
|
-
"default": "warn"
|
171
|
-
}
|
172
|
-
],
|
173
|
-
"parameters": [
|
174
|
-
{
|
175
|
-
"name": "address",
|
176
|
-
"description": "The database server name.",
|
177
|
-
"isnamevar": true
|
178
|
-
},
|
179
|
-
{
|
180
|
-
"name": "encryption_key",
|
181
|
-
"description": "The encryption key to use."
|
182
|
-
},
|
183
|
-
{
|
184
|
-
"name": "encrypt",
|
185
|
-
"description": "Whether or not to encrypt the database.",
|
186
|
-
"values": [
|
187
|
-
"true",
|
188
|
-
"false",
|
189
|
-
"yes",
|
190
|
-
"no"
|
191
|
-
],
|
192
|
-
"default": "false"
|
193
|
-
}
|
194
|
-
],
|
195
|
-
"features": [
|
196
|
-
{
|
197
|
-
"name": "encryption",
|
198
|
-
"description": "The provider supports encryption."
|
199
|
-
}
|
200
|
-
]
|
201
|
-
}
|
202
|
-
],
|
203
|
-
"providers": [
|
204
|
-
{
|
205
|
-
"name": "linux",
|
206
|
-
"type_name": "database",
|
207
|
-
"file": "(stdin)",
|
208
|
-
"line": 43,
|
209
|
-
"docstring": {
|
210
|
-
"text": "An example provider on Linux."
|
211
|
-
},
|
212
|
-
"confines": {
|
213
|
-
"kernel": "Linux",
|
214
|
-
"osfamily": "RedHat"
|
215
|
-
},
|
216
|
-
"features": [
|
217
|
-
"implements_some_feature",
|
218
|
-
"some_other_feature"
|
219
|
-
],
|
220
|
-
"defaults": [
|
221
|
-
[
|
222
|
-
[
|
223
|
-
"kernel",
|
224
|
-
"Linux"
|
225
|
-
]
|
226
|
-
],
|
227
|
-
[
|
228
|
-
[
|
229
|
-
"osfamily",
|
230
|
-
"RedHat"
|
231
|
-
],
|
232
|
-
[
|
233
|
-
"operatingsystemmajrelease",
|
234
|
-
"7"
|
235
|
-
]
|
236
|
-
]
|
237
|
-
],
|
238
|
-
"commands": {
|
239
|
-
"foo": "/usr/bin/foo"
|
240
|
-
}
|
241
|
-
}
|
242
|
-
],
|
243
|
-
"puppet_functions": [
|
244
|
-
{
|
245
|
-
"name": "func",
|
246
|
-
"file": "(stdin)",
|
247
|
-
"line": 6,
|
248
|
-
"type": "puppet",
|
249
|
-
"signatures": [
|
250
|
-
{
|
251
|
-
"signature": "func(Integer $param1, Any $param2, String $param3 = hi)",
|
252
|
-
"docstring": {
|
253
|
-
"text": "A simple function.",
|
254
|
-
"tags": [
|
255
|
-
{
|
256
|
-
"tag_name": "param",
|
257
|
-
"text": "First param.",
|
258
|
-
"types": [
|
259
|
-
"Integer"
|
260
|
-
],
|
261
|
-
"name": "param1"
|
262
|
-
},
|
263
|
-
{
|
264
|
-
"tag_name": "param",
|
265
|
-
"text": "Second param.",
|
266
|
-
"types": [
|
267
|
-
"Any"
|
268
|
-
],
|
269
|
-
"name": "param2"
|
270
|
-
},
|
271
|
-
{
|
272
|
-
"tag_name": "param",
|
273
|
-
"text": "Third param.",
|
274
|
-
"types": [
|
275
|
-
"String"
|
276
|
-
],
|
277
|
-
"name": "param3"
|
278
|
-
},
|
279
|
-
{
|
280
|
-
"tag_name": "return",
|
281
|
-
"text": "Returns nothing.",
|
282
|
-
"types": [
|
283
|
-
"Undef"
|
284
|
-
]
|
285
|
-
}
|
286
|
-
]
|
287
|
-
}
|
288
|
-
}
|
289
|
-
],
|
290
|
-
"docstring": {
|
291
|
-
"text": "A simple function.",
|
292
|
-
"tags": [
|
293
|
-
{
|
294
|
-
"tag_name": "param",
|
295
|
-
"text": "First param.",
|
296
|
-
"types": [
|
297
|
-
"Integer"
|
298
|
-
],
|
299
|
-
"name": "param1"
|
300
|
-
},
|
301
|
-
{
|
302
|
-
"tag_name": "param",
|
303
|
-
"text": "Second param.",
|
304
|
-
"types": [
|
305
|
-
"Any"
|
306
|
-
],
|
307
|
-
"name": "param2"
|
308
|
-
},
|
309
|
-
{
|
310
|
-
"tag_name": "param",
|
311
|
-
"text": "Third param.",
|
312
|
-
"types": [
|
313
|
-
"String"
|
314
|
-
],
|
315
|
-
"name": "param3"
|
316
|
-
},
|
317
|
-
{
|
318
|
-
"tag_name": "return",
|
319
|
-
"text": "Returns nothing.",
|
320
|
-
"types": [
|
321
|
-
"Undef"
|
322
|
-
]
|
323
|
-
}
|
324
|
-
]
|
325
|
-
},
|
326
|
-
"defaults": {
|
327
|
-
"param3": "hi"
|
328
|
-
},
|
329
|
-
"source": "function func(Integer $param1, $param2, String $param3 = hi) {\n}"
|
330
|
-
},
|
331
|
-
{
|
332
|
-
"name": "func3x",
|
333
|
-
"file": "(stdin)",
|
334
|
-
"line": 1,
|
335
|
-
"type": "ruby3x",
|
336
|
-
"signatures": [
|
337
|
-
{
|
338
|
-
"signature": "func3x(String $first, Any $second)",
|
339
|
-
"docstring": {
|
340
|
-
"text": "An example 3.x function.",
|
341
|
-
"tags": [
|
342
|
-
{
|
343
|
-
"tag_name": "param",
|
344
|
-
"text": "The first parameter.",
|
345
|
-
"types": [
|
346
|
-
"String"
|
347
|
-
],
|
348
|
-
"name": "first"
|
349
|
-
},
|
350
|
-
{
|
351
|
-
"tag_name": "param",
|
352
|
-
"text": "The second parameter.",
|
353
|
-
"types": [
|
354
|
-
"Any"
|
355
|
-
],
|
356
|
-
"name": "second"
|
357
|
-
},
|
358
|
-
{
|
359
|
-
"tag_name": "return",
|
360
|
-
"text": "Returns nothing.",
|
361
|
-
"types": [
|
362
|
-
"Undef"
|
363
|
-
]
|
364
|
-
}
|
365
|
-
]
|
366
|
-
}
|
367
|
-
}
|
368
|
-
],
|
369
|
-
"docstring": {
|
370
|
-
"text": "An example 3.x function.",
|
371
|
-
"tags": [
|
372
|
-
{
|
373
|
-
"tag_name": "param",
|
374
|
-
"text": "The first parameter.",
|
375
|
-
"types": [
|
376
|
-
"String"
|
377
|
-
],
|
378
|
-
"name": "first"
|
379
|
-
},
|
380
|
-
{
|
381
|
-
"tag_name": "param",
|
382
|
-
"text": "The second parameter.",
|
383
|
-
"types": [
|
384
|
-
"Any"
|
385
|
-
],
|
386
|
-
"name": "second"
|
387
|
-
},
|
388
|
-
{
|
389
|
-
"tag_name": "return",
|
390
|
-
"text": "Returns nothing.",
|
391
|
-
"types": [
|
392
|
-
"Undef"
|
393
|
-
]
|
394
|
-
}
|
395
|
-
]
|
396
|
-
},
|
397
|
-
"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"
|
398
|
-
},
|
399
|
-
{
|
400
|
-
"name": "func4x",
|
401
|
-
"file": "(stdin)",
|
402
|
-
"line": 11,
|
403
|
-
"type": "ruby4x",
|
404
|
-
"signatures": [
|
405
|
-
{
|
406
|
-
"signature": "func4x(Integer $param1, Any $param2, Optional[Array[String]] $param3)",
|
407
|
-
"docstring": {
|
408
|
-
"text": "The first overload.",
|
409
|
-
"tags": [
|
410
|
-
{
|
411
|
-
"tag_name": "param",
|
412
|
-
"text": "The first parameter.",
|
413
|
-
"types": [
|
414
|
-
"Integer"
|
415
|
-
],
|
416
|
-
"name": "param1"
|
417
|
-
},
|
418
|
-
{
|
419
|
-
"tag_name": "param",
|
420
|
-
"text": "The second parameter.",
|
421
|
-
"types": [
|
422
|
-
"Any"
|
423
|
-
],
|
424
|
-
"name": "param2"
|
425
|
-
},
|
426
|
-
{
|
427
|
-
"tag_name": "param",
|
428
|
-
"text": "The third parameter.",
|
429
|
-
"types": [
|
430
|
-
"Optional[Array[String]]"
|
431
|
-
],
|
432
|
-
"name": "param3"
|
433
|
-
},
|
434
|
-
{
|
435
|
-
"tag_name": "return",
|
436
|
-
"text": "Returns nothing.",
|
437
|
-
"types": [
|
438
|
-
"Undef"
|
439
|
-
]
|
440
|
-
}
|
441
|
-
]
|
442
|
-
}
|
443
|
-
},
|
444
|
-
{
|
445
|
-
"signature": "func4x(Boolean $param, Callable &$block)",
|
446
|
-
"docstring": {
|
447
|
-
"text": "",
|
448
|
-
"tags": [
|
449
|
-
{
|
450
|
-
"tag_name": "param",
|
451
|
-
"text": "The first parameter.",
|
452
|
-
"types": [
|
453
|
-
"Boolean"
|
454
|
-
],
|
455
|
-
"name": "param"
|
456
|
-
},
|
457
|
-
{
|
458
|
-
"tag_name": "param",
|
459
|
-
"text": "The block parameter.",
|
460
|
-
"types": [
|
461
|
-
"Callable"
|
462
|
-
],
|
463
|
-
"name": "&block"
|
464
|
-
},
|
465
|
-
{
|
466
|
-
"tag_name": "return",
|
467
|
-
"text": "Returns a string.",
|
468
|
-
"types": [
|
469
|
-
"String"
|
470
|
-
]
|
471
|
-
}
|
472
|
-
]
|
473
|
-
}
|
474
|
-
}
|
475
|
-
],
|
476
|
-
"docstring": {
|
477
|
-
"text": "An example 4.x function.",
|
478
|
-
"tags": [
|
479
|
-
{
|
480
|
-
"tag_name": "overload",
|
481
|
-
"signature": "func4x(Integer $param1, Any $param2, Optional[Array[String]] $param3)",
|
482
|
-
"docstring": {
|
483
|
-
"text": "The first overload.",
|
484
|
-
"tags": [
|
485
|
-
{
|
486
|
-
"tag_name": "param",
|
487
|
-
"text": "The first parameter.",
|
488
|
-
"types": [
|
489
|
-
"Integer"
|
490
|
-
],
|
491
|
-
"name": "param1"
|
492
|
-
},
|
493
|
-
{
|
494
|
-
"tag_name": "param",
|
495
|
-
"text": "The second parameter.",
|
496
|
-
"types": [
|
497
|
-
"Any"
|
498
|
-
],
|
499
|
-
"name": "param2"
|
500
|
-
},
|
501
|
-
{
|
502
|
-
"tag_name": "param",
|
503
|
-
"text": "The third parameter.",
|
504
|
-
"types": [
|
505
|
-
"Optional[Array[String]]"
|
506
|
-
],
|
507
|
-
"name": "param3"
|
508
|
-
},
|
509
|
-
{
|
510
|
-
"tag_name": "return",
|
511
|
-
"text": "Returns nothing.",
|
512
|
-
"types": [
|
513
|
-
"Undef"
|
514
|
-
]
|
515
|
-
}
|
516
|
-
]
|
517
|
-
},
|
518
|
-
"name": "func4x"
|
519
|
-
},
|
520
|
-
{
|
521
|
-
"tag_name": "overload",
|
522
|
-
"signature": "func4x(Boolean $param, Callable &$block)",
|
523
|
-
"docstring": {
|
524
|
-
"text": "",
|
525
|
-
"tags": [
|
526
|
-
{
|
527
|
-
"tag_name": "param",
|
528
|
-
"text": "The first parameter.",
|
529
|
-
"types": [
|
530
|
-
"Boolean"
|
531
|
-
],
|
532
|
-
"name": "param"
|
533
|
-
},
|
534
|
-
{
|
535
|
-
"tag_name": "param",
|
536
|
-
"text": "The block parameter.",
|
537
|
-
"types": [
|
538
|
-
"Callable"
|
539
|
-
],
|
540
|
-
"name": "&block"
|
541
|
-
},
|
542
|
-
{
|
543
|
-
"tag_name": "return",
|
544
|
-
"text": "Returns a string.",
|
545
|
-
"types": [
|
546
|
-
"String"
|
547
|
-
]
|
548
|
-
}
|
549
|
-
]
|
550
|
-
},
|
551
|
-
"name": "func4x"
|
552
|
-
}
|
553
|
-
]
|
554
|
-
},
|
555
|
-
"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 Returns nothing.\n dispatch :foo do\n param 'Integer', :param1\n param 'Any', :param2\n optional_param 'Array[String]', :param3\n return_type 'Undef'\n end\n\n # @param param The first parameter.\n # @param block The block parameter.\n # @return Returns a string.\n dispatch :other do\n param 'Boolean', :param\n block_param\n return_type 'String'\n end\nend"
|
556
|
-
},
|
557
|
-
{
|
558
|
-
"name": "func4x_1",
|
559
|
-
"file": "(stdin)",
|
560
|
-
"line": 35,
|
561
|
-
"type": "ruby4x",
|
562
|
-
"signatures": [
|
563
|
-
{
|
564
|
-
"signature": "func4x_1(Integer $param1)",
|
565
|
-
"docstring": {
|
566
|
-
"text": "An example 4.x function with only one signature.",
|
567
|
-
"tags": [
|
568
|
-
{
|
569
|
-
"tag_name": "param",
|
570
|
-
"text": "The first parameter.",
|
571
|
-
"types": [
|
572
|
-
"Integer"
|
573
|
-
],
|
574
|
-
"name": "param1"
|
575
|
-
},
|
576
|
-
{
|
577
|
-
"tag_name": "return",
|
578
|
-
"text": "Returns nothing.",
|
579
|
-
"types": [
|
580
|
-
"Undef"
|
581
|
-
]
|
582
|
-
}
|
583
|
-
]
|
584
|
-
}
|
585
|
-
}
|
586
|
-
],
|
587
|
-
"docstring": {
|
588
|
-
"text": "An example 4.x function with only one signature.",
|
589
|
-
"tags": [
|
590
|
-
{
|
591
|
-
"tag_name": "param",
|
592
|
-
"text": "The first parameter.",
|
593
|
-
"types": [
|
594
|
-
"Integer"
|
595
|
-
],
|
596
|
-
"name": "param1"
|
597
|
-
},
|
598
|
-
{
|
599
|
-
"tag_name": "return",
|
600
|
-
"text": "Returns nothing.",
|
601
|
-
"types": [
|
602
|
-
"Undef"
|
603
|
-
]
|
604
|
-
}
|
605
|
-
]
|
606
|
-
},
|
607
|
-
"source": "Puppet::Functions.create_function(:func4x_1) do\n # @param param1 The first parameter.\n # @return [Undef] Returns nothing.\n dispatch :foobarbaz do\n param 'Integer', :param1\n end\nend"
|
608
|
-
}
|
609
|
-
],
|
610
|
-
"puppet_tasks": [
|
611
|
-
{
|
612
|
-
"name": "(stdin)",
|
613
|
-
"file": "(stdin)",
|
614
|
-
"line": 0,
|
615
|
-
"docstring": {
|
616
|
-
"text": "Allows you to backup your database to local file.",
|
617
|
-
"tags": [
|
618
|
-
{
|
619
|
-
"name": "database",
|
620
|
-
"tag_name": "param",
|
621
|
-
"text": "Database to connect to",
|
622
|
-
"types": [
|
623
|
-
"Optional[String[1]]"
|
624
|
-
]
|
625
|
-
},
|
626
|
-
{
|
627
|
-
"name": "user",
|
628
|
-
"tag_name": "param",
|
629
|
-
"text": "The user",
|
630
|
-
"types": [
|
631
|
-
"Optional[String[1]]"
|
632
|
-
]
|
633
|
-
},
|
634
|
-
{
|
635
|
-
"name": "password",
|
636
|
-
"tag_name": "param",
|
637
|
-
"text": "The password",
|
638
|
-
"types": [
|
639
|
-
"Optional[String[1]]"
|
640
|
-
]
|
641
|
-
},
|
642
|
-
{
|
643
|
-
"name": "sql",
|
644
|
-
"tag_name": "param",
|
645
|
-
"text": "Path to file you want backup to",
|
646
|
-
"types": [
|
647
|
-
"String[1]"
|
648
|
-
]
|
649
|
-
}
|
650
|
-
]
|
651
|
-
},
|
652
|
-
"source": "{\n \"description\": \"Allows you to backup your database to local file.\",\n \"input_method\": \"stdin\",\n \"parameters\": {\n \"database\": {\n \"description\": \"Database to connect to\",\n \"type\": \"Optional[String[1]]\"\n },\n \"user\": {\n \"description\": \"The user\",\n \"type\": \"Optional[String[1]]\"\n },\n \"password\": {\n \"description\": \"The password\",\n \"type\": \"Optional[String[1]]\"\n },\n \"sql\": {\n \"description\": \"Path to file you want backup to\",\n \"type\": \"String[1]\"\n }\n }\n}\n",
|
653
|
-
"supports_noop": false,
|
654
|
-
"input_method": "stdin"
|
655
|
-
}
|
656
|
-
],
|
657
|
-
"puppet_plans": [
|
658
|
-
|
659
|
-
]
|
660
|
-
}
|