Skip to content

Commit a84173c

Browse files
committed
(MAINT) Refactor markdown content fixtures into files
1 parent ae9a323 commit a84173c

File tree

14 files changed

+313
-308
lines changed

14 files changed

+313
-308
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Gemfile.lock
3939
/log/
4040
/*.gem
4141
/spec/acceptance/nodesets/
42-
/spec/fixtures/manifests/
4342
/spec/fixtures/modules/
43+
/spec/fixtures/manifests/
4444
/inventory.yaml
4545

4646
## local coverage results

spec/fixtures/json/task.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"description": "Allows you to backup your database to local file.",
3+
"input_method": "stdin",
4+
"parameters": {
5+
"database": {
6+
"description": "Database to connect to",
7+
"type": "Optional[String[1]]"
8+
},
9+
"user": {
10+
"description": "The user",
11+
"type": "Optional[String[1]]"
12+
},
13+
"password": {
14+
"description": "The password",
15+
"type": "Optional[String[1]]"
16+
},
17+
"sql": {
18+
"description": "Path to file you want backup to",
19+
"type": "String[1]"
20+
}
21+
}
22+
}

spec/fixtures/puppet/class.pp

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# An overview for a simple class.
2+
# @summary A simple class.
3+
# @todo Do a thing
4+
# @note some note
5+
# @since 1.0.0
6+
# @see www.puppet.com
7+
# @example This is an example
8+
# class { 'klass':
9+
# param1 => 1,
10+
# param3 => 'foo',
11+
# }
12+
# @example This is another example
13+
# class { 'klass':
14+
# param1 => 1,
15+
# param3 => 'foo',
16+
# }
17+
# @raise SomeError
18+
# @param param1 First param.
19+
# @param param2 Second param.
20+
# @option param2 [String] :opt1 something about opt1
21+
# @option param2 [Hash] :opt2 a hash of stuff
22+
# @param param3 Third param.
23+
# @param param4 Fourth param.
24+
# @enum param4 :one One option
25+
# @enum param4 :two Second option
26+
#
27+
class klass (
28+
Integer $param1 = 1,
29+
$param2 = undef,
30+
String $param3 = 'hi',
31+
Enum['one', 'two'] $param4 = 'two',
32+
) inherits foo::bar {
33+
}
34+
35+
# Overview for class noparams
36+
# @api private
37+
class noparams () {}
38+
39+
# An overview for a simple defined type.
40+
# @summary A simple defined type.
41+
# @since 1.1.0
42+
# @see www.puppet.com
43+
# @example Here's an example of this type:
44+
# klass::dt { 'foo':
45+
# param1 => 33,
46+
# param4 => false,
47+
# }
48+
# @return shouldn't return squat
49+
# @raise SomeError
50+
# @param param1 First param.
51+
# @param param2 Second param.
52+
# @option param2 [String] :opt1 something about opt1
53+
# @option param2 [Hash] :opt2 a hash of stuff
54+
# @param param3 Third param.
55+
# @param param4 Fourth param.
56+
# @param param5 Fifth param.
57+
# @enum param5 :a Option A
58+
# @enum param5 :b Option B
59+
define klass::dt (
60+
Integer $param1 = 44,
61+
$param2,
62+
String $param3 = 'hi',
63+
Boolean $param4 = true,
64+
Enum['a', 'b'] $param5 = 'a'
65+
) {
66+
}

spec/fixtures/puppet/function.pp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# A simple Puppet function.
2+
# @param param1 First param.
3+
# @param param2 Second param.
4+
# @param param3 Third param.
5+
# @option param3 [Array] :param3opt Something about this option
6+
# @param param4 Fourth param.
7+
# @enum param4 :yes Yes option.
8+
# @enum param4 :no No option.
9+
# @raise SomeError this is some error
10+
# @return [Undef] Returns nothing.
11+
# @example Test
12+
# $result = func(1, 2)
13+
function func(Integer $param1, $param2, String $param3 = hi, Enum['yes', 'no'] $param4 = 'yes') {
14+
}

spec/fixtures/puppet/plan.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# A simple plan.
2+
# @param param1 First param.
3+
# @param param2 Second param.
4+
# @param param3 Third param.
5+
plan plann(String $param1, $param2, Integer $param3 = 1) {
6+
}

spec/fixtures/puppet/type_alias.pp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Documentation for Amodule::SimpleAlias
2+
type Amodule::SimpleAlias = Variant[Numeric,String[1,20]]
3+
4+
# Documentation for Amodule::ComplexAlias
5+
type Amodule::ComplexAlias = Struct[{
6+
value_type => Optional[ValueType],
7+
merge => Optional[MergeType]
8+
}]

spec/fixtures/ruby/data_type.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# An example Puppet Data Type in Ruby.
2+
#
3+
# @param param1 A variant parameter.
4+
# @param param2 Optional String parameter.
5+
Puppet::DataTypes.create_type('UnitDataType') do
6+
interface <<-PUPPET
7+
attributes => {
8+
param1 => Variant[Numeric, String[1,2]],
9+
param2 => { type => Optional[String[1]], value => "param2" }
10+
}
11+
PUPPET
12+
end

spec/fixtures/ruby/func3x.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# An example 3.x function
2+
Puppet::Parser::Functions.newfunction(:func3x, doc: <<-DOC
3+
Documentation for an example 3.x function.
4+
@param param1 [String] The first parameter.
5+
@param param2 [Integer] The second parameter.
6+
@return [Undef]
7+
@example Calling the function.
8+
func3x('hi', 10)
9+
DOC
10+
) do |*args|
11+
#...
12+
end

spec/fixtures/ruby/func4x.rb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# An example 4.x function.
2+
#
3+
# @example Calling the function
4+
# $result = func4x(1, 'foo')
5+
#
6+
# @example Calling the function with all args
7+
# $result = func4x(1, 'foo', ['bar'])
8+
Puppet::Functions.create_function(:func4x) do
9+
# An overview for the first overload.
10+
# @raise SomeError this is some error
11+
# @param param1 The first parameter.
12+
# @param param2 The second parameter.
13+
# @option param2 [String] :option an option
14+
# @option param2 [String] :option2 another option
15+
# @param param3 The third parameter.
16+
# @param param4 The fourth parameter.
17+
# @enum param4 :one Option one.
18+
# @enum param4 :two Option two.
19+
# @return Returns nothing.
20+
# @example Calling the function foo
21+
# $result = func4x(1, 'foooo')
22+
#
23+
dispatch :foo do
24+
param 'Integer', :param1
25+
param 'Any', :param2
26+
optional_param 'Array[String]', :param3
27+
optional_param 'Enum[one, two]', :param4
28+
return_type 'Undef'
29+
end
30+
31+
# An overview for the second overload.
32+
# @param param The first parameter.
33+
# @param block The block parameter.
34+
# @return Returns a string.
35+
# @example Calling the function bar
36+
# $result = func4x(1, 'bar', ['foo'])
37+
dispatch :other do
38+
param 'Boolean', :param
39+
block_param
40+
return_type 'String'
41+
end
42+
end

spec/fixtures/ruby/func4x_1.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# An example 4.x function with only one signature.
2+
Puppet::Functions.create_function(:func4x_1) do
3+
# @param param1 The first parameter.
4+
# @return [Undef] Returns nothing.
5+
dispatch :foobarbaz do
6+
param 'Integer', :param1
7+
end
8+
end
9+

0 commit comments

Comments
 (0)