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.



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/pdk/module/build.rb', line 280

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

  @ignored_files ||=
    begin
      ignored = if ignore_file.nil?
                  PathSpec.new
                else
                  fd = File.open(ignore_file, 'rb:UTF-8')
                  data = fd.read
                  fd.close

                  PathSpec.new(data)
                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