Skip to content

Commit 8242136

Browse files
authored
Merge pull request #1239 from puppetlabs/unbreak-rake-reference
Unbreak `rake strings:generate:reference`
2 parents 2592c83 + c6287f0 commit 8242136

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+787
-283
lines changed

REFERENCE.md

Lines changed: 663 additions & 169 deletions
Large diffs are not rendered by default.

functions/ensure.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# @summary function to cast ensure parameter to resource specific value
2+
#
3+
# @return [String]
24
function stdlib::ensure(
35
Variant[Boolean, Enum['present', 'absent']] $ensure,
46
Enum['directory', 'link', 'mounted', 'service', 'file', 'package'] $resource,

lib/puppet/functions/parsehocon.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
# This function accepts HOCON as a string and converts it into the correct
55
# Puppet structure
66
#
7-
# @return
8-
# Data
9-
#
107
# @example How to parse hocon
118
# $data = parsehocon("{any valid hocon: string}")
129
#
1310
Puppet::Functions.create_function(:parsehocon) do
1411
# @param hocon_string A valid HOCON string
1512
# @param default An optional default to return if parsing hocon_string fails
13+
# @return [Data]
1614
dispatch :parsehocon do
1715
param 'String', :hocon_string
1816
optional_param 'Any', :default

lib/puppet/functions/stdlib/str2resource.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
# @summary
44
# This converts a string to a puppet resource.
55
#
6-
# This attempts to convert a string like 'File[/foo]' into the
7-
# puppet resource `File['/foo']` as detected by the catalog.
6+
# This attempts to convert a string like 'File[/foo]' into the
7+
# puppet resource `File['/foo']` as detected by the catalog.
88
#
9-
# Things like 'File[/foo, /bar]' are not supported as a
10-
# title might contain things like ',' or ' '. There is
11-
# no clear value seperator to use.
9+
# Things like 'File[/foo, /bar]' are not supported as a
10+
# title might contain things like ',' or ' '. There is
11+
# no clear value seperator to use.
1212
#
13-
# This function can depend on the parse order of your
14-
# manifests/modules as it inspects the catalog thus far.
13+
# This function can depend on the parse order of your
14+
# manifests/modules as it inspects the catalog thus far.
1515
Puppet::Functions.create_function(:'stdlib::str2resource') do
1616
# @param res_string The string to lookup as a resource
1717
# @example

lib/puppet/functions/to_json.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
require 'json'
44
# @summary
55
# Convert a data structure and output to JSON
6-
#
7-
# @example Output JSON to a file
8-
# file { '/tmp/my.json':
9-
# ensure => file,
10-
# content => to_json($myhash),
11-
# }
12-
#
136
Puppet::Functions.create_function(:to_json) do
147
# @param data
158
# Data structure which needs to be converted into JSON
9+
#
10+
# @example Output JSON to a file
11+
# file { '/tmp/my.json':
12+
# ensure => file,
13+
# content => to_json($myhash),
14+
# }
15+
#
1616
# @return [String] Converted data to JSON
1717
dispatch :to_json do
1818
param 'Any', :data

lib/puppet/functions/to_python.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
# }
1616

1717
Puppet::Functions.create_function(:to_python) do
18-
dispatch :to_python do
19-
param 'Any', :object
20-
end
21-
2218
# @param object
2319
# The object to be converted
2420
#
2521
# @return [String]
2622
# The String representation of the object
23+
dispatch :to_python do
24+
param 'Any', :object
25+
end
26+
2727
def to_python(object)
2828
serialized = Puppet::Pops::Serialization::ToDataConverter.convert(object, rich_data: true)
2929
serialized_to_python(serialized)

lib/puppet/functions/to_ruby.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
# }
1616

1717
Puppet::Functions.create_function(:to_ruby) do
18-
dispatch :to_ruby do
19-
param 'Any', :object
20-
end
21-
2218
# @param object
2319
# The object to be converted
2420
#
2521
# @return [String]
2622
# The String representation of the object
23+
dispatch :to_ruby do
24+
param 'Any', :object
25+
end
26+
2727
def to_ruby(object)
2828
serialized = Puppet::Pops::Serialization::ToDataConverter.convert(object, rich_data: true)
2929
serialized_to_ruby(serialized)

lib/puppet/functions/to_yaml.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
require 'yaml'
44
# @summary
55
# Convert a data structure and output it as YAML
6-
#
7-
# @example Output YAML to a file
8-
# file { '/tmp/my.yaml':
9-
# ensure => file,
10-
# content => to_yaml($myhash),
11-
# }
12-
# @example Use options to control the output format
13-
# file { '/tmp/my.yaml':
14-
# ensure => file,
15-
# content => to_yaml($myhash, {indentation => 4})
16-
# }
176
Puppet::Functions.create_function(:to_yaml) do
187
# @param data
198
# The data you want to convert to YAML
209
# @param options
2110
# A hash of options that will be passed to Ruby's Psych library. Note, this could change between Puppet versions, but at time of writing these are `line_width`, `indentation`, and `canonical`.
2211
#
12+
# @example Output YAML to a file
13+
# file { '/tmp/my.yaml':
14+
# ensure => file,
15+
# content => to_yaml($myhash),
16+
# }
17+
# @example Use options to control the output format
18+
# file { '/tmp/my.yaml':
19+
# ensure => file,
20+
# content => to_yaml($myhash, {indentation => 4})
21+
# }
22+
#
2323
# @return [String] The YAML document
2424
dispatch :to_yaml do
2525
param 'Any', :data

lib/puppet/parser/functions/defined_with_params.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
# Test whether a given class or definition is defined
44
require 'puppet/parser/functions'
55

6-
Puppet::Parser::Functions.newfunction(:defined_with_params,
7-
type: :rvalue,
8-
doc: <<-DOC,
6+
Puppet::Parser::Functions.newfunction(:defined_with_params, type: :rvalue, doc: <<-DOC
97
@summary
108
Takes a resource reference and an optional hash of attributes.
119
@@ -25,7 +23,7 @@
2523
@return [Boolean]
2624
returns `true` or `false`
2725
DOC
28-
) do |vals|
26+
) do |vals|
2927
reference, params = vals
3028
raise(ArgumentError, 'Must specify a reference') unless reference
3129
if !params || params == ''

lib/puppet/parser/functions/dig44.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
# dig44.rb
55
#
66
module Puppet::Parser::Functions
7-
newfunction(
8-
:dig44,
9-
type: :rvalue,
10-
arity: -2,
11-
doc: <<-DOC,
7+
newfunction(:dig44, type: :rvalue, arity: -2, doc: <<-DOC
128
@summary
139
**DEPRECATED**: Looks up into a complex structure of arrays and hashes and returns a value
1410
or the default value if nothing was found.

0 commit comments

Comments
 (0)