Skip to content

Commit

Permalink
Initial commit. It works. No tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
splattael committed Dec 4, 2011
0 parents commit f8ace79
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*.gem
.bundle
Gemfile.lock
pkg/*
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
source "http://rubygems.org"

# Specify your gem's dependencies in minitest-libnotify.gemspec
gemspec
26 changes: 26 additions & 0 deletions README.rdoc
@@ -0,0 +1,26 @@
= minitest-libnotify

Test notifier for minitest via libnotify.

Source[http://github.com/splattael/minitest-libnotify] |

== Usage

require 'minitest/autorun'
require 'minitest/libnotify'

== Installation

gem install minitest-libnotify

== Authors

* Peter Suschlik (http://github.com/splattael)

== License

MIT License[http://www.opensource.org/licenses/mit-license.php]

== TODO

* Write tests
1 change: 1 addition & 0 deletions Rakefile
@@ -0,0 +1 @@
require "bundler/gem_tasks"
41 changes: 41 additions & 0 deletions lib/minitest/libnotify.rb
@@ -0,0 +1,41 @@
require 'minitest/unit'
require 'libnotify'

module MiniTest
class Libnotify
VERSION = "0.0.1"

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, &block)
@io.send(msg, *args, &block)
end
end
end

MiniTest::Unit.output = MiniTest::Libnotify.new(MiniTest::Unit.output)
23 changes: 23 additions & 0 deletions minitest-libnotify.gemspec
@@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "minitest/libnotify"

Gem::Specification.new do |s|
s.name = "minitest-libnotify"
s.version = MiniTest::Libnotify::VERSION
s.authors = ["Peter Suschlik"]
s.email = ["peter-minitest-libnotify@suschlik.de"]
s.homepage = "https://github.com/splattael/minitest-libnotify"
s.summary = %q{Test notifier for minitest via libnotify.}
s.description = %q{Display graphical notfications when testing with minitest.}

s.rubyforge_project = "minitest-libnotify"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_runtime_dependency 'minitest'
s.add_runtime_dependency 'libnotify'
end

0 comments on commit f8ace79

Please sign in to comment.