class ET::SubmissionFileList

Constants

DEFAULT_IGNORE_GLOBS

Public Class Methods

new(path) click to toggle source
# File lib/et/submission_file_list.rb, line 12
def initialize(path)
  @path = path
end

Public Instance Methods

each(&block) click to toggle source
# File lib/et/submission_file_list.rb, line 34
def each(&block)
  files.each do |file|
    block.call(file)
  end
end
files() click to toggle source
# File lib/et/submission_file_list.rb, line 16
def files
  unless @files
    @files = Rake::FileList[File.join(@path, "**/*"), File.join(@path, ".etignore")]
    ignore_globs.each do |glob|
      filename = File.join(@path, glob)

      if File.directory?(filename)
        filename += glob.end_with?("/") ? "**/*" : "/**/*"
      end

      @files = @files.exclude(filename)
    end
    @files = @files.sub(File.join(@path, "/"), "")
  end

  @files
end

Protected Instance Methods

etignore_globs() click to toggle source
# File lib/et/submission_file_list.rb, line 45
def etignore_globs
  unless @etignore_globs
    etignore = File.join(@path, '.etignore')
    if FileTest.exists?(etignore)
      @etignore_globs = File.read(etignore).split(/\n/)
      @etignore_globs.delete_if { | string | string.start_with?("#") || string.empty?}
    else
      @etignore_globs = []
    end
  end
  @etignore_globs
end
ignore_globs() click to toggle source
# File lib/et/submission_file_list.rb, line 41
def ignore_globs
  etignore_globs + [] + DEFAULT_IGNORE_GLOBS
end