carlosbrando-autotest-notification 1.7.3 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -1,59 +1,59 @@
1
- autotest-notification.gemspec
2
1
  History.txt
3
2
  License.txt
4
3
  Manifest.txt
5
4
  PostInstall.txt
6
5
  README.txt
7
6
  Rakefile
7
+ autotest-notification.gemspec
8
+ bin/an-install
9
+ bin/an-uninstall
10
+ bin/playsound
8
11
  config/hoe.rb
9
12
  config/requirements.rb
13
+ images/buuf/fail.png
14
+ images/buuf/pass.png
15
+ images/buuf/pending.png
16
+ images/doom/doom_0.png
17
+ images/doom/doom_1.png
18
+ images/doom/doom_2.png
19
+ images/doom/doom_3.png
20
+ images/doom/doom_4.png
21
+ images/doom/doom_5.png
22
+ images/doom/doom_6.png
23
+ images/fail.png
24
+ images/pass.png
25
+ images/pending.png
10
26
  lib/autotest_notification.rb
11
- lib/autotest_notification/version.rb
12
- lib/autotest_notification/linux.rb
13
- lib/autotest_notification/windows.rb
27
+ lib/autotest_notification/buuf.rb
14
28
  lib/autotest_notification/cygwin.rb
15
- lib/autotest_notification/mac.rb
16
29
  lib/autotest_notification/doom.rb
17
- lib/autotest_notification/buuf.rb
30
+ lib/autotest_notification/linux.rb
31
+ lib/autotest_notification/mac.rb
32
+ lib/autotest_notification/version.rb
33
+ lib/autotest_notification/windows.rb
18
34
  script/console
19
35
  script/destroy
20
36
  script/generate
21
37
  script/txt2html
22
38
  setup.rb
39
+ sounds/doom/0.wav
40
+ sounds/doom/1.wav
41
+ sounds/doom/2.wav
42
+ sounds/doom/3.wav
43
+ sounds/doom/4.wav
44
+ sounds/doom/5.wav
45
+ sounds/doom/6.wav
23
46
  tasks/deployment.rake
24
47
  tasks/environment.rake
25
48
  tasks/website.rake
26
- test/test_autotest_notification.rb
27
- test/test_helper.rb
28
49
  test/autotest_notification/test_cygwin.rb
29
50
  test/autotest_notification/test_linux.rb
30
- test/autotest_notification/test_windows.rb
31
51
  test/autotest_notification/test_mac.rb
52
+ test/autotest_notification/test_windows.rb
53
+ test/test_autotest_notification.rb
54
+ test/test_helper.rb
32
55
  website/index.html
33
56
  website/index.txt
34
57
  website/javascripts/rounded_corners_lite.inc.js
35
58
  website/stylesheets/screen.css
36
59
  website/template.html.erb
37
- bin/an-install
38
- bin/an-uninstall
39
- bin/playsound
40
- images/pass.png
41
- images/fail.png
42
- images/pending.png
43
- images/buuf/fail.png
44
- images/buuf/pass.png
45
- images/buuf/pending.png
46
- images/doom/doom_0.png
47
- images/doom/doom_1.png
48
- images/doom/doom_2.png
49
- images/doom/doom_3.png
50
- images/doom/doom_4.png
51
- images/doom/doom_5.png
52
- images/doom/doom_6.png
53
- sounds/doom/0.wav
54
- sounds/doom/1.wav
55
- sounds/doom/2.wav
56
- sounds/doom/3.wav
57
- sounds/doom/4.wav
58
- sounds/doom/5.wav
59
- sounds/doom/6.wav
@@ -2,16 +2,16 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{autotest-notification}
5
- s.version = "1.7.3"
5
+ s.version = "1.8.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Carlos Brando", "Rodrigo Urubatan", "Alexandre da Silva", "Carlos J\303\272nior", "Davis Zanetti Cabral", "Marcos Tapaj\303\263s", "Thiago Pradi", "Oz\303\251ias Sant'ana", "Samuel Flores", "Diego Carrion"]
9
- s.date = %q{2008-11-14}
9
+ s.date = %q{2009-01-26}
10
10
  s.description = %q{This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.}
11
11
  s.email = ["autotest-notification@carlosbrando.com"]
12
12
  s.executables = ["an-install", "an-uninstall", "playsound"]
13
13
  s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "website/index.txt"]
