diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-03 17:35:00 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-03 17:35:00 +0200 |
commit | 792670f4ce467f278b5cdfd609a221bbbe26187d (patch) | |
tree | fa9d875a0bb0d2044ea26e4eeb332460fa88b30e /scripts | |
parent | 95c3a927b319c8495c28e6431152e5ca0c5df30b (diff) | |
download | gitlab-ce-792670f4ce467f278b5cdfd609a221bbbe26187d.tar.gz |
Merge knapsack reports and upload them to external server
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/merge-reports | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/merge-reports b/scripts/merge-reports new file mode 100755 index 00000000000..f7b574001ac --- /dev/null +++ b/scripts/merge-reports @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby + +require 'json' +require 'yaml' + +main_report_file = ARGV.shift +unless main_report_file + puts 'usage: merge_reports <main-report> [extra reports...]' + exit 1 +end + +puts "Loading #{main_report_file}..." +main_report = JSON.parse(File.read(main_report_file)) +new_report = main_report.dup + +ARGV.each do |report_file| + report = JSON.parse(File.read(report_file)) + + # Remove existing values + updates = report.delete_if do |key, value| + main_report[key] && main_report[key] == value + end + new_report.merge!(updates) + + puts "Merged #{report_file} adding #{updates.size} results." +end + +File.write(main_report_file, JSON.pretty_generate(new_report)) +puts "Saved #{main_report_file}." |