Growl is a global notification system for Mac OS X. Applications can register messages which Growl displays on the screen in a variety of ways depending upon your preferences.
Growl's existing Ruby bindings only work on Macs, and I wanted my non-Mac machines to be able to send Growl notifications. I peeked inside Growl's remote-notification capabilities and wrote up some code that uses UDP to send Growl notifications across the network.
You need a Mac with Growl installed to recieve Growl notifications, Ruby and a kind of network connection between the two machines.
ruby-growl features a library you can use to add Growl notifications to your Ruby applications and a command-line tool that is almost option-compatible with growlnotify. (All except for -p is supported, use --priority instead.)
First you need to enable "Listen for incoming notifications" and "Allow remote application registration" on the Network tab of the Growl Preference Panel to send Growl Notifications from ruby-growl. You'll probably also want to set a "UDP password" as well.
require 'ruby-growl'
g = Growl.new "localhost", "ruby-growl",
["ruby-growl Notification"]
g.notify "ruby-growl Notification", "It Came From Ruby-Growl",
"Greetings!"
echo "message" | growl -H localhost
or:
growl -H localhost -m "message"
| Type | Download |
|---|---|
| ruby-growl gem | ruby-growl-1.0.1.gem |
| ruby-growl tgz | ruby-growl-1.0.1.tgz |
Yep! There's RDoc for ruby-growl.