class Swiftrail::Cli

Private Class Methods

defaults() click to toggle source
# File lib/swiftrail/cli.rb, line 10
def self.defaults
  @defaults ||= Config::Reader.new.defaults
end

Public Instance Methods

coverage() click to toggle source
# File lib/swiftrail/cli.rb, line 36
def coverage
  results = swiftrail_coverage.coverage_report(options[:run_id])
  if options['output_folder'].nil?
    puts(JSON.pretty_generate(results))
  else
    write(results, File.join(options['output_folder'], 'coverage.swiftrail'))
  end

end
lint() click to toggle source
# File lib/swiftrail/cli.rb, line 48
def lint
  results = swiftrail_lint.lint_report(options[:run_id])
  if options['output_folder'].nil?
    puts(JSON.pretty_generate(results))
  else
    write(results, File.join(options['output_folder'], 'lint.swiftrail'))
  end
end
report() click to toggle source
# File lib/swiftrail/cli.rb, line 26
def report
  if swiftrail_reporter.report_results(options[:run_id], options[:dry_run])
    puts 'Successfully reported the results'
  else
    puts 'There was an issue while reporting the results'
  end
end

Private Instance Methods

swiftrail_coverage() click to toggle source
# File lib/swiftrail/cli.rb, line 70
def swiftrail_coverage
  Swiftrail::Testrail::Coverage.new(
    [options['test_classes']],
    options['test_rail_username'],
    options['test_rail_password'],
    options['test_rail_url']
  )
end
swiftrail_lint() click to toggle source
# File lib/swiftrail/cli.rb, line 79
def swiftrail_lint
  Swiftrail::Testrail::Lint.new(
    [options['test_classes']],
    options['test_rail_username'],
    options['test_rail_password'],
    options['test_rail_url']
  )
end
swiftrail_reporter() click to toggle source
# File lib/swiftrail/cli.rb, line 59
def swiftrail_reporter
  Swiftrail::Testrail::Reporter.new(
    [options['test_reports']],
    [options['test_classes']],
    options['test_rail_username'],
    options['test_rail_password'],
    options['test_rail_url'],
    options['strict']
  )
end
write(hash, file) click to toggle source
# File lib/swiftrail/cli.rb, line 88
def write(hash, file)
  File.open(file,"w") do |f|
    f.write(JSON.pretty_generate(hash))
  end
end