From ad5aca381c890b111ace1450d838f91be034f14b Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Tue, 10 Mar 2009 17:32:48 -0400 Subject: [PATCH] make sure surefire report exists to prevent error * ticket #3 * (http://cpjolicoeur.lighthouseapp.com/projects/22299/tickets/3-maven-2-builder-error-with-missing-surefire-report) --- lib/cerberus/builder/maven2.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cerberus/builder/maven2.rb b/lib/cerberus/builder/maven2.rb index 98ade3f..3d1a680 100644 --- a/lib/cerberus/builder/maven2.rb +++ b/lib/cerberus/builder/maven2.rb @@ -31,9 +31,10 @@ def add_error_information $` =~ /^(.|\n)*Running (.*)$/ failed_class = $2 @output << $` << $& << ' <<< FAILURE!' - @output << "\n" << IO.readlines("#{@config[:application_root]}/target/surefire-reports/#{failed_class}.txt")[4..-1].join.lstrip #map{|str| ' ' + str}..gsub(' <<< FAILURE!','') + surefire_report_filename = "#{@config[:application_root]}/target/surefire-reports/#{failed_class}.txt" + @output << "\n" << IO.readlines(surefire_report_filename)[4..-1].join.lstrip if test(?e, surefire_report_filename) str = s end @output << str end -end \ No newline at end of file +end