riot_notifier 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -9,8 +9,13 @@ Notifies you about passes, errors, failures via $HOME/bin/notify_redgreen
9
9
  require 'riot'
10
10
  require 'riot_notifier'
11
11
 
12
+ # Using notify-send (see below for wrapper script)
12
13
  Riot.reporter = RiotNotifier::RedgreenNotifier
13
14
 
15
+ # Using libnotify gem (ruby bindings using ffi)
16
+ # gem install libnotify
17
+ Riot.reporter = RiotNotifier::Libnotify
18
+
14
19
  == notify_redgreen
15
20
 
16
21
  Your $HOME/bin/notify_redgreen
@@ -41,3 +46,5 @@ Notifies you about passes, errors, failures via $HOME/bin/notify_redgreen
41
46
  == TODO
42
47
  * talk to DBUS directly (ruby-dbus?) instead of `notify-send` binary
43
48
  * riot's assertions support blocks! (like asserts_topic.equals { topic }). Use it!
49
+ * Test Libnotify somehow
50
+ * Autodetect notify class
data/Rakefile CHANGED
@@ -16,7 +16,8 @@ Jeweler::Tasks.new do |gem|
16
16
  gem.has_rdoc = true
17
17
  gem.extra_rdoc_files = [ "README.rdoc" ]
18
18
 
19
- gem.add_development_dependency "riot", "= 0.10.1"
19
+ gem.add_development_dependency "riot", "= 0.10.4"
20
+ gem.add_development_dependency "libnotify"
20
21
 
21
22
  gem.test_files = Dir.glob('test/test_*.rb')
22
23
  end
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
- ---
2
- :minor: 0
3
- :build:
4
- :patch: 2
1
+ ---
5
2
  :major: 0
3
+ :minor: 0
4
+ :patch: 3
5
+ :build:
data/lib/riot_notifier.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'riot'
2
-
3
1
  module RiotNotifier
4
2
  class Base < Riot::DotMatrixReporter
5
3
  def notify(color, msg)
@@ -8,13 +6,13 @@ module RiotNotifier
8
6
 
9
7
  def fail(desc, message)
10
8
  super
11
- say "#{desc}: #{message}".yellow
9
+ say yellow("#{desc}: #{message}")
12
10
  notify(:red, "FAILURE: #{message}")
13
11
  end
14
12
 
15
13
  def error(desc, error)
16
14
  super
17
- say "#{desc}: #{error}".red
15
+ say red("#{desc}: #{error}")
18
16
  notify(:red, "ERROR: #{error}")
19
17
  end
20
18
 
@@ -32,6 +30,34 @@ module RiotNotifier
32
30
  end
33
31
  end
34
32
 
33
+ class Libnotify < Base
34
+ OPTIONS = {
35
+ :green => {
36
+ :icon_path => "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg",
37
+ :timeout => 2.5,
38
+ :urgency => :normal,
39
+ :summary => ":-)"
40
+ },
41
+ :red => {
42
+ :icon_path => "/usr/share/icons/gnome/scalable/emotes/face-angry.svg",
43
+ :timeout => 2.5,
44
+ :urgency => :critical,
45
+ :summary => ":-("
46
+ }
47
+ }
48
+
49
+ def initialize
50
+ require 'libnotify'
51
+ super()
52
+ end
53
+
54
+ def notify(color, msg)
55
+ options = OPTIONS[color] or raise "unknown color #{color}"
56
+
57
+ ::Libnotify.show(options.merge(:body => msg))
58
+ end
59
+ end
60
+
35
61
  class RedgreenNotifier < Base
36
62
  attr_reader :path
37
63
  PATH = ENV['HOME'] + "/bin/notify_redgreen"
data/test/helper.rb CHANGED
@@ -2,4 +2,4 @@ require 'riot'
2
2
 
3
3
  require 'riot_notifier'
4
4
 
5
- Riot.reporter = RiotNotifier::RedgreenNotifier
5
+ Riot.reporter = RiotNotifier::Libnotify
@@ -1,3 +1,5 @@
1
+ require 'rubygems'
2
+
1
3
  require 'helper'
2
4
  require 'stringio'
3
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riot_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Suschlik
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-07 00:00:00 +01:00
12
+ date: 2009-12-06 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,17 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.10.1
23
+ version: 0.10.4
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: libnotify
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
24
34
  version:
25
35
  description:
26
36
  email: peter-riot_notifier@suschlik.de