Created
April 22, 2009 13:05
-
-
Save madx/99782 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Command line autotest tool | |
target = ARGV[0] | |
raise ArgumentError if target.nil? || !File.exist?(target) | |
running = true | |
trap "INT" do | |
puts "Interrupted by user" | |
exit | |
end | |
trap "TSTP" do | |
running = !running | |
end | |
loop do | |
puts "spec -cfp #{target}" | |
result = `spec -cfp #{target}` | |
if $?.to_i > 0 | |
message = `spec -cfe #{target}` | |
system "notify-send -i dialog-error -u critical 'Spec failed' '#{message}'" | |
puts result | |
puts "Stopping til you fix that bug! Hit ^Z to restart" | |
running = false | |
end | |
if running | |
sleep 3 | |
else | |
sleep until running | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment