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
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/guard/tap/runner.rb', line 6
def run command, title = command
notify "runnning: #{title}"
now_error = false
error_message = ''
flush_error = lambda {
next unless error_message.length > 0
notify_error error_message
error_message = ''
}
IO.popen(command, "r+"){ |io|
while line = io.gets
UI.info line
if line =~ /^ok/
now_error = false
flush_error.call
elsif line =~ /^\d+.{2}\d+$/
now_error = false
flush_error.call
elsif line =~ /^not ok/
flush_error.call
now_error = (line =~ / # TODO/ ? false : true)
end
if now_error
error_message << line
end
end
}
flush_error.call
if $?.success?
notify_success "success: #{title}"
else
notify_error "failed: #{title}"
end
$?.success?
rescue SystemCallError
notify_error "failed: #{title}"
false
end
|