class Rufo::FileFinder
def all_rb_files(file_or_dir)
def all_rb_files(file_or_dir) Dir.chdir(file_or_dir) do fl = build_file_list fl.to_a.map do |path| File.join(file_or_dir, path) end end end
def build_file_list
def build_file_list fl = Rufo::FileList.new(*DEFAULT_PATTERNS) fl.exclude(*EXCLUDE_PATTERNS) fl.exclude(*excludes) fl.include(*includes) fl end
def each
def each files_or_dirs.each do |file_or_dir| if Dir.exist?(file_or_dir) all_rb_files(file_or_dir).each { |file| yield [true, file] } else yield [File.exist?(file_or_dir), file_or_dir] end end end
def initialize(files_or_dirs, includes: [], excludes: [])
def initialize(files_or_dirs, includes: [], excludes: []) @files_or_dirs = files_or_dirs @includes = includes @excludes = excludes end