autotest-notification 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +61 -0
- data/License.txt +20 -0
- data/Manifest.txt +59 -0
- data/PostInstall.txt +9 -0
- data/README.txt +139 -0
- data/Rakefile +4 -0
- data/autotest-notification.gemspec +48 -0
- data/bin/an-install +105 -0
- data/bin/an-uninstall +49 -0
- data/bin/playsound +0 -0
- data/config/hoe.rb +77 -0
- data/config/requirements.rb +15 -0
- data/images/buuf/fail.png +0 -0
- data/images/buuf/pass.png +0 -0
- data/images/buuf/pending.png +0 -0
- data/images/doom/doom_0.png +0 -0
- data/images/doom/doom_1.png +0 -0
- data/images/doom/doom_2.png +0 -0
- data/images/doom/doom_3.png +0 -0
- data/images/doom/doom_4.png +0 -0
- data/images/doom/doom_5.png +0 -0
- data/images/doom/doom_6.png +0 -0
- data/images/fail.png +0 -0
- data/images/pass.png +0 -0
- data/images/pending.png +0 -0
- data/lib/autotest_notification.rb +128 -0
- data/lib/autotest_notification/buuf.rb +9 -0
- data/lib/autotest_notification/cygwin.rb +34 -0
- data/lib/autotest_notification/doom.rb +27 -0
- data/lib/autotest_notification/linux.rb +58 -0
- data/lib/autotest_notification/mac.rb +30 -0
- data/lib/autotest_notification/version.rb +9 -0
- data/lib/autotest_notification/windows.rb +11 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/sounds/doom/0.wav +0 -0
- data/sounds/doom/1.wav +0 -0
- data/sounds/doom/2.wav +0 -0
- data/sounds/doom/3.wav +0 -0
- data/sounds/doom/4.wav +0 -0
- data/sounds/doom/5.wav +0 -0
- data/sounds/doom/6.wav +0 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/test/autotest_notification/test_cygwin.rb +10 -0
- data/test/autotest_notification/test_linux.rb +91 -0
- data/test/autotest_notification/test_mac.rb +78 -0
- data/test/autotest_notification/test_windows.rb +12 -0
- data/test/test_autotest_notification.rb +44 -0
- data/test/test_helper.rb +25 -0
- data/website/index.html +86 -0
- data/website/index.txt +83 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.html.erb +48 -0
- metadata +155 -0
data/bin/an-uninstall
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created on 2008-5-11.
|
4
|
+
# Copyright (c) 2008. All rights reserved.
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'rubygems'
|
8
|
+
rescue LoadError
|
9
|
+
# no rubygems to load, so we fail silently
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'optparse'
|
13
|
+
|
14
|
+
# NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
|
15
|
+
|
16
|
+
OPTIONS = {
|
17
|
+
:path => '~'
|
18
|
+
}
|
19
|
+
MANDATORY_OPTIONS = %w( )
|
20
|
+
|
21
|
+
parser = OptionParser.new do |opts|
|
22
|
+
opts.banner = <<BANNER
|
23
|
+
This application is wonderful because...
|
24
|
+
|
25
|
+
Usage: #{File.basename($0)} [options]
|
26
|
+
|
27
|
+
Options are:
|
28
|
+
BANNER
|
29
|
+
opts.separator ""
|
30
|
+
opts.on("-p", "--path=PATH", String,
|
31
|
+
"The root path for selecting files",
|
32
|
+
"Default: ~") { |path| OPTIONS[:path] = path}
|
33
|
+
opts.on("-h", "--help",
|
34
|
+
"Show this help message.") { puts opts; exit }
|
35
|
+
opts.parse!(ARGV)
|
36
|
+
|
37
|
+
if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
|
38
|
+
puts opts; exit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
path = OPTIONS[:path]
|
43
|
+
|
44
|
+
autotest_file = File.expand_path(path) + "/.autotest"
|
45
|
+
if File.exist?(autotest_file)
|
46
|
+
File.delete(autotest_file)
|
47
|
+
puts "\nYou no longer receive notifications of your tests."
|
48
|
+
puts "" # a blank line
|
49
|
+
end
|
data/bin/playsound
ADDED
Binary file
|
data/config/hoe.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# coding: UTF-8
|
2
|
+
|
3
|
+
require 'autotest_notification/version'
|
4
|
+
|
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"
|
6
|
+
EMAIL = "autotest-notification@carlosbrando.com"
|
7
|
+
DESCRIPTION = "This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results."
|
8
|
+
GEM_NAME = 'autotest-notification' # what ppl will type to install your gem
|
9
|
+
RUBYFORGE_PROJECT = nil # 'autotestnotific' # The unix name for your project
|
10
|
+
HOMEPATH = "http://github.com/carlosbrando/autotest-notification/"
|
11
|
+
DOWNLOAD_PATH = "http://github.com/carlosbrando/autotest-notification/tarball/master"
|
12
|
+
|
13
|
+
EXTRA_DEPENDENCIES = [
|
14
|
+
['ZenTest', '>= 3.9.2']
|
15
|
+
# ['activesupport', '>= 1.3.1']
|
16
|
+
] # An array of rubygem dependencies [name, version]
|
17
|
+
|
18
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
19
|
+
@config = nil
|
20
|
+
RUBYFORGE_USERNAME = "carlosbrando"
|
21
|
+
def rubyforge_username
|
22
|
+
unless @config
|
23
|
+
begin
|
24
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
25
|
+
rescue
|
26
|
+
puts <<-EOS
|
27
|
+
ERROR: No rubyforge config file found: #{@config_file}
|
28
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
29
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
30
|
+
EOS
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
end
|
34
|
+
RUBYFORGE_USERNAME.replace @config["username"]
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
REV = nil
|
39
|
+
# UNCOMMENT IF REQUIRED:
|
40
|
+
# REV = YAML.load(`svn info`)['Revision']
|
41
|
+
VERS = AutotestNotification::VERSION::STRING + (REV ? ".#{REV}" : "")
|
42
|
+
RDOC_OPTS = ['--quiet', '--title', 'autotest_notification documentation',
|
43
|
+
"--opname", "index.html",
|
44
|
+
"--line-numbers",
|
45
|
+
"--main", "README",
|
46
|
+
"--inline-source"]
|
47
|
+
|
48
|
+
class Hoe
|
49
|
+
def extra_deps
|
50
|
+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
51
|
+
@extra_deps
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Generate all the Rake tasks
|
56
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
57
|
+
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
58
|
+
p.developer(AUTHOR, EMAIL)
|
59
|
+
p.description = DESCRIPTION
|
60
|
+
p.summary = DESCRIPTION
|
61
|
+
p.url = HOMEPATH
|
62
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
63
|
+
p.test_globs = ["test/**/test_*.rb"]
|
64
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
65
|
+
|
66
|
+
# == Optional
|
67
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
68
|
+
p.extra_deps = EXTRA_DEPENDENCIES
|
69
|
+
|
70
|
+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
71
|
+
end
|
72
|
+
|
73
|
+
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
74
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
75
|
+
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
76
|
+
$hoe.rsync_args = '-av --delete --ignore-errors'
|
77
|
+
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
include FileUtils
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
%w[rake hoe newgem rubigen ZenTest].each do |req_gem|
|
6
|
+
begin
|
7
|
+
require req_gem.downcase
|
8
|
+
rescue LoadError
|
9
|
+
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
+
puts "Installation: gem install #{req_gem} -y"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/images/fail.png
ADDED
Binary file
|
data/images/pass.png
ADDED
Binary file
|
data/images/pending.png
ADDED
Binary file
|
@@ -0,0 +1,128 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
module AutotestNotification
|
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/"
|
20
|
+
|
21
|
+
self.expiration_in_seconds = 3
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
Autotest.add_hook :ran_command do |at|
|
26
|
+
result = at.results.is_a?(Array) ? at.results.last : at.results.split("\n").last
|
27
|
+
|
28
|
+
if result
|
29
|
+
%w{ test assertion error example pending failure }.each { |x| instance_variable_set "@#{x}s", result[/(\d+) #{x}/, 1].to_i }
|
30
|
+
|
31
|
+
case result
|
32
|
+
when /test/
|
33
|
+
code = 31 if @failures > 0 || @errors > 0
|
34
|
+
msg = unit_test_message(@tests, @assertions, @failures, @errors)
|
35
|
+
when /example/
|
36
|
+
code = (@failures > 0) ? 31 : (@pendings > 0) ? 33 : 32
|
37
|
+
msg = rspec_message(@examples, @failures, @pendings)
|
38
|
+
else
|
39
|
+
code = 31
|
40
|
+
msg = "1 exception occurred"
|
41
|
+
@failures = 1
|
42
|
+
end
|
43
|
+
|
44
|
+
if @failures > 0 || @errors > 0
|
45
|
+
notify "FAIL", msg, Config.fail_image, @tests + @examples, @failures + @errors, 2
|
46
|
+
elsif PENDING && @pendings > 0
|
47
|
+
notify "Pending", msg, Config.pending_image, @tests + @examples, @failures + @errors, 1
|
48
|
+
else
|
49
|
+
notify "Pass", msg, Config.success_image, @tests + @examples, 0, -2
|
50
|
+
end
|
51
|
+
|
52
|
+
puts "\e[#{code}m#{'=' * 80}\e[0m\n\n"
|
53
|
+
end
|
54
|
+
end
|
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
|
+
|
86
|
+
class << self
|
87
|
+
def notify(title, msg, img = Config.success_image, total = 1, failures = 0, priority = 0)
|
88
|
+
|
89
|
+
img = Doom.image(total, failures) if DOOM_EDITION
|
90
|
+
img = Buuf.image(title.downcase) if BUUF
|
91
|
+
|
92
|
+
case RUBY_PLATFORM
|
93
|
+
when /linux/
|
94
|
+
Linux.notify(title, msg, img, total, failures, priority)
|
95
|
+
when /darwin/
|
96
|
+
Mac.notify(title, msg, img, total, failures, priority)
|
97
|
+
when /cygwin/
|
98
|
+
Cygwin.notify(title, msg, img, total, failures)
|
99
|
+
when /mswin/
|
100
|
+
Windows.notify(title, msg, img)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def pluralize(text, number)
|
105
|
+
"#{number} #{text}#{'s' if number != 1}"
|
106
|
+
end
|
107
|
+
|
108
|
+
def unit_test_message(tests, assertions, failures, errors)
|
109
|
+
"#{pluralize('test', tests)}, #{pluralize('assertion', assertions)}, #{pluralize('failure', failures)}, #{pluralize('error', errors)}"
|
110
|
+
end
|
111
|
+
|
112
|
+
def rspec_message(examples, failures, pendings)
|
113
|
+
"#{pluralize('example', examples)}, #{pluralize('failure', failures)}, #{pendings} pending"
|
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
|
120
|
+
end
|
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
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module AutotestNotification
|
2
|
+
class Cygwin
|
3
|
+
@last_test_failed = false
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def notify(title, msg, img, total = 1, failures = 0)
|
7
|
+
img = get_image_path(img).strip
|
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
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_image_path(img)
|
15
|
+
`cygpath -m #{img}`
|
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
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module AutotestNotification
|
2
|
+
class Doom
|
3
|
+
class << self
|
4
|
+
def image(total, failures)
|
5
|
+
"#{Config.images_directory}/doom/doom_#{percent(total, failures)}.png"
|
6
|
+
end
|
7
|
+
|
8
|
+
def play_sound(total, failures)
|
9
|
+
sound_file = "#{File.expand_path(File.dirname(__FILE__) + "/../../sounds/doom/")}/#{percent(total, failures)}.wav"
|
10
|
+
|
11
|
+
case RUBY_PLATFORM
|
12
|
+
when /darwin/
|
13
|
+
`#{File.expand_path(File.dirname(__FILE__) + "/../../bin/")}/playsound #{sound_file}`
|
14
|
+
when /linux/
|
15
|
+
system("/usr/bin/mplayer #{sound_file} > /dev/null 2> /dev/null")
|
16
|
+
when /cygwin/
|
17
|
+
system "cp #{sound_file} /dev/dsp"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def percent(total, failures)
|
23
|
+
percent = failures.zero? ? 0 : ((5 * failures) / total) + 1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module AutotestNotification
|
2
|
+
class Linux
|
3
|
+
class << self
|
4
|
+
|
5
|
+
def notify(title, msg, img, total = 1, failures = 0, priority = 0)
|
6
|
+
Config.expiration_in_seconds = 0 if failures > 0 && STICKY
|
7
|
+
|
8
|
+
if has_notify?
|
9
|
+
notify_send(title, msg, img, priority)
|
10
|
+
elsif has_zenity?
|
11
|
+
zenity(title, msg, img)
|
12
|
+
elsif has_kdialog?
|
13
|
+
kdialog(title, msg, img)
|
14
|
+
end
|
15
|
+
|
16
|
+
say(total, failures) if SPEAKING
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
def has_notify?
|
22
|
+
system "which notify-send > /dev/null 2>&1"
|
23
|
+
end
|
24
|
+
|
25
|
+
def has_kdialog?
|
26
|
+
system "which kdialog > /dev/null 2>&1"
|
27
|
+
end
|
28
|
+
|
29
|
+
def has_zenity?
|
30
|
+
system "which zenity > /dev/null 2>&1"
|
31
|
+
end
|
32
|
+
|
33
|
+
def notify_send(title, msg, img, priority = 0)
|
34
|
+
urgency = priority > 1 ? 'critical' : priority < 0 ? 'low' : 'normal'
|
35
|
+
system "notify-send -t #{Config.expiration_in_seconds * 1000} -i #{img} -u #{urgency} '#{title}' '#{msg}'"
|
36
|
+
end
|
37
|
+
|
38
|
+
def kdialog(title, msg, img)
|
39
|
+
system "kdialog --title '#{title}' --passivepopup '<img src=\"#{img}\" align=\"middle\"> #{msg}' #{Config.expiration_in_seconds}"
|
40
|
+
end
|
41
|
+
|
42
|
+
def zenity(title, msg, img)
|
43
|
+
system "zenity --info --text='#{msg}' --title='#{title}'"
|
44
|
+
end
|
45
|
+
|
46
|
+
def say(total, failures)
|
47
|
+
if failures > 0
|
48
|
+
DOOM_EDITION ? Doom.play_sound(total, failures) : system("/usr/bin/espeak '#{failures} test#{'s' unless failures == 1} failed'")
|
49
|
+
else
|
50
|
+
DOOM_EDITION ? Doom.play_sound(total, failures) : system("/usr/bin/espeak 'All tests passed successfully'")
|
51
|
+
end
|
52
|
+
rescue
|
53
|
+
puts "You need the #{DOOM_EDITION ? 'mplayer' : 'espeak'} installed to hear the sounds."
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module AutotestNotification
|
2
|
+
class Mac
|
3
|
+
@last_test_failed = false
|
4
|
+
|
5
|
+
class << self
|
6
|
+
|
7
|
+
def notify(title, msg, img, total = 1, failures = 0, priority = 0)
|
8
|
+
system "growlnotify -n autotest --image #{img} #{'-s ' if ((failures > 0) and STICKY)}-p #{priority} -m '#{msg}' -t #{title}"
|
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 SPEAKING
|
12
|
+
end
|
13
|
+
|
14
|
+
def say(total, failures)
|
15
|
+
if failures > 0
|
16
|
+
DOOM_EDITION ? Doom.play_sound(total, failures) : system("say #{failures} test#{'s' unless failures == 1} failed.")
|
17
|
+
@last_test_failed = true
|
18
|
+
elsif @last_test_failed
|
19
|
+
DOOM_EDITION ? Doom.play_sound(total, failures) : system("say All tests passed successfully.")
|
20
|
+
@last_test_failed = false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def play(sound_file)
|
25
|
+
`#{File.expand_path(File.dirname(__FILE__) + "/../../bin/")}/playsound #{sound_file}`
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|