blackwinter-autotest-notification 1.8.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ 2.2.0
2
+ * Removed dependency of ZenTest and began using the autotest gem in its place.
3
+
4
+ 2.1.0
5
+ * Added support for cucumber (ernestonakamura)
6
+
1
7
  1.6.0 - Oct 08, 2008
2
8
  * Buuf Edition - display Buuf icons by Mattahan [http://mattahan.deviantart.com] (samflores)
3
9
  * Added --sticky flag to an-install to keep notifications on screen in case of errors/failures or pending specs (samflores)
data/README.txt CHANGED
@@ -10,11 +10,6 @@ This gem set the autotest (ZenTest) to send messages to software as Growl, LibNo
10
10
 
11
11
  == REQUIREMENTS:
12
12
 
13
- Independent of operating system you are using, you must install the ZenTest:
14
-
15
- $ gem install ZenTest
16
-
17
-
18
13
  * If you're using a Mac:
19
14
  You need to have Growl and growlnotify installed on your machine.
20
15
 
@@ -70,7 +65,7 @@ Independent of operating system you are using, you must install the ZenTest:
70
65
 
71
66
  == INSTALL:
72
67
 
73
- $ sudo gem install carlosbrando-autotest-notification --source=http://gems.github.com
68
+ $ sudo gem install autotest-notification
74
69
 
75
70
  Run it to let the notifier in automatic mode:
76
71
 
@@ -111,6 +106,7 @@ To turn off the notifier:
111
106
  * samflores [http://www.thoughtsoverflow.com]
112
107
  * dcrec1 [http://www.mouseoverstudio.com/blog]
113
108
  * nuxlli [http://www.nuxlli.com.br]
109
+ * ernestonakamura [http://github.com/ernestonakamura]
114
110
 
115
111
  == LICENSE:
116
112
 
@@ -1,18 +1,17 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = %q{autotest-notification}
5
- s.version = "1.8.0"
4
+ s.name = %q{blackwinter-autotest-notification}
5
+ s.version = "2.2.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
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{2009-01-27}
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.}
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", "Ernesto Nakamura"]
9
+ s.date = %q{2010-02-25}
10
+ s.description = %q{This gem set the autotest 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
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
- s.has_rdoc = true
16
15
  s.homepage = %q{http://github.com/carlosbrando/autotest-notification/}
17
16
  s.post_install_message = %q{
18
17
  For more information on autotest_notification, see http://github.com/carlosbrando/autotest-notification/
@@ -27,23 +26,23 @@ To turn off:
27
26
  s.rdoc_options = ["--main", "README.txt"]
28
27
  s.require_paths = ["lib"]
29
28
  s.rubyforge_project = %q{autotest-notification}
30
- s.rubygems_version = %q{1.3.1}
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
- s.test_files = ["test/autotest_notification/test_windows.rb", "test/autotest_notification/test_cygwin.rb", "test/autotest_notification/test_mac.rb", "test/autotest_notification/test_linux.rb", "test/test_helper.rb", "test/test_autotest_notification.rb"]
29
+ s.rubygems_version = %q{1.3.5}
30
+ s.summary = %q{This gem set the autotest to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.}
31
+ 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
32
 
34
33
  if s.respond_to? :specification_version then
35
34
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
36
- s.specification_version = 2
35
+ s.specification_version = 3
37
36
 
38
37
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
39
- s.add_runtime_dependency(%q<ZenTest>, [">= 3.9.2"])
40
- s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
38
+ s.add_runtime_dependency(%q<autotest>, [">= 4.2.9"])
39
+ s.add_development_dependency(%q<hoe>, [">= 2.3.3"])
41
40
  else
42
- s.add_dependency(%q<ZenTest>, [">= 3.9.2"])
43
- s.add_dependency(%q<hoe>, [">= 1.8.0"])
41
+ s.add_dependency(%q<autotest>, [">= 4.2.9"])
42
+ s.add_dependency(%q<hoe>, [">= 2.3.3"])
44
43
  end
45
44
  else
46
- s.add_dependency(%q<ZenTest>, [">= 3.9.2"])
47
- s.add_dependency(%q<hoe>, [">= 1.8.0"])
45
+ s.add_dependency(%q<autotest>, [">= 4.2.9"])
46
+ s.add_dependency(%q<hoe>, [">= 2.3.3"])
48
47
  end
49
48
  end
data/bin/an-install CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # coding: UTF-8
2
3
  #
3
4
  # Created on 2008-5-11.
4
5
  # Copyright (c) 2008. All rights reserved.
@@ -10,8 +11,6 @@ rescue LoadError
10
11
  end
11
12
 
12
13
  require 'optparse'
13
- require 'ftools'
14
- require 'fileutils'
15
14
 
16
15
  # NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
17
16
 
@@ -41,35 +40,35 @@ BANNER
41
40
 
42
41
  opts.on("-p", "--path=PATH", String,
43
42
  "The root path for selecting files",
44
- "Default: ~") { |OPTIONS[:path]| }
43
+ "Default: ~") { |path| OPTIONS[:path] = path}
45
44
 
46
45
  opts.on("-s", "--speaking",
47
46
  "If a test failed, the computer will speak.",
48
- "For all plataforms.") { |OPTIONS[:speaking]| OPTIONS[:speaking] = true }
47
+ "For all plataforms.") { |speaking| OPTIONS[:speaking] = true }
49
48
 
50
49
  opts.on("-d", "--doom",
51
50
  "Special Doom Edition.",
52
- "Only for Mac.") { |OPTIONS[:doom]| OPTIONS[:doom] = true }
51
+ "Only for Mac/Cygwin.") { |doom| OPTIONS[:doom] = true }
53
52
 
54
53
  opts.on("-b", "--buuf",
55
54
  "Special Buuf Images.",
56
- "For all platforms") { |OPTIONS[:buuf]| }
55
+ "For all platforms") { |buuf| OPTIONS[:buuf] = true }
57
56
 
58
57
  opts.on("--pending",
59
58
  "Shows a different image when there are no errors/failures",
60
- "but there are pending specs. Only for Mac.") { |OPTIONS[:pending]| OPTIONS[:pending] = true }
59
+ "but there are pending specs. Only for Mac.") { |pending| OPTIONS[:pending] = true }
61
60
 
62
61
  opts.on("--sticky",
63
62
  "Keep notification on screen in case of errros/failures or pending specs.",
64
- "Only for Mac.") { |OPTIONS[:sticky]| OPTIONS[:sticky] = true }
63
+ "Only for Mac.") { |sticky| OPTIONS[:sticky] = true }
65
64
 
66
65
  opts.on("--success-sound=PATH", String,
67
66
  "Sound to play on success.",
68
- "Only for Mac") { |OPTIONS[:sound][:success]| }
67
+ "Only for Mac/Cygwin.") { |success_sound| OPTIONS[:sound][:success] = success_sound }
69
68
 
70
69
  opts.on("--failure-sound=PATH", String,
71
70
  "Sound to play on success.",
72
- "Only for Mac") { |OPTIONS[:sound][:failure]| }
71
+ "Only for Mac/Cygwin.") { |failure_sound| OPTIONS[:sound][:failure] = failure_sound }
73
72
 
74
73
  opts.on("-h", "--help",
75
74
  "Show this help message.") { puts opts; exit }
@@ -103,4 +102,4 @@ f.write("FAILURE_SOUND = '#{OPTIONS[:sound][:failure]}'\n")
103
102
  f.close
104
103
 
105
104
  puts "\nAs from now all tests will be notified automatically."
106
- puts "" # a blank line
105
+ puts "" # a blank line
data/bin/an-uninstall CHANGED
@@ -10,7 +10,6 @@ rescue LoadError
10
10
  end
11
11
 
12
12
  require 'optparse'
13
- require 'ftools'
14
13
 
15
14
  # NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
16
15
 
@@ -30,7 +29,7 @@ BANNER
30
29
  opts.separator ""
31
30
  opts.on("-p", "--path=PATH", String,
32
31
  "The root path for selecting files",
33
- "Default: ~") { |OPTIONS[:path]| }
32
+ "Default: ~") { |path| OPTIONS[:path] = path}
34
33
  opts.on("-h", "--help",
35
34
  "Show this help message.") { puts opts; exit }
36
35
  opts.parse!(ARGV)
@@ -47,4 +46,4 @@ if File.exist?(autotest_file)
47
46
  File.delete(autotest_file)
48
47
  puts "\nYou no longer receive notifications of your tests."
49
48
  puts "" # a blank line
50
- end
49
+ end
data/config/hoe.rb CHANGED
@@ -1,16 +1,17 @@
1
+ # coding: UTF-8
2
+
1
3
  require 'autotest_notification/version'
2
4
 
3
- AUTHOR = "Carlos Brando, Rodrigo Urubatan, Alexandre da Silva, Carlos Júnior, Davis Zanetti Cabral, Marcos Tapajós, Thiago Pradi, Ozéias Sant'ana, Samuel Flores, Diego Carrion"
5
+ AUTHOR = "Carlos Brando, Rodrigo Urubatan, Alexandre da Silva, Carlos Júnior, Davis Zanetti Cabral, Marcos Tapajós, Thiago Pradi, Ozéias Sant'ana, Samuel Flores, Diego Carrion, Ernesto Nakamura"
4
6
  EMAIL = "autotest-notification@carlosbrando.com"
5
- DESCRIPTION = "This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results."
7
+ DESCRIPTION = "This gem set the autotest to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results."
6
8
  GEM_NAME = 'autotest-notification' # what ppl will type to install your gem
7
9
  RUBYFORGE_PROJECT = nil # 'autotestnotific' # The unix name for your project
8
10
  HOMEPATH = "http://github.com/carlosbrando/autotest-notification/"
9
11
  DOWNLOAD_PATH = "http://github.com/carlosbrando/autotest-notification/tarball/master"
10
12
 
11
13
  EXTRA_DEPENDENCIES = [
12
- ['ZenTest', '>= 3.9.2']
13
- # ['activesupport', '>= 1.3.1']
14
+ ['autotest', '>= 4.2.9']
14
15
  ] # An array of rubygem dependencies [name, version]
15
16
 
16
17
  @config_file = "~/.rubyforge/user-config.yml"
@@ -72,4 +73,4 @@ CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
72
73
  PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
73
74
  $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
74
75
  $hoe.rsync_args = '-av --delete --ignore-errors'
75
- $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
76
+ $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -2,12 +2,12 @@ require 'fileutils'
2
2
  include FileUtils
3
3
 
4
4
  require 'rubygems'
5
- %w[rake hoe newgem rubigen ZenTest].each do |req_gem|
5
+ %w[rake hoe newgem rubigen].each do |req_gem|
6
6
  begin
7
- require req_gem
7
+ require req_gem.downcase
8
8
  rescue LoadError
9
9
  puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
- puts "Installation: gem install #{req_gem} -y"
10
+ puts "Installation: gem install #{req_gem}"
11
11
  exit
12
12
  end
13
13
  end
@@ -1,13 +1,26 @@
1
1
  $:.unshift(File.dirname(__FILE__))
2
- %w{ linux mac windows cygwin doom buuf }.each { |x| require "autotest_notification/#{x}" }
3
2
 
4
3
  module AutotestNotification
5
- IMAGES_DIRECTORY = File.expand_path(File.dirname(__FILE__) + "/../images/")
6
- SUCCESS_IMAGE = "#{IMAGES_DIRECTORY}/pass.png";
7
- FAIL_IMAGE = "#{IMAGES_DIRECTORY}/fail.png";
8
- PENDING_IMAGE = "#{IMAGES_DIRECTORY}/pending.png"
4
+ class Config
5
+
6
+ class << self
7
+ attr_reader :images_directory
8
+ attr_accessor :success_image, :fail_image, :pending_image, :expiration_in_seconds
9
+
10
+ def images_directory=(path)
11
+ @images_directory = File.expand_path(path)
12
+
13
+ @success_image = "#{@images_directory}/pass.png"
14
+ @fail_image = "#{@images_directory}/fail.png"
15
+ @pending_image = "#{@images_directory}/pending.png"
16
+ end
17
+ end
18
+
19
+ self.images_directory = "#{File.dirname(__FILE__)}/../images/"
9
20
 
10
- EXPIRATION_IN_SECONDS = 3
21
+ self.expiration_in_seconds = 3
22
+
23
+ end
11
24
 
12
25
  Autotest.add_hook :ran_command do |at|
13
26
  result = at.results.is_a?(Array) ? at.results.last : at.results.split("\n").last
@@ -29,19 +42,49 @@ module AutotestNotification
29
42
  end
30
43
 
31
44
  if @failures > 0 || @errors > 0
32
- notify "FAIL", msg, FAIL_IMAGE, @tests + @examples, @failures + @errors, 2
45
+ notify "FAIL", msg, Config.fail_image, @tests + @examples, @failures + @errors, 2
33
46
  elsif PENDING && @pendings > 0
