README.rdoc in riot_notifier-0.0.6 vs README.rdoc in riot_notifier-0.0.7
- old
+ new
@@ -1,50 +1,59 @@
= Notifier for testing framework riot.
-Notifies you about passes, errors, failures via $HOME/bin/notify_redgreen
+Notifies you about passes, errors, failures via custom notify libraries
+like libnotify.
== Usage
# in your test/helper.rb
require 'riot'
require 'riot_notifier'
- # Using notify-send (see below for wrapper script)
- Riot.reporter = RiotNotifier::RedgreenNotifier
+ # Auto-detect in load order
+ Riot.reporter = RiotNotifier
- # Using libnotify gem (ruby bindings using ffi)
- # gem install libnotify
- Riot.reporter = RiotNotifier::Libnotify
+=== Advanced usage
-== notify_redgreen
+ require 'riot'
+ require 'riot_notifier'
- Your $HOME/bin/notify_redgreen
+ # Auto-detect in specified order notifier defined in RiotNotifier
+ Riot.reporter = RiotNotifier.try(:Libnotify, :RedgreenBinary)
+ Riot.reporter = RiotNotifier[:Libnotify, :RedgreenBinary] # sugar
- #!/bin/sh
+ # Use specific notifier class (libnotify)
+ Riot.reporter = RiotNotifier::Libnotify
- case "$1" in
- red)
- OPTIONS="-t 2500 -u critical -i /usr/share/icons/gnome/scalable/emotes/face-angry.svg :-("
- ;;
- green)
- OPTIONS="-t 2000 -u normal -i /usr/share/icons/gnome/scalable/emblems/emblem-default.svg :-)"
- ;;
- esac
- shift
+ # Use my own notifier
+ class MyOwn < ::RiotNotifier::Base
+ # override .notify and #usable?
+ end
- notify-send $OPTIONS "$*"
+ Riot.reporter = RiotNotifier[MyOwn] # try only this
+ Riot.reporter = RiotNotifier # try MyOwn first (auto-detection)
-== Install via gemcutter
+ # Use my own inline
+ Riot.reporter = Class.new(RiotNotifier::Base) do
+ def notify(color, msg)
+ MyFancyNotifierGem.notify(:color => color, :message => msg)
+ end
- gem install gemcutter
- gem tumble
+ def self.usable?
+ require 'my_fancy_notifier_gem'
+ true
+ rescue LoadError
+ false
+ end
+ end
+
+== Installation
+
gem install riot_notifier
== Authors
* Peter Suschlik
== TODO
-* talk to DBUS directly (ruby-dbus?) instead of `notify-send` binary
* riot's assertions support blocks! (like asserts_topic.equals { topic }). Use it!
-* Test Libnotify somehow
-* Autodetect notify class
+* Test auto-detection and Libnotify