Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f8ace79
Showing
6 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.gem | ||
.bundle | ||
Gemfile.lock | ||
pkg/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "http://rubygems.org" | ||
|
||
# Specify your gem's dependencies in minitest-libnotify.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require "bundler/gem_tasks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |