Skip to content

Instantly share code, notes, and snippets.

@joecannatti
Created January 26, 2011 00:45
Show Gist options
  • Save joecannatti/796018 to your computer and use it in GitHub Desktop.
Save joecannatti/796018 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'rubygems'
require 'colorize'
$stdout.print "Building"
$stdout.flush
$errcode = 0
show_output = false
puts
IO.popen(ARGV[0]) do |io|
last_lines = []
loop do
break if io.eof?
line = io.readline
if line =~ /^Test/
last_lines << line
end
if line =~ /^Executed.*0 failures/
$stdout.puts '.'.colorize(:green)
last_lines.clear
elsif line =~ /^Executed 1 /
puts
$errcode = 1
last_lines.each { |l| $stdout.print l.colorize(:red) }
$stdout.print line.colorize(:red)
elsif line =~ /^.*FAILED.*$/
$errcode = 1
end
end
end
puts
pe = $?.exitstatus
exit ($errcode + pe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment