-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.autotest
88 lines (72 loc) · 2.14 KB
/
.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Save this as ".autotest" in root_folder of computer or project
# These require growlnotify, but once you have that you can tweak priorities
# in the Growl control panel to get RedGreen in the growl bubble itself!
# http://growl.info/documentation/growlnotify.php
#Taken straight from the example in Autotest gem
module AutoGrowl
def self.growl title, msg, pri=0
system "growlnotify -n autotest --image /Applications/Mail.app/Contents/Resources/Caution.tiff -p #{pri} -m #{msg.inspect} #{title}"
end
Autotest.add_hook :run do |at|
growl "Run", "Run" unless $TESTING
end
Autotest.add_hook :red do |at|
growl "Tests Failed", "#{at.files_to_test.size} tests failed", 2
end
# Autotest.add_hook :green do |at|
# growl "Tests Passed", "All tests passed", -2 if at.tainted
# end
Autotest.add_hook :init do |at|
growl "autotest", "autotest was started" unless $TESTING
end
Autotest.add_hook :interrupt do |at|
growl "autotest", "autotest was reset" unless $TESTING
end
Autotest.add_hook :quit do |at|
growl "autotest", "autotest is exiting" unless $TESTING
end
# Autotest.add_hook :all do |at|_hook
# growl "autotest", "Tests have fully passed", -1 unless $TESTING
# end
end
# class Autotest
#
# # All code borrowed from:
# # http://www.robsanheim.com/2006/08/07/hacking-green-bar-color-output-into-autotest/
#
#
# BAR = "=" * 80
#
# # filter output for colorized green/red bar
# def filter_output(results)
# filtered = ""
# results.each do |line|
#
# if line =~ /\d+ tests, \d+ assertions, 0 failures, 0 errors/
# line = "\e[32m#{BAR}\n#{$&}\e[0m\n\n"
# elsif line =~ /\d+ tests, \d+ assertions, (\d+) failures, (\d+) errors/
# if $1 != 0 || $2 != 0
# line = "\e[31m#{BAR}\n#{$&}\e[0m\n\n"
# end
# end
# filtered <<line
# end
# filtered
# end
#
#
#
# def run_tests
# find_files_to_test # failed + changed/affected
# cmd = make_test_cmd @files_to_test
#
# puts cmd
#
# @results = `#{cmd}`
# hook :ran_command
# puts filter_output(@results)
#
# handle_results(@results)
# end
#
# end