Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
59 lines (46 sloc) 1.83 KB
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