2018-04-05 06:06:01 -04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2018-04-11 09:51:31 -04:00
|
|
|
# lib/rspec_flaky/flaky_examples_collection.rb is requiring
|
|
|
|
# `active_support/hash_with_indifferent_access`, and we install the `activesupport`
|
|
|
|
# gem manually on the CI
|
|
|
|
require 'rubygems'
|
|
|
|
|
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)
|