Return-Path: Delivered-To: apmail-incubator-buildr-commits-archive@locus.apache.org Received: (qmail 33436 invoked from network); 11 Aug 2008 21:30:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Aug 2008 21:30:13 -0000 Received: (qmail 28344 invoked by uid 500); 11 Aug 2008 21:30:12 -0000 Delivered-To: apmail-incubator-buildr-commits-archive@incubator.apache.org Received: (qmail 28326 invoked by uid 500); 11 Aug 2008 21:30:12 -0000 Mailing-List: contact buildr-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: buildr-dev@incubator.apache.org Delivered-To: mailing list buildr-commits@incubator.apache.org Received: (qmail 28315 invoked by uid 99); 11 Aug 2008 21:30:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Aug 2008 14:30:12 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Aug 2008 21:29:24 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C1BFE238899E; Mon, 11 Aug 2008 14:29:52 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r684941 - /incubator/buildr/trunk/lib/buildr/core/application.rb Date: Mon, 11 Aug 2008 21:29:52 -0000 To: buildr-commits@incubator.apache.org From: boisvert@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080811212952.C1BFE238899E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: boisvert Date: Mon Aug 11 14:29:52 2008 New Revision: 684941 URL: http://svn.apache.org/viewvc?rev=684941&view=rev Log: Remove BUILDR_NOTIFY and let's call it a learning opportunity Modified: incubator/buildr/trunk/lib/buildr/core/application.rb Modified: incubator/buildr/trunk/lib/buildr/core/application.rb URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/application.rb?rev=684941&r1=684940&r2=684941&view=diff ============================================================================== --- incubator/buildr/trunk/lib/buildr/core/application.rb (original) +++ incubator/buildr/trunk/lib/buildr/core/application.rb Mon Aug 11 14:29:52 2008 @@ -393,39 +393,28 @@ end -# We only do this when running from the console in verbose mode. -if $stdout.isatty && verbose - # Send notifications using BUILDR_NOTIFY environment variable, if defined - if ENV['BUILDR_NOTIFY'] && ENV['BUILDR_NOTIFY'].length > 0 - notify = lambda do |type, title, message| - require 'shellwords' - args = { '{type}'=>type, '{title}'=>title, '{message}'=>message } - system Shellwords.shellwords(ENV['BUILDR_NOTIFY']).map { |arg| args[arg] || arg }.map(&:inspect).join(' ') - end - Buildr.application.on_completion { |title, message| notify['completed', title, message] } - Buildr.application.on_failure { |title, message, ex| notify['failed', title, message] } - elsif RUBY_PLATFORM =~ /darwin/ - # Let's see if we can use Growl. We do this at the very end, loading Ruby Cocoa - # could slow the build down, so later is better. - notify = lambda do |type, title, message| - 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) - end - Buildr.application.on_completion { |title, message| notify['Completed', title, message] } - Buildr.application.on_failure { |title, message, ex| notify['Failed', title, message] } +# Let's see if we can use Growl. We do this at the very end, loading Ruby Cocoa +# could slow the build down, so later is better. We only do this when running +# from the console in verbose mode. +if $stdout.isatty && verbose && RUBY_PLATFORM =~ /darwin/ + notify = lambda do |type, title, message| + 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) end + Buildr.application.on_completion { |title, message| notify['Completed', title, message] } + Buildr.application.on_failure { |title, message, ex| notify['Failed', title, message] } end