14
- s.files = ["autotest-notification.gemspec", "History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "Rakefile", "config/hoe.rb", "config/requirements.rb", "lib/autotest_notification.rb", "lib/autotest_notification/version.rb", "lib/autotest_notification/linux.rb", "lib/autotest_notification/windows.rb", "lib/autotest_notification/cygwin.rb", "lib/autotest_notification/mac.rb", "lib/autotest_notification/doom.rb", "lib/autotest_notification/buuf.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/website.rake", "test/test_autotest_notification.rb", "test/test_helper.rb", "test/autotest_notification/test_cygwin.rb", "test/autotest_notification/test_linux.rb", "test/autotest_notification/test_windows.rb", "test/autotest_notification/test_mac.rb", "website/index.html", "website/index.txt", "website/javascripts/rounded_corners_lite.inc.js", "website/stylesheets/screen.css", "website/template.html.erb", "bin/an-install", "bin/an-uninstall", "bin/playsound", "images/pass.png", "images/fail.png", "images/pending.png", "images/buuf/fail.png", "images/buuf/pass.png", "images/buuf/pending.png", "images/doom/doom_0.png", "images/doom/doom_1.png", "images/doom/doom_2.png", "images/doom/doom_3.png", "images/doom/doom_4.png", "images/doom/doom_5.png", "images/doom/doom_6.png", "sounds/doom/0.wav", "sounds/doom/1.wav", "sounds/doom/2.wav", "sounds/doom/3.wav", "sounds/doom/4.wav", "sounds/doom/5.wav", "sounds/doom/6.wav"]
14
+ s.files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "Rakefile", "autotest-notification.gemspec", "bin/an-install", "bin/an-uninstall", "bin/playsound", "config/hoe.rb", "config/requirements.rb", "images/buuf/fail.png", "images/buuf/pass.png", "images/buuf/pending.png", "images/doom/doom_0.png", "images/doom/doom_1.png", "images/doom/doom_2.png", "images/doom/doom_3.png", "images/doom/doom_4.png", "images/doom/doom_5.png", "images/doom/doom_6.png", "images/fail.png", "images/pass.png", "images/pending.png", "lib/autotest_notification.rb", "lib/autotest_notification/buuf.rb", "lib/autotest_notification/cygwin.rb", "lib/autotest_notification/doom.rb", "lib/autotest_notification/linux.rb", "lib/autotest_notification/mac.rb", "lib/autotest_notification/version.rb", "lib/autotest_notification/windows.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "sounds/doom/0.wav", "sounds/doom/1.wav", "sounds/doom/2.wav", "sounds/doom/3.wav", "sounds/doom/4.wav", "sounds/doom/5.wav", "sounds/doom/6.wav", "tasks/deployment.rake", "tasks/environment.rake", "tasks/website.rake", "test/autotest_notification/test_cygwin.rb", "test/autotest_notification/test_linux.rb", "test/autotest_notification/test_mac.rb", "test/autotest_notification/test_windows.rb", "test/test_autotest_notification.rb", "test/test_helper.rb", "website/index.html", "website/index.txt", "website/javascripts/rounded_corners_lite.inc.js", "website/stylesheets/screen.css", "website/template.html.erb"]
15
15
  s.has_rdoc = true
16
16
  s.homepage = %q{http://github.com/carlosbrando/autotest-notification/}
17
17
  s.post_install_message = %q{
@@ -27,7 +27,7 @@ To turn off:
27
27
  s.rdoc_options = ["--main", "README.txt"]
28
28
  s.require_paths = ["lib"]
29
29
  s.rubyforge_project = %q{autotest-notification}
30
- s.rubygems_version = %q{1.3.0}
30
+ s.rubygems_version = %q{1.3.1}
31
31
  s.summary = %q{This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.}
32
32
  s.test_files = ["test/autotest_notification/test_cygwin.rb", "test/autotest_notification/test_linux.rb", "test/autotest_notification/test_mac.rb", "test/autotest_notification/test_windows.rb", "test/test_autotest_notification.rb", "test/test_helper.rb"]
33
33
 
data/bin/an-install CHANGED
@@ -11,6 +11,7 @@ end
11
11
 
12
12
  require 'optparse'
13
13
  require 'ftools'
14
+ require 'fileutils'
14
15
 
15
16
  # NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
16
17
 
@@ -20,7 +21,11 @@ OPTIONS = {
20
21
  :doom => false,
21
22
  :sticky => false,
22
23
  :pending => false,
23
- :buuf => false
24
+ :buuf => false,
25
+ :sound => {
26
+ :success => nil,
27
+ :failure => nil
28
+ }
24
29
  }
25
30
  MANDATORY_OPTIONS = %w( )
26
31
 
@@ -57,6 +62,14 @@ BANNER
57
62
  opts.on("--sticky",
58
63
  "Keep notification on screen in case of errros/failures or pending specs.",
59
64
  "Only for Mac.") { |OPTIONS[:sticky]| OPTIONS[:sticky] = true }
65
+
66
+ opts.on("--success-sound=PATH", String,
67
+ "Sound to play on success.",
68
+ "Only for Mac") { |OPTIONS[:sound][:success]| }
69
+
70
+ opts.on("--failure-sound=PATH", String,
71
+ "Sound to play on success.",
72
+ "Only for Mac") { |OPTIONS[:sound][:failure]| }
60
73
 
61
74
  opts.on("-h", "--help",
62
75
  "Show this help message.") { puts opts; exit }
@@ -85,6 +98,8 @@ f.write("DOOM_EDITION = #{OPTIONS[:doom]}\n")
85
98
  f.write("BUUF = #{OPTIONS[:buuf]}\n")
86
99
  f.write("PENDING = #{OPTIONS[:pending]}\n")
87
100
  f.write("STICKY = #{OPTIONS[:sticky]}\n")
101
+ f.write("SUCCESS_SOUND = '#{OPTIONS[:sound][:success]}'\n")
102
+ f.write("FAILURE_SOUND = '#{OPTIONS[:sound][:failure]}'\n")
88
103
  f.close
89
104
 
90
105
  puts "\nAs from now all tests will be notified automatically."
@@ -6,11 +6,12 @@ module AutotestNotification
6
6
 
7
7
  def notify(title, msg, img, total = 1, failures = 0, priority = 0)
8
8
  system "growlnotify -n autotest --image #{img} #{'-s ' if ((failures > 0) and STICKY)}-p #{priority} -m '#{msg}' -t #{title}"
9
+ play(SUCCESS_SOUND) unless SUCCESS_SOUND.empty? or failures > 0
10
+ play(FAILURE_SOUND) unless FAILURE_SOUND.empty? or failures == 0
9
11
  say(total, failures) if SPEAKING
10
12
  end
11
13
 
12
14
  def say(total, failures)
13
-
14
15
  if failures > 0
15
16
  DOOM_EDITION ? Doom.play_sound(total, failures) : system("say #{failures} test#{'s' unless failures == 1} failed.")
16
17
  @last_test_failed = true
@@ -20,6 +21,10 @@ module AutotestNotification
20
21
  end
21
22
  end
22
23
 
24
+ def play(sound_file)
25
+ `#{File.expand_path(File.dirname(__FILE__) + "/../../bin/")}/playsound #{sound_file}`
26
+ end
27
+
23
28
  end
24
29
  end
25
30
  end
@@ -1,8 +1,8 @@
1
1
  module AutotestNotification #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
- MINOR = 7
5
- TINY = 3
4
+ MINOR = 8
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -7,6 +7,9 @@ class TestMac < Test::Unit::TestCase
7
7
  AutotestNotification.const_set :SPEAKING, false
8
8
  AutotestNotification.const_set :STICKY, false
9
9
  AutotestNotification.const_set :BUUF, false
10
+ AutotestNotification.const_set :SUCCESS_SOUND, ''
11
+ AutotestNotification.const_set :FAILURE_SOUND, ''
12
+ AutotestNotification::Mac.stubs(:system)
10
13
  end
11
14
 
12
15
  def test_notify_without_voice
@@ -34,9 +37,42 @@ class TestMac < Test::Unit::TestCase
34
37
  AutotestNotification::Mac.notify("title", "msg", "image", 1, 1)
35
38
  end
36
39
 
40
+ def test_success_sound_is_played_when_specified_and_test_success
41
+ AutotestNotification.const_set :SUCCESS_SOUND, sound_path
42
+ AutotestNotification::Mac.expects(:play).with(sound_path)
43
+ AutotestNotification::Mac.notify("title", "msg", "image", 1, 0)
44
+ end
45
+
46
+ def test_failure_sound_is_played_when_specified_and_tests_fail
47
+ AutotestNotification.const_set :FAILURE_SOUND, sound_path
48
+ AutotestNotification::Mac.expects(:play).with(sound_path)
49
+ AutotestNotification::Mac.notify("title", "msg", "image", 1, 1)
50
+ end
51
+
52
+ def test_failure_sound_is_not_played_when_tests_success
53
+ AutotestNotification.const_set :FAILURE_SOUND, sound_path
54
+ AutotestNotification::Mac.expects(:play).with(sound_path).times(0)
55
+ AutotestNotification::Mac.notify("title", "msg", "image", 1, 0)
56
+ end
57
+
58
+ def test_success_sound_is_not_played_when_tests_fail
59
+ AutotestNotification.const_set :SUCCESS_SOUND, sound_path
60
+ AutotestNotification::Mac.expects(:play).with(sound_path).times(0)
61
+ AutotestNotification::Mac.notify("title", "msg", "image", 1, 1)
62
+ end
63
+
64
+ def test_play_method_exists
65
+ # this should be testing if playsound is being called
66
+ assert_respond_to AutotestNotification::Mac, :play
67
+ end
68
+
37
69
  def test_notify_with_buuf
38
70
  AutotestNotification.const_set :BUUF, true
39
71
  AutotestNotification::Mac.expects(:system).with("growlnotify -n autotest --image image -p 0 -m 'msg' -t title")
40
72
  AutotestNotification::Mac.notify("title", "msg", "image", 1, 1)
41
73
  end
74
+ end
75
+
76
+ def sound_path
77
+ "#{File.expand_path(File.dirname(__FILE__) + "/../../sounds/doom/")}/1.wav"
42
78
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carlosbrando-autotest-notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Brando
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2008-11-14 00:00:00 -08:00
21
+ date: 2009-01-26 00:00:00 -08:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -56,65 +56,65 @@ extra_rdoc_files:
56
56
  - README.txt
57
57
  - website/index.txt
58
58
  files:
59
- - autotest-notification.gemspec
60
59
  - History.txt
61
60
  - License.txt
62
61
  - Manifest.txt
63
62
  - PostInstall.txt
64
63
  - README.txt
65
64
  - Rakefile
65
+ - autotest-notification.gemspec
66
+ - bin/an-install
67
+ - bin/an-uninstall
68
+ - bin/playsound
66
69
  - config/hoe.rb
67
70
  - config/requirements.rb
71
+ - images/buuf/fail.png
72
+ - images/buuf/pass.png
73
+ - images/buuf/pending.png
74
+ - images/doom/doom_0.png
75
+ - images/doom/doom_1.png
76
+ - images/doom/doom_2.png
77
+ - images/doom/doom_3.png
78
+ - images/doom/doom_4.png
79
+ - images/doom/doom_5.png
80
+ - images/doom/doom_6.png
81
+ - images/fail.png
82
+ - images/pass.png
83
+ - images/pending.png
68
84
  - lib/autotest_notification.rb
69
- - lib/autotest_notification/version.rb
70
- - lib/autotest_notification/linux.rb
71
- - lib/autotest_notification/windows.rb
85
+ - lib/autotest_notification/buuf.rb
72
86
  - lib/autotest_notification/cygwin.rb
73
- - lib/autotest_notification/mac.rb
74
87
  - lib/autotest_notification/doom.rb
75
- - lib/autotest_notification/buuf.rb
88
+ - lib/autotest_notification/linux.rb
89
+ - lib/autotest_notification/mac.rb
90
+ - lib/autotest_notification/version.rb
91
+ - lib/autotest_notification/windows.rb
76
92
  - script/console
77
93
  - script/destroy
78
94
  - script/generate
79
95
  - script/txt2html
80
96
  - setup.rb
97
+ - sounds/doom/0.wav
98
+ - sounds/doom/1.wav
99
+ - sounds/doom/2.wav
100
+ - sounds/doom/3.wav
101
+ - sounds/doom/4.wav
102
+ - sounds/doom/5.wav
103
+ - sounds/doom/6.wav
81
104
  - tasks/deployment.rake
82
105
  - tasks/environment.rake
83
106
  - tasks/website.rake
84
- - test/test_autotest_notification.rb
85
- - test/test_helper.rb
86
107
  - test/autotest_notification/test_cygwin.rb
87
108
  - test/autotest_notification/test_linux.rb
88
- - test/autotest_notification/test_windows.rb
89
109
  - test/autotest_notification/test_mac.rb
110
+ - test/autotest_notification/test_windows.rb
111
+ - test/test_autotest_notification.rb
112
+ - test/test_helper.rb
90
113
  - website/index.html
91
114
  - website/index.txt
92
115
  - website/javascripts/rounded_corners_lite.inc.js
93
116
  - website/stylesheets/screen.css
94
117
  - website/template.html.erb
95
- - bin/an-install
96
- - bin/an-uninstall
97
- - bin/playsound
98
- - images/pass.png
99
- - images/fail.png
100
- - images/pending.png
101
- - images/buuf/fail.png
102
- - images/buuf/pass.png
103
- - images/buuf/pending.png
104
- - images/doom/doom_0.png
105
- - images/doom/doom_1.png
106
- - images/doom/doom_2.png
107
- - images/doom/doom_3.png
108
- - images/doom/doom_4.png
109
- - images/doom/doom_5.png
110
- - images/doom/doom_6.png
111
- - sounds/doom/0.wav
112
- - sounds/doom/1.wav
113
- - sounds/doom/2.wav
114
- - sounds/doom/3.wav
115
- - sounds/doom/4.wav
116
- - sounds/doom/5.wav
117
- - sounds/doom/6.wav
118
118
  has_rdoc: true
119
119
  homepage: http://github.com/carlosbrando/autotest-notification/
120
120
  post_install_message: |+