|
5 | 5 | module Puppet::Modulebuilder
|
6 | 6 | # Class to build Puppet Modules from source
|
7 | 7 | class Builder
|
8 |
| - DEFAULT_IGNORED = [ |
9 |
| - '/.*', |
10 |
| - '/pkg/', |
11 |
| - '~*', |
12 |
| - '/coverage', |
13 |
| - '/checksums.json', |
14 |
| - '/REVISION', |
15 |
| - '/spec/fixtures/modules/', |
16 |
| - '/vendor/' |
| 8 | + IGNORED = [ |
| 9 | + '/*', |
| 10 | + '!/manifests', |
| 11 | + '!/README*', |
| 12 | + '!/metadata.json', |
| 13 | + '!/LICENSE', |
| 14 | + '!/hiera.yaml', |
| 15 | + '!/data', |
| 16 | + '!/templates', |
| 17 | + '!/files', |
| 18 | + '!/CHANGELOG*', |
| 19 | + '!/docs', |
| 20 | + '!/REFERENCE.md', |
| 21 | + '!/locales', |
| 22 | + '!/scripts', |
| 23 | + '!/tasks', |
| 24 | + '!/plans', |
| 25 | + '!/types', |
| 26 | + '!/bolt_plugin.json', |
17 | 27 | ].freeze
|
18 | 28 |
|
19 | 29 | attr_reader :destination, :logger
|
@@ -168,21 +178,6 @@ def warn_symlink(path)
|
168 | 178 | from: symlink_path.relative_path_from(module_path), to: symlink_path.realpath.relative_path_from(module_path))
|
169 | 179 | end
|
170 | 180 |
|
171 |
| - # Select the most appropriate ignore file in the module directory. |
172 |
| - # |
173 |
| - # In order of preference, we first try `.pdkignore`, then `.pmtignore` |
174 |
| - # and finally `.gitignore`. |
175 |
| - # |
176 |
| - # @return [String] The path to the file containing the patterns of file |
177 |
| - # paths to ignore. |
178 |
| - def ignore_file |
179 |
| - @ignore_file ||= [ |
180 |
| - File.join(source, '.pdkignore'), |
181 |
| - File.join(source, '.pmtignore'), |
182 |
| - File.join(source, '.gitignore') |
183 |
| - ].find { |file| file_exists?(file) && file_readable?(file) } |
184 |
| - end |
185 |
| - |
186 | 181 | # Checks if the path contains any non-ASCII characters.
|
187 | 182 | #
|
188 | 183 | # Java will throw an error when it encounters a path containing
|
@@ -251,20 +246,11 @@ def build_package
|
251 | 246 | def ignored_files
|
252 | 247 | require 'pathspec'
|
253 | 248 |
|
254 |
| - @ignored_files ||= |
255 |
| - begin |
256 |
| - ignored = if ignore_file.nil? |
257 |
| - PathSpec.new |
258 |
| - else |
259 |
| - PathSpec.new(read_file(ignore_file, open_args: 'rb:UTF-8')) |
260 |
| - end |
261 |
| - |
262 |
| - ignored = ignored.add("/#{File.basename(destination)}/") if File.realdirpath(destination).start_with?(File.realdirpath(source)) |
| 249 | + ignored = PathSpec.new |
| 250 | + ignored = ignored.add("/#{File.basename(destination)}/") if File.realdirpath(destination).start_with?(File.realdirpath(source)) |
| 251 | + ignored = ignored.add(IGNORED.join("\n")) |
263 | 252 |
|
264 |
| - DEFAULT_IGNORED.each { |r| ignored.add(r) } |
265 |
| - |
266 |
| - ignored |
267 |
| - end |
| 253 | + ignored |
268 | 254 | end
|
269 | 255 |
|
270 | 256 | # Create a temporary build directory where the files to be included in
|
|
0 commit comments