Created
June 25, 2013 06:13
-
-
Save kasei-san/5856326 to your computer and use it in GitHub Desktop.
autospec で、結果を Growl で通知
【参考】autotest + growl で楽々テスト - 僕は発展途上技術者 http://blog.champierre.com/774
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
# vim: set ft=ruby | |
module Autotest::Growl | |
def self.growl title, msg, pri=0, sticky="" | |
msg += " at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}" | |
system "growlnotify -n autotest -p #{pri} -m #{msg.inspect} #{title} #{sticky}" | |
end | |
Autotest.add_hook :ran_command do |at| | |
output = at.results.last | |
output = output.gsub!(/\e\[\d+m/,'').gsub!(/\n/,'') | |
if output =~ /(\d+)\s+failure/ | |
if $1.to_i > 0 | |
growl "Tests Failed", "#{output}", 2, "-s" | |
else | |
growl "Tests Passed", "#{output}", -2 | |
end | |
else | |
growl "Tests Failed", "errors", 2, "-s" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment