# File lib/buildr/core/osx.rb, line 19
  def growl_notify(type, title, message)
    begin
      # Loading Ruby Cocoa can slow the build down (hooks on Object class), so we're
      # saving the best for last and only requiring it at the very end.
      require 'osx/cocoa'
      icon = OSX::NSApplication.sharedApplication.applicationIconImage
      icon = OSX::NSImage.alloc.initWithContentsOfFile(File.join(File.dirname(__FILE__), '../resources/buildr.icns'))

      # Register with Growl, that way you can turn notifications on/off from system preferences.
      OSX::NSDistributedNotificationCenter.defaultCenter.
        postNotificationName_object_userInfo_deliverImmediately(:GrowlApplicationRegistrationNotification, nil,
          { :ApplicationName=>'Buildr', :AllNotifications=>['Completed', 'Failed'],
            :ApplicationIcon=>icon.TIFFRepresentation }, true)

      OSX::NSDistributedNotificationCenter.defaultCenter.
        postNotificationName_object_userInfo_deliverImmediately(:GrowlNotification, nil,
          { :ApplicationName=>'Buildr', :NotificationName=>type,
            :NotificationTitle=>title, :NotificationDescription=>message }, true)
    rescue Exception
      # We get here in two cases: system doesn't have Growl installed so one of the OSX
      # calls raises an exception; system doesn't have osx/cocoa, e.g. MacPorts Ruby 1.9,
      # so we also need to rescue LoadError.
    end
  end