class QaAtMigration::Generator

Constants

CONFIG_FILE
CONFIG_IGNORE_KEY
CSV_HEADERS
TEST_FILE_PATTERN

Public Instance Methods

generate(sourcepath, targetpath, output_filename = 'master.csv') click to toggle source
# File lib/qa_at_migration/generator.rb, line 8
def generate sourcepath, targetpath, output_filename = 'master.csv'
  @sourcepath = sourcepath ? sourcepath : Dir.pwd
  output_path_filename = targetpath ? File.join(targetpath, output_filename) : output_filename
  CSV.open(output_path_filename, 'w', headers: CSV_HEADERS, write_headers: true) do |csv|
    paths.each { |path| csv << TestFile.new(path).content }
  end
end

Private Instance Methods

ignored_files() click to toggle source
# File lib/qa_at_migration/generator.rb, line 24
def ignored_files
  YAML.load_file(File.join(@sourcepath, CONFIG_FILE))[CONFIG_IGNORE_KEY]
end
paths() click to toggle source
# File lib/qa_at_migration/generator.rb, line 18
def paths
  Dir.glob(File.join(@sourcepath, TEST_FILE_PATTERN), File::FNM_CASEFOLD).reject do |filename|
    File.directory?(filename) || File.basename(filename).start_with?(*ignored_files)
  end
end