|
15 | 15 | before :each do |
16 | 16 | # Populate the YARD registry with both Puppet and Ruby source |
17 | 17 |
|
18 | | - YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby) |
19 | | -Puppet::Type.newtype(:database) do |
20 | | - desc 'An example database server resource type.' |
21 | | -end |
| 18 | + YARD::Parser::SourceParser.parse_string(<<~'SOURCE', :ruby) |
| 19 | + Puppet::Type.newtype(:database) do |
| 20 | + desc 'An example database server resource type.' |
| 21 | + end |
22 | 22 | SOURCE |
23 | 23 |
|
24 | | - YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby) |
25 | | -Puppet::ResourceApi.register_type( |
26 | | - name: 'apt_key', |
27 | | - docs: <<-EOS, |
28 | | -@summary Example resource type using the new API. |
29 | | -@raise SomeError |
30 | | -This type provides Puppet with the capabilities to manage GPG keys needed |
31 | | -by apt to perform package validation. Apt has it's own GPG keyring that can |
32 | | -be manipulated through the `apt-key` command. |
33 | | -@example here's an example |
34 | | - apt_key { '6F6B15509CF8E59E6E469F327F438280EF8D349F': |
35 | | - source => 'http://apt.puppetlabs.com/pubkey.gpg' |
36 | | - } |
37 | | -
|
38 | | -**Autorequires**: |
39 | | -If Puppet is given the location of a key file which looks like an absolute |
40 | | -path this type will autorequire that file. |
41 | | - EOS |
42 | | -) |
| 24 | + YARD::Parser::SourceParser.parse_string(<<~'SOURCE', :ruby) |
| 25 | + Puppet::ResourceApi.register_type( |
| 26 | + name: 'apt_key', |
| 27 | + docs: <<~'EOS', |
| 28 | + @summary Example resource type using the new API. |
| 29 | + @raise SomeError |
| 30 | + This type provides Puppet with the capabilities to manage GPG keys needed |
| 31 | + by apt to perform package validation. Apt has it's own GPG keyring that can |
| 32 | + be manipulated through the `apt-key` command. |
| 33 | + @example here's an example |
| 34 | + apt_key { '6F6B15509CF8E59E6E469F327F438280EF8D349F': |
| 35 | + source => 'http://apt.puppetlabs.com/pubkey.gpg' |
| 36 | + } |
| 37 | +
|
| 38 | + **Autorequires**: |
| 39 | + If Puppet is given the location of a key file which looks like an absolute |
| 40 | + path this type will autorequire that file. |
| 41 | + EOS |
| 42 | + ) |
43 | 43 | SOURCE |
44 | 44 |
|
45 | | - YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby) |
46 | | - Puppet::Type.type(:file).newproperty(:content) do |
47 | | - include Puppet::Util::Checksums |
48 | | - include Puppet::DataSync |
| 45 | + YARD::Parser::SourceParser.parse_string(<<~'SOURCE', :ruby) |
| 46 | + Puppet::Type.type(:file).newproperty(:content) do |
| 47 | + include Puppet::Util::Checksums |
| 48 | + include Puppet::DataSync |
49 | 49 |
|
50 | | - attr_reader :actual_content |
| 50 | + attr_reader :actual_content |
51 | 51 |
|
52 | | - desc <<-'EOT' |
53 | | - The desired contents of a file, as a string. This attribute is mutually |
54 | | - exclusive with `source` and `target`. |
55 | | - EOT |
56 | | - end |
| 52 | + desc <<~'EOT' |
| 53 | + The desired contents of a file, as a string. This attribute is mutually |
| 54 | + exclusive with `source` and `target`. |
| 55 | + EOT |
| 56 | + end |
57 | 57 | SOURCE |
58 | 58 |
|
59 | | - YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby) |
60 | | - Puppet::Type.newtype(:file) do |
61 | | - include Puppet::Util::Checksums |
62 | | - include Puppet::Util::Backups |
63 | | - include Puppet::Util::SymbolicFileMode |
| 59 | + YARD::Parser::SourceParser.parse_string(<<~'SOURCE', :ruby) |
| 60 | + Puppet::Type.newtype(:file) do |
| 61 | + include Puppet::Util::Checksums |
| 62 | + include Puppet::Util::Backups |
| 63 | + include Puppet::Util::SymbolicFileMode |
64 | 64 |
|
65 | | - @doc = "Manages files, including their content, ownership, and permissions. |
| 65 | + @doc = "Manages files, including their content, ownership, and permissions. |
66 | 66 |
|
67 | | - The `file` type can manage normal files, directories, and symlinks; the |
68 | | - type should be specified in the `ensure` attribute." |
| 67 | + The `file` type can manage normal files, directories, and symlinks; the |
| 68 | + type should be specified in the `ensure` attribute." |
69 | 69 |
|
70 | | - newparam(:path) do |
71 | | - desc <<-'EOT' |
72 | | - The path to the file to manage. Must be fully qualified. |
| 70 | + newparam(:path) do |
| 71 | + desc <<~'EOT' |
| 72 | + The path to the file to manage. Must be fully qualified. |
73 | 73 |
|
74 | | - On Windows, the path should include the drive letter and should use `/` as |
75 | | - the separator character (rather than `\\`). |
76 | | - EOT |
77 | | - isnamevar |
78 | | - end |
| 74 | + On Windows, the path should include the drive letter and should use `/` as |
| 75 | + the separator character (rather than `\`). |
| 76 | + EOT |
| 77 | + isnamevar |
| 78 | + end |
79 | 79 |
|
80 | | - end |
| 80 | + end |
81 | 81 | SOURCE |
82 | 82 |
|
83 | | - YARD::Parser::SourceParser.parse_string(<<-SOURCE, :ruby) |
84 | | -Puppet::Type.type(:file).newproperty(:source) do |
85 | | - include Puppet::Util::Checksums |
86 | | - include Puppet::DataSync |
| 83 | + YARD::Parser::SourceParser.parse_string(<<~'SOURCE', :ruby) |
| 84 | + Puppet::Type.type(:file).newproperty(:source) do |
| 85 | + include Puppet::Util::Checksums |
| 86 | + include Puppet::DataSync |
87 | 87 |
|
88 | | - attr_reader :actual_content |
| 88 | + attr_reader :actual_content |
89 | 89 |
|
90 | | - desc <<-'EOT' |
91 | | - The desired contents of a file, as a string. This attribute is mutually |
92 | | - exclusive with `source` and `target`. |
93 | | - EOT |
94 | | -end |
| 90 | + desc <<-'EOT' |
| 91 | + The desired contents of a file, as a string. This attribute is mutually |
| 92 | + exclusive with `source` and `target`. |
| 93 | + EOT |
| 94 | + end |
95 | 95 | SOURCE |
96 | 96 | end |
97 | 97 |
|
98 | 98 | describe 'rendering DESCRIBE to stdout' do |
99 | 99 | it 'outputs the expected describe content for the list of types' do |
100 | | - output = <<-DATA |
101 | | -These are the types known to puppet: |
102 | | -apt_key - This type provides Puppet with the capabiliti ... |
103 | | -database - An example database server resource type. |
104 | | -file - Manages files, including their content, owner ... |
| 100 | + output = <<~'DATA' |
| 101 | + These are the types known to puppet: |
| 102 | + apt_key - This type provides Puppet with the capabiliti ... |
| 103 | + database - An example database server resource type. |
| 104 | + file - Manages files, including their content, owner ... |
105 | 105 | DATA |
106 | 106 | expect { described_class.render(nil, true) }.to output(output).to_stdout |
107 | 107 | end |
108 | 108 | it 'outputs the expected describe content for a type' do |
109 | | - output = <<-DATA |
| 109 | + output = <<~'DATA' |
110 | 110 |
|
111 | | -file |
112 | | -==== |
113 | | -Manages files, including their content, ownership, and permissions. |
| 111 | + file |
| 112 | + ==== |
| 113 | + Manages files, including their content, ownership, and permissions. |
114 | 114 |
|
115 | | -The `file` type can manage normal files, directories, and symlinks; the |
116 | | -type should be specified in the `ensure` attribute. |
| 115 | + The `file` type can manage normal files, directories, and symlinks; the |
| 116 | + type should be specified in the `ensure` attribute. |
117 | 117 |
|
118 | | -Parameters |
119 | | ----------- |
| 118 | + Parameters |
| 119 | + ---------- |
120 | 120 |
|
121 | | -- **content** |
122 | | -The desired contents of a file, as a string. This attribute is mutually |
123 | | -exclusive with `source` and `target`. |
| 121 | + - **content** |
| 122 | + The desired contents of a file, as a string. This attribute is mutually |
| 123 | + exclusive with `source` and `target`. |
124 | 124 |
|
125 | | -- **path** |
126 | | -The path to the file to manage. Must be fully qualified. |
| 125 | + - **path** |
| 126 | + The path to the file to manage. Must be fully qualified. |
127 | 127 |
|
128 | | -On Windows, the path should include the drive letter and should use `/` as |
129 | | -the separator character (rather than `\\`). |
| 128 | + On Windows, the path should include the drive letter and should use `/` as |
| 129 | + the separator character (rather than `\`). |
130 | 130 |
|
131 | | -- **source** |
132 | | -The desired contents of a file, as a string. This attribute is mutually |
133 | | -exclusive with `source` and `target`. |
| 131 | + - **source** |
| 132 | + The desired contents of a file, as a string. This attribute is mutually |
| 133 | + exclusive with `source` and `target`. |
134 | 134 |
|
135 | | -Providers |
136 | | ---------- |
| 135 | + Providers |
| 136 | + --------- |
137 | 137 | DATA |
138 | 138 | expect { described_class.render(['file']) }.to output(output).to_stdout |
139 | 139 | end |
|
0 commit comments