Skip to content

Commit d89dc82

Browse files
committed
Dup frozen strings
Some of the `puppet doc --reference <name>` commands failed after the switch to frozen literal strings. This dups strings in the same way we did in fb20023 and adds missing tests. Also ignore the validator terminus for the resource model when generating docs.
1 parent 12cc9e6 commit d89dc82

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

lib/puppet/reference/indirection.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
text << Puppet::Util::Docs.scrub(ind.doc) + "\n\n"
1616

1717
Puppet::Indirector::Terminus.terminus_classes(ind.name).sort_by(&:to_s).each do |terminus|
18+
# this is an "abstract" terminus, ignore it
19+
next if ind.name == :resource && terminus == :validator
20+
1821
terminus_name = terminus.to_s
1922
term_class = Puppet::Indirector::Terminus.terminus_class(ind.name, terminus)
2023
if term_class

lib/puppet/reference/metaparameter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
## Available Metaparameters
1616
17-
}
17+
}.dup
1818
begin
1919
params = []
2020
Puppet::Type.eachmetaparam { |param|

lib/puppet/reference/providers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
command_line = Puppet::Util::CommandLine.new
1414
types.reject! { |type| !command_line.args.include?(type.name.to_s) } unless command_line.args.empty?
1515

16-
ret = "Details about this host:\n\n"
16+
ret = "Details about this host:\n\n".dup
1717

1818
# Throw some facts in there, so we know where the report is from.
1919
ret << option('Ruby Version', Facter.value('ruby.version'))

lib/puppet/reference/type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
Resource types define features they can use, and providers can be tested to see
5151
which features they provide.
5252
53-
}
53+
}.dup
5454

5555
types.sort_by(&:to_s).each { |name, type|
5656
str << "

spec/integration/application/doc_spec.rb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,21 @@
1414
.and output(/configuration - A reference for all settings/).to_stdout
1515
end
1616

17-
it 'generates markdown' do
18-
app.command_line.args = ['-r', 'report']
19-
expect {
20-
app.run
21-
}.to exit_with(0)
22-
.and output(/# Report Reference/).to_stdout
17+
{
18+
'configuration' => /# Configuration Reference/,
19+
'function' => /# Function Reference/,
20+
'indirection' => /# Indirection Reference/,
21+
'metaparameter' => /# Metaparameter Reference/,
22+
'providers' => /# Provider Suitability Report/,
23+
'report' => /# Report Reference/,
24+
'type' => /# Type Reference/
25+
}.each_pair do |type, expected|
26+
it "generates #{type} reference" do
27+
app.command_line.args = ['-r', type]
28+
expect {
29+
app.run
30+
}.to exit_with(0)
31+
.and output(expected).to_stdout
32+
end
2333
end
2434
end

0 commit comments

Comments
 (0)