Sha256: f6186bc3a72a3c6152630e1948e555c4d3614161bdea447c04db0f9e56c15a52

Contents?: true

Size: 891 Bytes

Versions: 22

Compression:

Stored size: 891 Bytes

Contents

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 = [ RUBY_ENGINE, 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)

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
libnotify-0.5.6.pre3-universal-rubinius-1.2 test/libnotify_io.rb
libnotify-0.5.6.pre3 test/libnotify_io.rb
libnotify-0.5.6.pre2-universal-rubinius-1.2 test/libnotify_io.rb
libnotify-0.5.6.pre2 test/libnotify_io.rb
libnotify-0.5.6.pre1-universal-rubinius-1.2 test/libnotify_io.rb
libnotify-0.5.6.pre1 test/libnotify_io.rb
libnotify-0.5.6.pre test/libnotify_io.rb
libnotify-0.5.6.pre-universal-rubinius-1.2 test/libnotify_io.rb
libnotify-0.5.5-universal-rubinius-1.2 test/libnotify_io.rb
libnotify-0.5.5 test/libnotify_io.rb
libnotify-0.5.4-universal-rubinius-1.2 test/libnotify_io.rb
libnotify-0.5.4-java test/libnotify_io.rb
libnotify-0.5.4 test/libnotify_io.rb
libnotify-0.5.3-universal-rubinius-1.2 test/libnotify_io.rb
libnotify-0.5.3-universal-java-1.6 test/libnotify_io.rb
libnotify-0.5.3-x86-linux test/libnotify_io.rb
libnotify-0.5.2-universal-rubinius-1.2 test/libnotify_io.rb
libnotify-0.5.2-universal-java-1.6 test/libnotify_io.rb
libnotify-0.5.2-x86-linux test/libnotify_io.rb
libnotify-0.5.1-x86-linux test/libnotify_io.rb