2018-04-05 06:06:01 -04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2018-04-10 07:22:38 -04:00
|
|
|
require_relative '../lib/rspec_flaky/report'
|
2018-04-05 06:06:01 -04:00
|
|
|
|
|
|
|
report_file = ARGV.shift
|
|
|
|
unless report_file
|
|
|
|
puts 'usage: prune-old-flaky-specs <report-file> <new-report-file>'
|
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
|
|
|
new_report_file = ARGV.shift || report_file
|
2018-04-10 07:22:38 -04:00
|
|
|
report = RspecFlaky::Report.load(report_file)
|
2018-04-05 06:06:01 -04:00
|
|
|
puts "Loading #{report_file}..."
|
2018-04-10 07:22:38 -04:00
|
|
|
puts "Current report has #{report.size} entries."
|
2018-04-05 06:06:01 -04:00
|
|
|
|
2018-04-10 07:22:38 -04:00
|
|
|
new_report = report.prune_outdated
|
2018-04-05 06:06:01 -04:00
|
|
|
|
2018-04-10 07:22:38 -04:00
|
|
|
puts "New report has #{new_report.size} entries: #{report.size - new_report.size} entries older than 90 days were removed."
|
|
|
|
puts "Saved #{new_report_file}." if new_report.write(new_report_file)
|