2014-03-17 01:31:05 -04:00
|
|
|
require "mail_catcher/events"
|
|
|
|
|
2011-06-09 23:24:08 -04:00
|
|
|
module MailCatcher
|
2012-07-25 00:00:31 -04:00
|
|
|
module Growl extend self
|
2011-06-09 23:24:08 -04:00
|
|
|
def start
|
2014-03-17 01:31:05 -04:00
|
|
|
MailCatcher::Events::MessageAdded.subscribe(method(:notify))
|
2011-06-09 23:24:08 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def notify message
|
2014-03-17 01:31:05 -04:00
|
|
|
system "growlnotify",
|
|
|
|
"--image", File.expand_path(File.join(__FILE__, "../public/images/logo_large.png")),
|
|
|
|
"--name", "MailCatcher",
|
|
|
|
"--message", "Message received:\n#{message["subject"]}"
|
2011-06-09 23:24:08 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|