Skip to content

Instantly share code, notes, and snippets.

@luislavena
Created November 9, 2008 20:33
Show Gist options
  • Save luislavena/23338 to your computer and use it in GitHub Desktop.
Save luislavena/23338 to your computer and use it in GitHub Desktop.
~/.autotest
require 'rubygems'
require 'win32console'
require 'snarl'
Autotest.add_hook :initialize do |at|
%w{.svn .hg .git .bzr}.each { |exception| at.add_exception(exception) }
end
module Autotest::Snarl
def self.icon
# icons from http://www.famfamfam.com/lab/icons/silk/
path = File.expand_path("~/tools/icons")
{
:green => "#{path}/accept.png",
:red => "#{path}/exclamation.png",
:info => "#{path}/information.png"
}
end
def self.snarl(title, msg, ico = nil)
msg += "\nin #{Dir.pwd.split(/\//).last(3).join("/")}"
Snarl.show_message(title, msg, icon[ico])
end
Autotest.add_hook :initialize do |at|
snarl "autotest running", "Started", :info
end
Autotest.add_hook :red do |at|
snarl "Tests Failed", "#{at.files_to_test.size} tests failed", :red
end
Autotest.add_hook :green do |at|
snarl "Tests Passed", "Tests passed", :green if at.tainted
end
Autotest.add_hook :all_good do |at|
snarl "Tests Passed", "All tests passed", :green if at.tainted
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment