Created
October 4, 2012 14:06
-
-
Save benwoody/3833728 to your computer and use it in GitHub Desktop.
.autotest for notify-send
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
require 'autotest' | |
module Autotest::Notify | |
def self.notify title, msg, img, pri='low', time=3000 | |
`notify-send #{title} -i #{img} -u #{pri} -t #{time} '#{msg}'` | |
end | |
Autotest.add_hook :ran_command do |autotest| | |
results = [autotest.results].flatten.join("\n") | |
output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+pending)?/) | |
folder = "~/Dropbox/Photos/autotest/" | |
if output =~ /[1-9]\d*\sfailures?/ | |
notify "FAIL:", "#{output}", folder+"failed.png", 'critical', 10000 | |
elsif output =~ /[1-9]\d*\spending?/ | |
notify "PENDING:", "#{output}", folder+"pending.png", 'normal', 10000 | |
else | |
notify "PASS:", "#{output}", folder+"passed.png" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment