-
Notifications
You must be signed in to change notification settings - Fork 8
/
.autotest
58 lines (46 loc) · 1.83 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
if RUBY_PLATFORM =~ /linux/
require 'autotest/redgreen'
Autotest.add_hook :initialize do |at|
at.add_exception(".git")
at.add_exception("coverage")
end
module Autotest::GnomeNotify
# Time notification will be displayed before disappearing automatically
EXPIRATION_IN_SECONDS = 5
ERROR_STOCK_ICON = "gtk-dialog-error"
SUCCESS_STOCK_ICON = "gtk-dialog-info"
# Convenience method to send an error notification message
#
# [stock_icon] Stock icon name of icon to display
# [title] Notification message title
# [message] Core message for the notification
def self.notify stock_icon, title, message
options = "-t #{EXPIRATION_IN_SECONDS * 1000} -i #{stock_icon}"
system "notify-send #{options} '#{title}' '#{message}'"
end
Autotest.add_hook :red do |at|
notify ERROR_STOCK_ICON, "Tests failed", "#{at.files_to_test.size} tests failed"
end
Autotest.add_hook :green do |at|
notify SUCCESS_STOCK_ICON, "All tests passed, good job!", ""
end
end
elsif RUBY_PLATFORM =~ /darwin/
require 'rubygems'
require 'growl_glue'
GrowlGlue::Autotest.initialize do |config|
# config.notification :use_network_notifications => true
config.title :failure => "PANIC PANIC PANIC"
config.say :failure => "ON NO!!!"
config.title :success => "Everything is Great"
config.sound :success => "Glass.aiff"
config.say :pending => "Almost there guy!"
config.voice :pending => "Boing"
# GrowlGlue comes with success and error images it will use
# on test success and error, respectively. If you wish to supply
# your own, for example:
# config.image :success => "~/Library/autotest/success.png"
# config.image :pending => "~/Library/autotest/pending.png"
# config.image :failure => "~/Library/autotest/failure.png"
end
end