marcinbunsch-bolt 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +5 -1
- data/lib/bolt/notifier.rb +6 -0
- data/lib/bolt/notifiers/notify_osd.rb +61 -0
- metadata +2 -1
data/README.textile
CHANGED
|
@@ -16,7 +16,11 @@ It takes solutions from several gems:
|
|
|
16
16
|
* *autotest* - obviously. Whole concept, parts of generic listener
|
|
17
17
|
* *Roman2K-rails_test_serving* - concept of running tests with preloaded environment, elements of test::unit runner
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
h2. Contributors
|
|
20
|
+
|
|
21
|
+
* *cziko* - http://github.com/cziko - Growl Notifier network support (via ruby-growl)
|
|
22
|
+
|
|
23
|
+
h2. Copyright
|
|
20
24
|
|
|
21
25
|
* *autotest* - ZenTest
|
|
22
26
|
* *rails-test-serving* - Roman2K
|
data/lib/bolt/notifier.rb
CHANGED
|
@@ -23,6 +23,7 @@ module Bolt
|
|
|
23
23
|
if Bolt['notifier'] and ['generic', 'growl'].include?(Bolt['notifier'])
|
|
24
24
|
self.selected= Bolt::Notifiers::Growl.new if Bolt['notifier'] == 'growl'
|
|
25
25
|
self.selected= Bolt::Notifiers::Generic.new if Bolt['notifier'] == 'generic'
|
|
26
|
+
self.selected= Bolt::Notifiers::NotifyOsd.new if Bolt['notifier'] == 'notify_send'
|
|
26
27
|
$stdout.puts "** Found 'notifier' setting in .bolt"
|
|
27
28
|
return self.selected
|
|
28
29
|
end
|
|
@@ -35,6 +36,11 @@ module Bolt
|
|
|
35
36
|
self.selected= Bolt::Notifiers::Growl.new(:use_growlnotify => true)
|
|
36
37
|
end
|
|
37
38
|
|
|
39
|
+
output = %x[which notify-send]
|
|
40
|
+
if !Bolt['notifier'] and output.to_s.include?('/notify-send')
|
|
41
|
+
self.selected= Bolt::Notifiers::NotifyOsd.new
|
|
42
|
+
end
|
|
43
|
+
|
|
38
44
|
# default if else fails
|
|
39
45
|
if !selected
|
|
40
46
|
self.selected= Bolt::Notifiers::Generic.new
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Bolt::Notifiers::NotifyOsd
|
|
3
|
+
#
|
|
4
|
+
# The NotifyOsd Notifier uses Notify-OSD to report on test results
|
|
5
|
+
#
|
|
6
|
+
#
|
|
7
|
+
module Bolt
|
|
8
|
+
module Notifiers
|
|
9
|
+
class NotifyOsd
|
|
10
|
+
|
|
11
|
+
attr_accessor :host, :use_growlnotify
|
|
12
|
+
|
|
13
|
+
def initialize(pars = {})
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# generic notify method
|
|
17
|
+
def notify(title, msg, img, pri = 'normal')
|
|
18
|
+
system "notify-send -i #{img} -u #{urg} '#{title}' '#{msg}'"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# info message
|
|
22
|
+
def info(name, description)
|
|
23
|
+
image_path = File.dirname(__FILE__) + "/../../../images/pending.png"
|
|
24
|
+
notify name, description.to_s, image_path
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# message to be displayed when test file is missing
|
|
28
|
+
def test_file_missing(filename)
|
|
29
|
+
image_path = File.dirname(__FILE__) + "/../../../images/failed.png"
|
|
30
|
+
message = "The following test file could not be found: #{filename}"
|
|
31
|
+
notify "Could not find test file", message, image_path
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def result(filename, results)
|
|
35
|
+
message = results
|
|
36
|
+
if results.match('example') #rspec
|
|
37
|
+
if results.match('pending')
|
|
38
|
+
icon = 'pending'
|
|
39
|
+
elsif results.match('0 failures')
|
|
40
|
+
icon = 'success'
|
|
41
|
+
else
|
|
42
|
+
icon = 'failed'
|
|
43
|
+
end
|
|
44
|
+
elsif (results.match('0 failures, 0 errors')) # test::unit
|
|
45
|
+
icon = 'success'
|
|
46
|
+
else
|
|
47
|
+
icon = 'failed'
|
|
48
|
+
end
|
|
49
|
+
image_path = File.dirname(__FILE__) + "/../../../images/#{icon}.png"
|
|
50
|
+
notify "Test results for: #{filename}", message, image_path
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def error(name, description)
|
|
54
|
+
image_path = File.dirname(__FILE__) + "/../../../images/failed.png"
|
|
55
|
+
notify name, description.to_s, image_path
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: marcinbunsch-bolt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marcin Bunsch
|
|
@@ -42,6 +42,7 @@ files:
|
|
|
42
42
|
- lib/bolt/notifier.rb
|
|
43
43
|
- lib/bolt/notifiers/generic.rb
|
|
44
44
|
- lib/bolt/notifiers/growl.rb
|
|
45
|
+
- lib/bolt/notifiers/notify_osd.rb
|
|
45
46
|
- lib/bolt/runner.rb
|
|
46
47
|
- lib/bolt/runners/rspec.rb
|
|
47
48
|
- lib/bolt/runners/test_unit.rb
|