From e8e1e0ca2381810549d032ea7afccb60f12aeaf2 Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Tue, 8 Jul 2014 21:16:30 -0500 Subject: [PATCH] Abort unless files exist --- Rakefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index fcc59fb5..76d4c292 100644 --- a/Rakefile +++ b/Rakefile @@ -103,9 +103,13 @@ namespace :benchmark do task :results do reference, compare = ENV['compare'].split('...') + reference_classifications_file = "benchmark/results/#{reference}_output.json" + compare_classifications_file = "benchmark/results/#{compare}_output.json" + # DO COMPARISON... - reference_classifications = JSON.parse(File.read("benchmark/results/#{reference}_output.json")) - compare_classifications = JSON.parse(File.read("benchmark/results/#{compare}_output.json")) + abort("No result files to compare") unless (File.exist?(reference_classifications_file) && File.exist?(compare_classifications_file)) + reference_classifications = JSON.parse(File.read(reference_classifications_file)) + compare_classifications = JSON.parse(File.read(compare_classifications_file)) puts "Changes between #{reference}...#{compare}" puts reference_classifications.deep_diff(compare_classifications)