34
- notify "Pending", msg, PENDING_IMAGE, @tests + @examples, @failures + @errors, 1
47
+ notify "Pending", msg, Config.pending_image, @tests + @examples, @failures + @errors, 1
35
48
  else
36
- notify "Pass", msg, SUCCESS_IMAGE, @tests + @examples, 0, -2
49
+ notify "Pass", msg, Config.success_image, @tests + @examples, 0, -2
37
50
  end
38
51
 
39
52
  puts "\e[#{code}m#{'=' * 80}\e[0m\n\n"
40
53
  end
41
54
  end
42
55
 
56
+ Autotest.add_hook :ran_features do |at|
57
+ results = at.results.is_a?(Array) ? at.results : at.results.split("\n")
58
+ if results
59
+ # How many scenarios and steps have passed, are pending, have failed or are undefined?
60
+ for result in results
61
+ next unless result =~ /^\d+ (scenario|step)/
62
+ scenario_or_step = $1
63
+ %w( scenario step passed pending failed undefined ).each do |x|
64
+ instance_variable_set "@#{scenario_or_step}_#{x}", result[/(\d+) #{x}/, 1].to_i
65
+ end
66
+ end
67
+
68
+ count = @scenario_scenario + @step_step
69
+ failed = @scenario_failed + @step_failed
70
+ pending = @scenario_pending + @step_pending + @scenario_undefined + @step_undefined
71
+
72
+ code = (failed > 0) ? 31 : (pending > 0) ? 33 : 32
73
+ msg = feature_message(@scenario_scenario, @scenario_pending + @scenario_undefined, @scenario_failed, @step_step, @step_pending + @step_undefined, @step_failed)
74
+
75
+ if @scenario_failed + @step_failed > 0
76
+ notify "FAIL", msg, Config.fail_image, count, failed, 2
77
+ elsif PENDING && pending > 0
78
+ notify "Pending", msg, Config.pending_image, count, failed, 1
79
+ else
80
+ notify "Pass", msg, Config.success_image, count, 0, -2
81
+ end
82
+ puts "\e[#{code}m#{'=' * 80}\e[0m\n\n"
83
+ end
84
+ end
85
+
43
86
  class << self
44
- def notify(title, msg, img = SUCCESS_IMAGE, total = 1, failures = 0, priority = 0)
87
+ def notify(title, msg, img = Config.success_image, total = 1, failures = 0, priority = 0)
45
88
 
46
89
  img = Doom.image(total, failures) if DOOM_EDITION
47
90
  img = Buuf.image(title.downcase) if BUUF
@@ -52,7 +95,7 @@ module AutotestNotification
52
95
  when /darwin/
53
96
  Mac.notify(title, msg, img, total, failures, priority)
54
97
  when /cygwin/
55
- Cygwin.notify(title, msg, img)
98
+ Cygwin.notify(title, msg, img, total, failures)
56
99
  when /mswin/
57
100
  Windows.notify(title, msg, img)
58
101
  end
@@ -69,5 +112,17 @@ module AutotestNotification
69
112
  def rspec_message(examples, failures, pendings)
70
113
  "#{pluralize('example', examples)}, #{pluralize('failure', failures)}, #{pendings} pending"
71
114
  end
115
+
116
+ def feature_message(scenarios, pending_scenarios, failed_scenarios, steps, pending_steps, failed_steps)
117
+ "#{pluralize('scenario', scenarios)}, #{pluralize('failure', failed_scenarios)}, #{pending_scenarios} pending\n" +
118
+ "#{pluralize('step', steps)}, #{pluralize('failure', failed_steps)}, #{pending_steps} pending"
119
+ end
72
120
  end
73
121
  end
122
+
123
+ %w{ linux mac windows cygwin doom buuf }.each { |x| require "autotest_notification/#{x}" }
124
+
125
+ if RUBY_PLATFORM == 'java'
126
+ require 'java'
127
+ AutotestNotification.const_set :RUBY_PLATFORM, java.lang.System.getProperty('os.name').downcase
128
+ end
@@ -2,7 +2,7 @@ module AutotestNotification
2
2
  class Buuf
3
3
  class << self
4
4
  def image(notification)
5
- "#{IMAGES_DIRECTORY}/buuf/#{notification}.png"
5
+ "#{Config.images_directory}/buuf/#{notification}.png"
6
6
  end
7
7
  end
8
8
  end
@@ -1,14 +1,34 @@
1
1
  module AutotestNotification
2
2
  class Cygwin
3
+ @last_test_failed = false
4
+
3
5
  class << self
4
- def notify(title, msg, img)
6
+ def notify(title, msg, img, total = 1, failures = 0)
5
7
  img = get_image_path(img).strip
6
- system "sncmd /m '#{title}' '#{msg}' '#{img}' /t #{EXPIRATION_IN_SECONDS}"
8
+ system "sncmd /m '#{title}' '#{msg}' '#{img}' /t #{Config.expiration_in_seconds}"
9
+ play(SUCCESS_SOUND) if AutotestNotification.const_defined?("SUCCESS_SOUND") && !SUCCESS_SOUND.empty? && failures == 0
10
+ play(FAILURE_SOUND) if AutotestNotification.const_defined?("FAILURE_SOUND") && !FAILURE_SOUND.empty? && failures > 0
11
+ say(total, failures) if DOOM_EDITION
7
12
  end
8
13
 
9
14
  def get_image_path(img)
10
15
  `cygpath -m #{img}`
11
16
  end
17
+
18
+ def say(total, failures)
19
+ if failures > 0
20
+ Doom.play_sound(total, failures)
21
+ @last_test_failed = true
22
+ elsif @last_test_failed
23
+ Doom.play_sound(total, failures)
24
+ @last_test_failed = false
25
+ end
26
+ end
27
+
28
+ def play(sound_file)
29
+ system "cp #{sound_file} /dev/dsp"
30
+ end
31
+
12
32
  end
13
33
  end
14
34
  end
@@ -2,7 +2,7 @@ module AutotestNotification
2
2
  class Doom
3
3
  class << self
4
4
  def image(total, failures)
5
- "#{IMAGES_DIRECTORY}/doom/doom_#{percent(total, failures)}.png"
5
+ "#{Config.images_directory}/doom/doom_#{percent(total, failures)}.png"
6
6
  end
7
7
 
8
8
  def play_sound(total, failures)
@@ -13,6 +13,8 @@ module AutotestNotification
13
13
  `#{File.expand_path(File.dirname(__FILE__) + "/../../bin/")}/playsound #{sound_file}`
14
14
  when /linux/
15
15
  system("/usr/bin/mplayer #{sound_file} > /dev/null 2> /dev/null")
16
+ when /cygwin/
17
+ system "cp #{sound_file} /dev/dsp"
16
18
  end
17
19
  end
18
20
 
@@ -3,7 +3,7 @@ module AutotestNotification
3
3
  class << self
4
4
 
5
5
  def notify(title, msg, img, total = 1, failures = 0, priority = 0)
6
- @expiration_in_seconds = failures > 0 && STICKY ? 0 : EXPIRATION_IN_SECONDS
6
+ Config.expiration_in_seconds = 0 if failures > 0 && STICKY
7
7
 
8
8
  if has_notify?
9
9
  notify_send(title, msg, img, priority)
@@ -30,13 +30,13 @@ module AutotestNotification
30
30
  system "which zenity > /dev/null 2>&1"
31
31
  end
32
32
 
33
- def notify_send(title, msg, img, priority)
33
+ def notify_send(title, msg, img, priority = 0)
34
34
  urgency = priority > 1 ? 'critical' : priority < 0 ? 'low' : 'normal'
35
- system "notify-send -t #{@expiration_in_seconds * 1000} -i #{img} -u #{urgency} '#{title}' '#{msg}'"
35
+ system "notify-send -t #{Config.expiration_in_seconds * 1000} -i #{img} -u #{urgency} '#{title}' '#{msg}'"
36
36
  end
37
37
 
38
38
  def kdialog(title, msg, img)
39
- system "kdialog --title '#{title}' --passivepopup '<img src=\"#{img}\" align=\"middle\"> #{msg}' #{@expiration_in_seconds}"
39
+ system "kdialog --title '#{title}' --passivepopup '<img src=\"#{img}\" align=\"middle\"> #{msg}' #{Config.expiration_in_seconds}"
40
40
  end
41
41
 
42
42
  def zenity(title, msg, img)
@@ -6,8 +6,8 @@ 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
+ play(SUCCESS_SOUND) if AutotestNotification.const_defined?("SUCCESS_SOUND") && !SUCCESS_SOUND.empty? && failures == 0
10
+ play(FAILURE_SOUND) if AutotestNotification.const_defined?("FAILURE_SOUND") && !FAILURE_SOUND.empty? && failures > 0
11
11
  say(total, failures) if SPEAKING
12
12
  end
13
13
 
@@ -1,7 +1,7 @@
1
1
  module AutotestNotification #:nodoc:
2
2
  module VERSION #:nodoc:
3
- MAJOR = 1
4
- MINOR = 8
3
+ MAJOR = 2
4
+ MINOR = 2
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
@@ -53,12 +53,12 @@ class TestLinux < Test::Unit::TestCase
53
53
  end
54
54
 
55
55
  def test_notify_send
56
- AutotestNotification::Linux.expects(:system).with('notify-send -t 3000 -i image \'title\' \'msg\'')
56
+ AutotestNotification::Linux.expects(:system).with('notify-send -t 3000 -i image -u normal \'title\' \'msg\'')
57
57
  AutotestNotification::Linux.notify_send("title", "msg", "image")
58
58
  end
59
59
 
60
60
  def test_notify_kdialog
61
- AutotestNotification::Linux.expects(:system).with('kdialog --title \'title\' --passivepopup \'msg\' 3')
61
+ AutotestNotification::Linux.expects(:system).with('kdialog --title \'title\' --passivepopup \'<img src="image" align="middle"> msg\' 3')
62
62
  AutotestNotification::Linux.kdialog("title", "msg", "image")
63
63
  end
64
64
 
@@ -68,17 +68,17 @@ class TestLinux < Test::Unit::TestCase
68
68
  end
69
69
 
70
70
  def test_has_zenity?
71
- AutotestNotification::Linux.expects(:system).with('which zenity 2> /dev/null')
71
+ AutotestNotification::Linux.expects(:system).with('which zenity > /dev/null 2>&1')
72
72
  AutotestNotification::Linux.has_zenity?
73
73
  end
74
74
 
75
75
  def test_has_notify?
76
- AutotestNotification::Linux.expects(:system).with('which notify-send 2> /dev/null')
76
+ AutotestNotification::Linux.expects(:system).with('which notify-send > /dev/null 2>&1')
77
77
  AutotestNotification::Linux.has_notify?
78
78
  end
79
79
 
80
80
  def test_has_kdialog?
81
- AutotestNotification::Linux.expects(:system).with('which kdialog 2> /dev/null')
81
+ AutotestNotification::Linux.expects(:system).with('which kdialog > /dev/null 2>&1')
82
82
  AutotestNotification::Linux.has_kdialog?
83
83
  end
84
84
 
@@ -88,4 +88,4 @@ class TestLinux < Test::Unit::TestCase
88
88
  AutotestNotification::Linux.expects(method).returns("title", "msg", "image", 1)
89
89
  AutotestNotification::Linux.notify("title", "msg", "image", 1, 1)
90
90
  end
91
- end
91
+ end
@@ -38,7 +38,7 @@ class TestMac < Test::Unit::TestCase
38
38
  end
39
39
 
40
40
  def test_success_sound_is_played_when_specified_and_test_success
41
- AutotestNotification.const_set :SUCCESS_SOUND, sound_path
41
+ AutotestNotification.const_set :SUCCESS_SOUND, sound_path
42
42
  AutotestNotification::Mac.expects(:play).with(sound_path)
43
43
  AutotestNotification::Mac.notify("title", "msg", "image", 1, 0)
44
44
  end
@@ -16,7 +16,7 @@ class TestAutotestNotification < Test::Unit::TestCase
16
16
  end
17
17
 
18
18
  def test_notify_when_os_is_cygwin
19
- AutotestNotification::Cygwin.expects(:notify).with(@title, @msg, @image)
19
+ AutotestNotification::Cygwin.expects(:notify).with(@title, @msg, @image, @total, @failures)
20
20
  verify_to("cygwin")
21
21
  end
22
22
 
@@ -26,7 +26,7 @@ class TestAutotestNotification < Test::Unit::TestCase
26
26
  end
27
27
 
28
28
  def test_notify_when_os_is_linux
29
- AutotestNotification::Linux.expects(:notify).with(@title, @msg, @image, @total, @failures)
29
+ AutotestNotification::Linux.expects(:notify).with(@title, @msg, @image, @total, @failures, @priority)
30
30
  verify_to("linux")
31
31
  end
32
32
 
metadata CHANGED
@@ -1,36 +1,61 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackwinter-autotest-notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ prerelease: false
5
+ segments:
6
+ - 2
7
+ - 2
8
+ - 0
9
+ version: 2.2.0
5
10
  platform: ruby
6
11
  authors:
7
- - "Carlos Brando, Rodrigo Urubatan, Alexandre da Silva, Carlos J\xC3\xBAnior, Davis Zanetti Cabral, Marcos Tapaj\xC3\xB3s, Thiago Pradi, Oz\xC3\xA9ias Sant'ana, Samuel Flores, Diego Carrion"
12
+ - Carlos Brando
13
+ - Rodrigo Urubatan
14
+ - Alexandre da Silva
15
+ - "Carlos J\xC3\xBAnior"
16
+ - Davis Zanetti Cabral
17
+ - "Marcos Tapaj\xC3\xB3s"
18
+ - Thiago Pradi
19
+ - "Oz\xC3\xA9ias Sant'ana"
20
+ - Samuel Flores
21
+ - Diego Carrion
22
+ - Ernesto Nakamura
8
23
  autorequire:
9
24
  bindir: bin
10
25
  cert_chain: []
11
26
 
12
- date: 2009-01-27 00:00:00 -08:00
27
+ date: 2010-02-25 00:00:00 +01:00
13
28
  default_executable:
14
29
  dependencies:
15
30
  - !ruby/object:Gem::Dependency
16
- name: ZenTest
17
- version_requirement:
18
- version_requirements: !ruby/object:Gem::Requirement
31
+ name: autotest
32
+ prerelease: false
33
+ requirement: &id001 !ruby/object:Gem::Requirement
19
34
  requirements:
20
35
  - - ">="
21
36
  - !ruby/object:Gem::Version
22
- version: 3.9.2
23
- version:
37
+ segments:
38
+ - 4
39
+ - 2
40
+ - 9
41
+ version: 4.2.9
42
+ type: :runtime
43
+ version_requirements: *id001
24
44
  - !ruby/object:Gem::Dependency
25
45
  name: hoe
26
- version_requirement:
27
- version_requirements: !ruby/object:Gem::Requirement
46
+ prerelease: false
47
+ requirement: &id002 !ruby/object:Gem::Requirement
28
48
  requirements:
29
49
  - - ">="
30
50
  - !ruby/object:Gem::Version
31
- version: 1.8.0
32
- version:
33
- description: This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.
51
+ segments:
52
+ - 2
53
+ - 3
54
+ - 3
55
+ version: 2.3.3
56
+ type: :development
57
+ version_requirements: *id002
58
+ description: This gem set the autotest to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.
34
59
  email:
35
60
  - autotest-notification@carlosbrando.com
36
61
  executables:
@@ -108,6 +133,8 @@ files:
108
133
  - website/template.html.erb
109
134
  has_rdoc: true
110
135
  homepage: http://github.com/carlosbrando/autotest-notification/
136
+ licenses: []
137
+
111
138
  post_install_message: |+
112
139
 
113
140
  For more information on autotest_notification, see http://github.com/carlosbrando/autotest-notification/
@@ -127,25 +154,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
154
  requirements:
128
155
  - - ">="
129
156
  - !ruby/object:Gem::Version
157
+ segments:
158
+ - 0
130
159
  version: "0"
131
- version:
132
160
  required_rubygems_version: !ruby/object:Gem::Requirement
133
161
  requirements:
134
162
  - - ">="
135
163
  - !ruby/object:Gem::Version
164
+ segments:
165
+ - 0
136
166
  version: "0"
137
- version:
138
167
  requirements: []
139
168
 
140
169
  rubyforge_project: autotest-notification
141
- rubygems_version: 1.2.0
170
+ rubygems_version: 1.3.6
142
171
  signing_key:
143
- specification_version: 2
144
- summary: This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.
172
+ specification_version: 3
173
+ summary: This gem set the autotest to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.
145
174
  test_files:
146
- - test/autotest_notification/test_windows.rb
147
175
  - test/autotest_notification/test_cygwin.rb
148
- - test/autotest_notification/test_mac.rb
149
176
  - test/autotest_notification/test_linux.rb
150
- - test/test_helper.rb
177
+ - test/autotest_notification/test_mac.rb
178
+ - test/autotest_notification/test_windows.rb
151
179
  - test/test_autotest_notification.rb
180
+ - test/test_helper.rb