Created
October 20, 2009 12:37
-
-
Save shift/214221 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rbus' | |
module Autotest::DBus | |
def self.notify title, msg, pri = 'Information', img = nil | |
title += " in #{Dir.pwd.split(/\//).last(3).join("/")}" | |
msg += " at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}" | |
bus = RBus.session_bus | |
object = bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications') | |
object.interface!('org.freedesktop.Notifications') | |
object.Notify("AT: #{title}", | |
0, | |
"#{pri}", | |
"AT: #{title}", | |
"#{msg}", | |
[], | |
{}, | |
-1) | |
nil | |
end | |
Autotest.add_hook :initialize do |at| | |
notify "autotest running", "Started" | |
end | |
Autotest.add_hook :red do |at| | |
notify "Tests Failed", "#{at.files_to_test.size} tests failed", "Error" | |
end | |
Autotest.add_hook :green do |at| | |
notify "Tests Passed", "Tests passed", "Information" if at.tainted | |
end | |
Autotest.add_hook :all_good do |at| | |
notify "Tests Passed", "All tests passed", "Information" if at.tainted | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment