Report abuse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
module Autotest::Growl
def self.growl title, msg, img, pri=0, stick=""
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}"
end
Autotest.add_hook :ran_command do |at|
output = at.results.join(' ').slice(/(\d+).*errors/)
if output =~ /ns.*[1-9]/
unflag if flagged?
growl "Test Results", "#{output}", '~/Library/autotest/rails_fail.png', 2 else
if(!flagged?)
flag
growl "Test Results", "#{output}", '~/Library/autotest/rails_ok.png'
end
end
end
def self.flagged?
File.exist?('tmp/autotest-flag')
end
def self.flag
File.open('tmp/autotest-flag','w')
puts 'planting green flag'
end
def self.unflag
puts 'removing green flag'
File.delete('tmp/autotest-flag') if flagged?
end
end
|