Method: PDK::Module::Build#ignored_files

Defined in:
lib/pdk/module/build.rb

#ignored_filesPathSpec

Instantiate a new PathSpec class and populate it with the pattern(s) of files to be ignored.

Returns:

  • (PathSpec)

    The populated ignore path matcher.



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/pdk/module/build.rb', line 299

def ignored_files
  require 'pdk/module'
  require 'pathspec'

  @ignored_files ||=
    begin
      ignored = if ignore_file.nil?
                  PathSpec.new
                else
                  PathSpec.new(PDK::Util::Filesystem.read_file(ignore_file, open_args: 'rb:UTF-8'))
                end

      if File.realdirpath(target_dir).start_with?(File.realdirpath(module_dir))
        ignored = ignored.add("\/#{File.basename(target_dir)}\/")
      end

      PDK::Module::DEFAULT_IGNORED.each { |r| ignored.add(r) }

      ignored
    end
end