lib/chicanery/handlers.rb in chicanery-0.1.7 vs lib/chicanery/handlers.rb in chicanery-0.1.8
- old
+ new
@@ -1,7 +1,12 @@
+require 'chicanery/debug'
+require 'colorize'
+
module Chicanery
module Handlers
+ include Debug
+
%w{run started succeeded failed broken fixed commit up down crashed recovered}.each do |status|
class_eval <<-EOF
def when_#{status} &block
#{status}_handlers << block
end
@@ -9,9 +14,10 @@
def #{status}_handlers
@#{status}_handlers ||= []
end
def notify_#{status}_handlers *args
+ verbose_blue \"\t\tnow #{status}\"
#{status}_handlers.each {|handler| handler.call *args }
end
EOF
end
end
\ No newline at end of file