minitest5-libnotify 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ebf90490e56fc97cc338a1498f7573ca8f112928
4
+ data.tar.gz: 5b40a91382b47812841f5272a65d67f37e82a328
5
+ SHA512:
6
+ metadata.gz: 46fe199354eea1fb7ce39d4e287e060324dafd45a7c7120293b0d54f638de75a9dd5c6c4fca674cb177b87a15c935ed77f4b5531310f3b22e54e78cc2018722f
7
+ data.tar.gz: b185bc0879fd88d796851b96a7e4f61a4761e06d8463b0b292151a4cb76b361de1719474127edc52b28e8e2e3f654ea3087e2305a6b5c66d7c56cd5ee893548e
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ doc/
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm @minitest-libnotify --create
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in minitest-libnotify.gemspec
4
+ gemspec
data/README.rdoc ADDED
@@ -0,0 +1,28 @@
1
+ = minitest-libnotify
2
+
3
+ Test notifier for minitest[https://github.com/seattlerb/minitest] via libnotify[https://github.com/splattael/libnotify].
4
+
5
+ Source[http://github.com/splattael/minitest-libnotify] |
6
+ RDoc[http://rdoc.info/github/splattael/minitest-libnotify/master/file/README.rdoc]
7
+
8
+ == Usage
9
+
10
+ Just install the gem or add it to the Gemfile, minitest handles this plugin automatically.
11
+
12
+ == Installation
13
+
14
+ gem install minitest-libnotify
15
+
16
+ == Authors
17
+
18
+ * Peter Suschlik (http://github.com/splattael)
19
+ * Benny Klotz (http://github.com/benny1992)
20
+
21
+ == License
22
+
23
+ MIT License[http://www.opensource.org/licenses/mit-license.php]
24
+
25
+ == TODO
26
+
27
+ * Write tests
28
+ * Minitest5 Plugin - write public config interface
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rdoc/task'
4
+
5
+ task :default => :test
6
+
7
+ desc "No tests, sorry :-("
8
+ task :test do
9
+ abort "No tests, sorry :-("
10
+ end
11
+
12
+ Rake::RDocTask.new do |rd|
13
+ rd.main = "README.rdoc"
14
+ rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
15
+ rd.rdoc_dir = "doc"
16
+ end
@@ -0,0 +1,66 @@
1
+ require 'libnotify'
2
+
3
+ module Minitest
4
+ module Libnotify
5
+ class Notifier
6
+ DEFAULT_OPTIONS = {
7
+ :global => {
8
+ :timeout => 2.5,
9
+ :append => false,
10
+ :description => proc { [ defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby", RUBY_VERSION ].join(" ") },
11
+ },
12
+
13
+ :pass => {
14
+ :description => proc { |description| "Tests PASSED #{description}" },
15
+ :urgency => :critical,
16
+ :icon_path => "face-laugh.*"
17
+ },
18
+
19
+ :fail => {
20
+ :description => proc { |description| "Tests FAILED #{description}" },
21
+ :urgency => :critical,
22
+ :icon_path => "face-angry.*"
23
+ }
24
+ }
25
+
26
+ def initialize
27
+ # TODO: Write a public interface where the options can be modified (custom icon_path, description etc)
28
+ @options = DEFAULT_OPTIONS
29
+ end
30
+
31
+ def notify(stats, state)
32
+ body = "#{stats[:assertions]} assertions, "
33
+ body << "#{stats[:failures]} failures, "
34
+ body << "#{stats[:errors]} errors, "
35
+ body << "#{stats[:skips]} skips"
36
+
37
+ default_description = config_for(:description)
38
+ libnotify.body = config_for(:body, state, body)
39
+ libnotify.summary = config_for(:description, state, default_description)
40
+ libnotify.urgency = config_for(:urgency, state)
41
+ libnotify.icon_path = config_for(:icon_path, state)
42
+ libnotify.show!
43
+ end
44
+
45
+ private
46
+
47
+ def libnotify # :nodoc:
48
+ if @libnotify.nil?
49
+ @libnotify = ::Libnotify.new(:timeout => config_for(:timeout), :append => config_for(:append))
50
+ end
51
+
52
+ @libnotify
53
+ end
54
+
55
+ def config_for(name, state=:global, default=nil) # :nodoc:
56
+ value = @options[state][name] || @options[:global][name]
57
+ if value.respond_to?(:call)
58
+ value.call(default)
59
+ else
60
+ value.nil? ? default : value
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+
@@ -0,0 +1,34 @@
1
+ require 'minitest/libnotify/notifier'
2
+
3
+ module Minitest
4
+ module Libnotify
5
+ class Reporter < StatisticsReporter
6
+ def initialize
7
+ super
8
+
9
+ @notifier = Notifier.new
10
+ end
11
+
12
+ def report
13
+ super
14
+
15
+ notify
16
+ end
17
+
18
+ private
19
+
20
+ def notify # :nodoc:
21
+ stats = {
22
+ :assertions => assertions,
23
+ :failures => failures,
24
+ :errors => errors,
25
+ :skips => skips
26
+ }
27
+
28
+ state = passed? ? :pass : :fail
29
+
30
+ @notifier.notify(stats, state)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,5 @@
1
+ module MiniTest
2
+ class Libnotify
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require 'minitest/libnotify/reporter'
2
+
3
+ module Minitest
4
+ def self.plugin_libnotify_init(options) # :nodoc:
5
+ self.reporter << Libnotify::Reporter.new
6
+ end
7
+ end
8
+
9
+
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "minitest/libnotify/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "minitest5-libnotify"
7
+
8
+ s.version = MiniTest::Libnotify::VERSION
9
+
10
+ s.authors = ["Peter Suschlik", "Benny Klotz"]
11
+ s.email = ["peter-minitest-libnotify@suschlik.de", "r3qnbenni@gmail.com"]
12
+ s.homepage = "https://github.com/splattael/minitest-libnotify"
13
+
14
+ s.summary = %q{Test notifier for minitest5 via libnotify.}
15
+ s.description = %q{Display graphical notfications when testing with minitest.}
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_runtime_dependency 'minitest'
23
+ s.add_runtime_dependency 'libnotify'
24
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest5-libnotify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Peter Suschlik
8
+ - Benny Klotz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-05-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: minitest
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: libnotify
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ description: Display graphical notfications when testing with minitest.
43
+ email:
44
+ - peter-minitest-libnotify@suschlik.de
45
+ - r3qnbenni@gmail.com
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".gitignore"
51
+ - ".rvmrc"
52
+ - Gemfile
53
+ - README.rdoc
54
+ - Rakefile
55
+ - lib/minitest/libnotify/notifier.rb
56
+ - lib/minitest/libnotify/reporter.rb
57
+ - lib/minitest/libnotify/version.rb
58
+ - lib/minitest/libnotify_plugin.rb
59
+ - minitest-libnotify.gemspec
60
+ homepage: https://github.com/splattael/minitest-libnotify
61
+ licenses: []
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.2.2
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Test notifier for minitest5 via libnotify.
83
+ test_files: []
84
+ has_rdoc: