Author: boisvert
Date: Sun Oct 24 20:09:16 2010
New Revision: 1026878

URL: http://svn.apache.org/viewvc?rev=1026878&view=rev
Log:
Refactor linux.rb

Modified:
    buildr/trunk/lib/buildr/core/linux.rb

Modified: buildr/trunk/lib/buildr/core/linux.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/linux.rb?rev=1026878&r1=1026877&r2=1026878&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/linux.rb (original)
+++ buildr/trunk/lib/buildr/core/linux.rb Sun Oct 24 20:09:16 2010
@@ -16,22 +16,15 @@
 
 # Let's see if we can use notify-send.  Must be running from console in 
verbose mode.
 if $stdout.isatty && verbose
+  system("which notify-send > /dev/null 2>/dev/null")
+  if $?.exitstatus == 0
+    def notify_send(type, title, message)
+      icon = File.join(File.dirname(__FILE__), '../resources/', type.to_s + 
'.png')
+      system "notify-send -i #{icon} \"#{title}\" \"#{message}\""
+    end
 
-  def command_exist?(command)
-    system("which #{command} > /dev/null 2>/dev/null")
-    $?.exitstatus == 0
-  end
-
-  def notify_send(type, title, message)
-    icon = File.join(File.dirname(__FILE__), '../resources/', type.to_s + 
'.png')
-    system "notify-send -i #{icon} \"#{title}\" \"#{message}\""
-  end
-
-  if command_exist? 'notify-send'
     Buildr.application.on_completion { |title, message| 
notify_send(:completed, title, message) if verbose }
     Buildr.application.on_failure { |title, message, ex| notify_send(:failed, 
title, message) if verbose }
   end
-
 end
 
-


Reply via email to