Author: boisvert
Date: Sun Oct 24 20:01:48 2010
New Revision: 1026877
URL: http://svn.apache.org/viewvc?rev=1026877&view=rev
Log:
BUILDR-521 System tray notifications for Linux systems (via
libnotify/notify-send)
Added:
buildr/trunk/lib/buildr/core/linux.rb
- copied, changed from r1026628, buildr/trunk/lib/buildr/core.rb
buildr/trunk/lib/buildr/resources/completed.png
buildr/trunk/lib/buildr/resources/failed.png
buildr/trunk/lib/buildr/resources/icons-license.txt
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/doc/more_stuff.textile
buildr/trunk/lib/buildr/core.rb
Modified: buildr/trunk/CHANGELOG
URL:
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1026877&r1=1026876&r2=1026877&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Sun Oct 24 20:01:48 2010
@@ -1,4 +1,6 @@
1.4.4 (Pending)
+* Added: BUILDR-521: System tray notifications for Linux systems
+ (via libnotify/notify-send)
* Added: BUILDR-537 Shell tasks should use JAVA_OPTS by default
* Added: BUILDR-538 Shell tasks should support passing :java_args
* Fixed: BUILDR-542 Release task: SVN tagging fails if parent tag directory
Modified: buildr/trunk/doc/more_stuff.textile
URL:
http://svn.apache.org/viewvc/buildr/trunk/doc/more_stuff.textile?rev=1026877&r1=1026876&r2=1026877&view=diff
==============================================================================
--- buildr/trunk/doc/more_stuff.textile (original)
+++ buildr/trunk/doc/more_stuff.textile Sun Oct 24 20:01:48 2010
@@ -311,9 +311,13 @@ $ dbuildr clean compile
The @dbuildr@ command will start the BuildrServer if there isn't one already
running. Subsequent calls to dbuildr will act as the client and invoke the
tasks you provide to the server. If the buildfile has been modified it will be
reloaded on the BuildrServer.
-h2(#growl). Growl, Qube
+h2(#notifications). Notifications: Growl, Libnotify, Qube
-For OS X users, Buildr supports "Growl":http://growl.info/ out of the box to
send "completed" and "failed" notifications to the user.
+Buildr support sending notifications when the build completes or fails, such
as displaying the outcome message in an overlaid window on top of other
applications.
+
+For OS X users, Buildr supports "Growl":http://growl.info/ out of the box by
using the Ruby Cocoa bindings.
+
+For Debian-based Linux users, Buildr supports notifications via the
"notify-send":http://manpages.ubuntu.com/manpages/gutsy/man1/notify-send.1.html
command which is part of the
"libnotify-bin":"http://packages.debian.org/search?keywords=libnotify-bin"
package. Just make sure `notify-send` is installed and on your path is on your
`PATH`.
For other platforms or if you want to notify the user differently, Buildr
offers two extension points:
Modified: buildr/trunk/lib/buildr/core.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core.rb?rev=1026877&r1=1026876&r2=1026877&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core.rb (original)
+++ buildr/trunk/lib/buildr/core.rb Sun Oct 24 20:01:48 2010
@@ -30,4 +30,5 @@ require 'buildr/core/transports'
require 'buildr/core/generate'
require 'buildr/core/cc'
require 'buildr/core/osx' if RUBY_PLATFORM =~ /darwin/
+require 'buildr/core/linux' if RUBY_PLATFORM =~ /linux/
Copied: buildr/trunk/lib/buildr/core/linux.rb (from r1026628,
buildr/trunk/lib/buildr/core.rb)
URL:
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/linux.rb?p2=buildr/trunk/lib/buildr/core/linux.rb&p1=buildr/trunk/lib/buildr/core.rb&r1=1026628&r2=1026877&rev=1026877&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core.rb (original)
+++ buildr/trunk/lib/buildr/core/linux.rb Sun Oct 24 20:01:48 2010
@@ -13,21 +13,25 @@
# License for the specific language governing permissions and limitations under
# the License.
-require 'buildr/core/common'
-require 'buildr/core/application'
-require 'buildr/core/jrebel'
-require 'buildr/core/project'
-require 'buildr/core/environment'
-require 'buildr/core/help'
-require 'buildr/core/build'
-require 'buildr/core/filter'
-require 'buildr/core/compile'
-require 'buildr/core/test'
-require 'buildr/core/shell'
-require 'buildr/core/run'
-require 'buildr/core/checks'
-require 'buildr/core/transports'
-require 'buildr/core/generate'
-require 'buildr/core/cc'
-require 'buildr/core/osx' if RUBY_PLATFORM =~ /darwin/
+
+# Let's see if we can use notify-send. Must be running from console in
verbose mode.
+if $stdout.isatty && verbose
+
+ 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
+
Added: buildr/trunk/lib/buildr/resources/completed.png
URL:
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/resources/completed.png?rev=1026877&view=auto
==============================================================================
Files buildr/trunk/lib/buildr/resources/completed.png (added) and
buildr/trunk/lib/buildr/resources/completed.png Sun Oct 24 20:01:48 2010 differ
Added: buildr/trunk/lib/buildr/resources/failed.png
URL:
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/resources/failed.png?rev=1026877&view=auto
==============================================================================
Files buildr/trunk/lib/buildr/resources/failed.png (added) and
buildr/trunk/lib/buildr/resources/failed.png Sun Oct 24 20:01:48 2010 differ
Added: buildr/trunk/lib/buildr/resources/icons-license.txt
URL:
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/resources/icons-license.txt?rev=1026877&view=auto
==============================================================================
--- buildr/trunk/lib/buildr/resources/icons-license.txt (added)
+++ buildr/trunk/lib/buildr/resources/icons-license.txt Sun Oct 24 20:01:48 2010
@@ -0,0 +1,17 @@
+
+MouseRunner.com Green/Red icons
+-------------------------------
+
+The graphics contained in the 'completed.png' and 'failed.png' files are
+licensed under the Creative Commons Attribution-ShareAlike 2.5 License
+
+Furthermore,
+You may not claim the works as your own.
+You must provide a link back to www.MouseRunner.com when using on a website,
+for commercial purposes, and for applications.
+
+Visit the address below to learn more about the Creative Commons license.
+http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode
+
+
+