-
Notifications
You must be signed in to change notification settings - Fork 2
/
autotest
26 lines (20 loc) · 809 Bytes
/
autotest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'autotest/fsevent'
# Tip from http://wincent.com/knowledge-base/Setting_up_autotest_to_use_Growl
module Autotest::Growl
def self.growl title, msg, img, pri=0, sticky=""
system "osascript ~/scripts/growlnotify.scpt '#{title}' '#{msg.inspect}' '#{img}'"
# system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}"
end
Autotest.add_hook :ran_command do |at|
image_root = "~/.autotest_images"
results = [at.results].flatten.join("\n")
output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+not implemented)?/)
if output
if $~[2].to_i > 0
growl "Fail", "#{output}", "#{image_root}/fail.png", 2
else
growl "Pass", "#{output}", "#{image_root}/pass.png"
end
end
end
end