Permalink
Browse files

Extract LibnotifyIO into own gem minitest-libnotify.

  • Loading branch information...
1 parent db0301c commit 5fda61d0fc78590d22a8481140f57647c5af10ef @splattael committed Dec 4, 2011
Showing with 3 additions and 38 deletions.
  1. +2 −1 libnotify.gemspec
  2. +1 −1 test/helper.rb
  3. +0 −36 test/libnotify_io.rb
View
@@ -25,9 +25,10 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
if needs_ffi
- s.add_runtime_dependency 'ffi', '~> 1.0.0'
+ s.add_runtime_dependency 'ffi', '~> 1.0.0'
end
s.add_development_dependency 'minitest'
+ s.add_development_dependency 'minitest-libnotify'
s.add_development_dependency 'yard', '~> 0.7.0'
end
View
@@ -1,6 +1,6 @@
require 'rubygems'
require 'bundler/setup'
require 'minitest/autorun'
+require 'minitest/libnotify'
require 'libnotify'
-require 'libnotify_io'
View
@@ -1,36 +0,0 @@
-class LibnotifyIO
- attr_reader :io, :libnotify
-
- def initialize io
- @io = io
- @libnotify = begin
- require 'libnotify'
- Libnotify.new(:timeout => 2.5, :append => false)
- end
- end
-
- def puts *o
- if o.first =~ /(\d+) failures, (\d+) errors/
- description = [ defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby", RUBY_VERSION, RUBY_PLATFORM ].join(" ")
- libnotify.body = o.first
- if $1.to_i > 0 || $2.to_i > 0 # fail?
- libnotify.summary = ":-( #{description}"
- libnotify.urgency = :critical
- libnotify.icon_path = "face-angry.*"
- else
- libnotify.summary += ":-) #{description}"
- libnotify.urgency = :normal
- libnotify.icon_path = "face-laugh.*"
- end
- libnotify.show!
- else
- io.puts *o
- end
- end
-
- def method_missing msg, *args
- io.send(msg, *args)
- end
-end
-
-MiniTest::Unit.output = LibnotifyIO.new(MiniTest::Unit.output)

0 comments on commit 5fda61d

Please sign in to comment.