Snarl: Growl Notifications for Windows

It’s been a while since I’ve been developing under OSX, and one of the things I definitely miss is Growl notifications. I looked around and found Snarl, a windows app inspired by Growl.

With my new toy in hand, I set out to get some notifications going. We’ve been playing around with Redmine, which is a a very nice issue tracking system built on Rails. Redmine features great Subversion integration, and has an Activity page that summarizes updates to issues, Subversion checkins, wiki updates, and pretty much anything else that would go on in the project. There’s an Atom page that you can subscribe to for updates, and I thought it would be a good place to poll for Snarl notifications.

I wrote this little script (which could probably use a little love) to poll a feed and provide Snarl updates. It requires the FeedTools and ruby-snarl gems. So far, it’s making me love Redmine more and more.

require 'feed_tools'
require 'snarl'

source = ARGV[0]
last_item = nil
old_guids = []
while true
  puts "Checking for updates..."
  feed = FeedTools::Feed.open(source)
  feed.items.sort_by{|i|i.updated}.reverse.each do |item|
    if !old_guids.include? item.guid
      old_guids << item.guid
      title = item.title.nil? ? "" : item.title[0..1023]
      description = item.description.nil? ?
        "" : item.description.gsub(/<\/?[^>]*>/, "")[0..1023]
      Snarl.show_message title, description
    end
  end
  sleep 1*60*1000
end

Posted by Scott Wed, 16 Jul 2008 19:36:00 GMT