Created
May 30, 2012 16:34
-
-
Save rafmagana/2837480 to your computer and use it in GitHub Desktop.
Send growl notifications from vagrant to mac
This file contains hidden or 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
# First, enable "Listen for incoming notifications" | |
# in Growl preferences and set a password | |
# You might want to use this in an initializer | |
growl = Growl::GNTP.new 'ip_of_your_mac', 'App name' | |
growl.password = 'your_password' | |
# growl.add_notification 'name' | |
# growl.notify 'name', 'title', 'message' | |
ActiveSupport::Notifications.subscribe 'hook_name' do |*args| | |
event = ActiveSupport::Notification::Event.new args | |
if event.payload[:some_key] = 'some_value' | |
growl.notify 'notification', 'title', 'message' | |
end | |
end |
This file contains hidden or 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 'ruby-growl' | |
growl = Growl::GNTP.new 'ip_of_your_mac', 'App name' | |
growl.password = 'your_password' | |
growl.notify 'notification', 'title', 'message' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment