Permalink
Browse files

adding autotest icons

  • Loading branch information...
1 parent 3601fb7 commit 50bce1dff2defea48e1b8a67e51a7dbcc726a768 @tenderlove committed Nov 1, 2008
View
@@ -1,3 +1,13 @@
+=== 2.1.0
+
+* 2 Minor enhancements
+
+ * Autotest integration. Just add this to your .autotest file:
+ require 'meow/autotest'
+ * The icon option now takes a string which is assumed to be the path to an
+ icon.
+
+
=== 2.0.0
* 1 Major enhancement
View
@@ -1,8 +1,13 @@
+.autotest
CHANGELOG.rdoc
Manifest.txt
README.rdoc
Rakefile
+icons/fail.png
+icons/initialize.jpeg
+icons/pass.png
lib/meow.rb
+lib/meow/autotest.rb
lib/meow/notifier.rb
meow.gemspec
test/assets/aaron.jpeg
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -2,7 +2,7 @@
require 'meow/notifier'
class Meow
- VERSION = '2.0.0'
+ VERSION = '2.1.0'
PRIORITIES = { :very_low => -2,
:moderate => -1,
:normal => 0,
@@ -122,6 +122,7 @@ def notify(title, description, opts = {}, &block)
}.merge(opts)
register(opts[:note_type]) unless @registered.include?(opts[:note_type])
+ opts[:icon] = Meow.import_image(opts[:icon]) if opts[:icon].is_a?(String)
notification = {
:ApplicationName => name,
View
@@ -2,22 +2,43 @@
class Meow
class Autotest
+ @icon_dirs = [File.expand_path(
+ File.join(File.dirname(__FILE__), '..', '..', 'icons')
+ )]
+
@@meow = Meow.new('Meow Autotest')
+ class << self
+ attr_accessor :icon_dirs
+
+ def icon_for action
+ @icon_dirs.reverse.each do |dir|
+ file = Dir[File.join(dir,'**')].find { |name| name =~ /#{action}/ }
+ return file if file
+ end
+ end
+ end
+
::Autotest.add_hook :initialize do |at|
- @@meow.notify "Autotest", 'started'
+ @@meow.notify "Autotest", 'started', { :icon => icon_for(:initialize) }
end
::Autotest.add_hook :red do |at|
- @@meow.notify "Autotest", "#{at.files_to_test.size} test are fail."
+ @@meow.notify "Autotest", "#{at.files_to_test.size} test are fail.",
+ { :icon => icon_for(:fail) }
end
::Autotest.add_hook :green do |at|
- @@meow.notify "Autotest", "Tests pass!" if at.tainted
+ if at.tainted
+ @@meow.notify "Autotest", "Tests pass!", { :icon => icon_for(:pass) }
+ end
end
::Autotest.add_hook :all_good do |at|
- @@meow.notify "Autotest", "All tests pass!" if at.tainted
+ if at.tainted
+ @@meow.notify "Autotest", "All tests pass!",
+ { :icon => icon_for(:pass) }
+ end
end
end
end

0 comments on commit 50bce1d

Please sign in to comment.