carlosbrando-autotest-notification 1.6.0 → 1.7.0

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/License.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2008 Carlos Brando
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,47 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = %q{autotest-notification}
3
- s.version = "1.6.0"
4
-
5
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
- 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"]
7
- s.date = %q{2008-10-09}
8
- 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.}
9
- s.email = ["autotest-notification@carlosbrando.com"]
10
- s.executables = ["an-install", "an-uninstall", "playsound"]
11
- s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "website/index.txt"]
12
- 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"]
13
- s.has_rdoc = true
14
- s.homepage = %q{http://github.com/carlosbrando/autotest-notification/}
15
- s.post_install_message = %q{
16
- For more information on autotest_notification, see http://github.com/carlosbrando/autotest-notification/
17
-
18
- To turn on the notifier you need to run the following command:
19
- an-install
20
-
21
- To turn off:
22
- an-uninstall
23
-
24
- }
25
- s.rdoc_options = ["--main", "README.txt"]
26
- s.require_paths = ["lib"]
27
- s.rubyforge_project = %q{autotest-notification}
28
- s.rubygems_version = %q{1.3.0}
29
- 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.}
30
- 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"]
31
-
32
- if s.respond_to? :specification_version then
33
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
34
- s.specification_version = 2
35
-
36
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
37
- s.add_runtime_dependency(%q<ZenTest>, [">= 3.9.2"])
38
- s.add_development_dependency(%q<hoe>, [">= 1.7.0"])
39
- else
40
- s.add_dependency(%q<ZenTest>, [">= 3.9.2"])
41
- s.add_dependency(%q<hoe>, [">= 1.7.0"])
42
- end
43
- else
44
- s.add_dependency(%q<ZenTest>, [">= 3.9.2"])
45
- s.add_dependency(%q<hoe>, [">= 1.7.0"])
46
- end
47
- end
data/bin/an-install DELETED
@@ -1,91 +0,0 @@
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
- require 'ftools'
14
-
15
- # NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
16
-
17
- OPTIONS = {
18
- :path => '~',
19
- :speaking => false,
20
- :doom => false,
21
- :sticky => false,
22
- :pending => false,
23
- :buuf => false
24
- }
25
- MANDATORY_OPTIONS = %w( )
26
-
27
- parser = OptionParser.new do |opts|
28
- opts.banner = <<BANNER
29
- This application is wonderful because...
30
-
31
- Usage: #{File.basename($0)} [options]
32
-
33
- Options are:
34
- BANNER
35
- opts.separator ""
36
-
37
- opts.on("-p", "--path=PATH", String,
38
- "The root path for selecting files",
39
- "Default: ~") { |OPTIONS[:path]| }
40
-
41
- opts.on("-s", "--speaking",
42
- "If a test failed, the computer will speak.",
43
- "For all plataforms.") { |OPTIONS[:speaking]| OPTIONS[:speaking] = true }
44
-
45
- opts.on("-d", "--doom",
46
- "Special Doom Edition.",
47
- "Only for Mac.") { |OPTIONS[:doom]| OPTIONS[:doom] = true }
48
-
49
- opts.on("-b", "--buuf",
50
- "Special Buuf Images.",
51
- "For all platforms") { |OPTIONS[:buuf]| }
52
-
53
- opts.on("--pending",
54
- "Shows a different image when there are no errors/failures",
55
- "but there are pending specs. Only for Mac.") { |OPTIONS[:pending]| OPTIONS[:pending] = true }
56
-
57
- opts.on("--sticky",
58
- "Keep notification on screen in case of errros/failures or pending specs.",
59
- "Only for Mac.") { |OPTIONS[:sticky]| OPTIONS[:sticky] = true }
60
-
61
- opts.on("-h", "--help",
62
- "Show this help message.") { puts opts; exit }
63
-
64
- opts.parse!(ARGV)
65
-
66
- if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
67
- puts opts; exit
68
- end
69
- end
70
-
71
- path = OPTIONS[:path]
72
-
73
- autotest_path = File.expand_path(path)
74
-
75
- if File.exists?("#{autotest_path}/.autotest")
76
- puts "\nYou Already have a .autotest file, renamed to .autotest.backup"
77
- FileUtils.cp "#{autotest_path}/.autotest", "#{autotest_path}/.autotest.backup"
78
- end
79
-
80
- f = File.new("#{autotest_path}/.autotest", "w")
81
- f.write "# ~.autotest\n"
82
- f.write "require 'autotest_notification'\n"
83
- f.write("SPEAKING = #{OPTIONS[:speaking]}\n")
84
- f.write("DOOM_EDITION = #{OPTIONS[:doom]}\n")
85
- f.write("BUUF = #{OPTIONS[:buuf]}\n")
86
- f.write("PENDING = #{OPTIONS[:pending]}\n")
87
- f.write("STICKY = #{OPTIONS[:sticky]}\n")
88
- f.close
89
-
90
- puts "\nAs from now all tests will be notified automatically."
91
- puts "" # a blank line
data/bin/an-uninstall DELETED
@@ -1,50 +0,0 @@
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
- require 'ftools'
14
-
15
- # NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
16
-
17
- OPTIONS = {
18
- :path => '~'
19
- }
20
- MANDATORY_OPTIONS = %w( )
21
-
22
- parser = OptionParser.new do |opts|
23
- opts.banner = <<BANNER
24
- This application is wonderful because...
25
-
26
- Usage: #{File.basename($0)} [options]
27
-
28
- Options are:
29
- BANNER
30
- opts.separator ""
31
- opts.on("-p", "--path=PATH", String,
32
- "The root path for selecting files",
33
- "Default: ~") { |OPTIONS[:path]| }
34
- opts.on("-h", "--help",
35
- "Show this help message.") { puts opts; exit }
36
- opts.parse!(ARGV)
37
-
38
- if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
39
- puts opts; exit
40
- end
41
- end
42
-
43
- path = OPTIONS[:path]
44
-
45
- autotest_file = File.expand_path(path) + "/.autotest"
46
- if File.exist?(autotest_file)
47
- File.delete(autotest_file)
48
- puts "\nYou no longer receive notifications of your tests."
49
- puts "" # a blank line
50
- end
data/bin/playsound DELETED
Binary file
data/config/hoe.rb DELETED
@@ -1,75 +0,0 @@
1
- require 'autotest_notification/version'
2
-
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"
4
- 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."
6
- GEM_NAME = 'autotest-notification' # what ppl will type to install your gem
7
- RUBYFORGE_PROJECT = nil # 'autotestnotific' # The unix name for your project
8
- HOMEPATH = "http://github.com/carlosbrando/autotest-notification/"
9
- DOWNLOAD_PATH = "http://github.com/carlosbrando/autotest-notification/tarball/master"
10
-
11
- EXTRA_DEPENDENCIES = [
12
- ['ZenTest', '>= 3.9.2']
13
- # ['activesupport', '>= 1.3.1']
14
- ] # An array of rubygem dependencies [name, version]
15
-
16
- @config_file = "~/.rubyforge/user-config.yml"
17
- @config = nil
18
- RUBYFORGE_USERNAME = "carlosbrando"
19
- def rubyforge_username
20
- unless @config
21
- begin
22
- @config = YAML.load(File.read(File.expand_path(@config_file)))
23
- rescue
24
- puts <<-EOS
25
- ERROR: No rubyforge config file found: #{@config_file}
26
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
27
- - See http://newgem.rubyforge.org/rubyforge.html for more details
28
- EOS
29
- exit
30
- end
31
- end
32
- RUBYFORGE_USERNAME.replace @config["username"]
33
- end
34
-
35
-
36
- REV = nil
37
- # UNCOMMENT IF REQUIRED:
38
- # REV = YAML.load(`svn info`)['Revision']
39
- VERS = AutotestNotification::VERSION::STRING + (REV ? ".#{REV}" : "")
40
- RDOC_OPTS = ['--quiet', '--title', 'autotest_notification documentation',
41
- "--opname", "index.html",
42
- "--line-numbers",
43
- "--main", "README",
44
- "--inline-source"]
45
-
46
- class Hoe
47
- def extra_deps
48
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
49
- @extra_deps
50
- end
51
- end
52
-
53
- # Generate all the Rake tasks
54
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
55
- $hoe = Hoe.new(GEM_NAME, VERS) do |p|
56
- p.developer(AUTHOR, EMAIL)
57
- p.description = DESCRIPTION
58
- p.summary = DESCRIPTION
59
- p.url = HOMEPATH
60
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
61
- p.test_globs = ["test/**/test_*.rb"]
62
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
63
-
64
- # == Optional
65
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
66
- p.extra_deps = EXTRA_DEPENDENCIES
67
-
68
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
69
- end
70
-
71
- CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
72
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
73
- $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
74
- $hoe.rsync_args = '-av --delete --ignore-errors'
75
- $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -1,15 +0,0 @@
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
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]))
@@ -1,9 +0,0 @@
1
- module AutotestNotification
2
- class Buuf
3
- class << self
4
- def image(notification)
5
- "#{IMAGES_DIRECTORY}/buuf/#{notification}.png"
6
- end
7
- end
8
- end
9
- end
@@ -1,14 +0,0 @@
1
- module AutotestNotification
2
- class Cygwin
3
- class << self
4
- def notify(title, msg, img)
5
- img = get_image_path(img).strip
6
- system "sncmd /m '#{title}' '#{msg}' '#{img}' /t #{EXPIRATION_IN_SECONDS}"
7
- end
8
-
9
- def get_image_path(img)
10
- `cygpath -m #{img}`
11
- end
12
- end
13
- end
14
- end
@@ -1,25 +0,0 @@
1
- module AutotestNotification
2
- class Doom
3
- class << self
4
- def image(total, failures)
5
- "#{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
- end
17
- end
18
-
19
- private
20
- def percent(total, failures)
21
- percent = failures.zero? ? 0 : ((5 * failures) / total) + 1
22
- end
23
- end
24
- end
25
- end
@@ -1,55 +0,0 @@
1
- module AutotestNotification
2
- class Linux
3
- class << self
4
-
5
- def notify(title, msg, img, total = 1, failures = 0)
6
- if has_notify?
7
- notify_send(title, msg, img)
8
- elsif has_zenity?
9
- zenity(title, msg, img)
10
- elsif has_kdialog?
11
- kdialog(title, msg, img)
12
- end
13
-
14
- say(total, failures) if SPEAKING
15
- end
16
-
17
- protected
18
-
19
- def has_notify?
20
- system "which notify-send 2> /dev/null"
21
- end
22
-
23
- def has_kdialog?
24
- system "which kdialog 2> /dev/null"
25
- end
26
-
27
- def has_zenity?
28
- system "which zenity 2> /dev/null"
29
- end
30
-
31
- def notify_send(title, msg, img)
32
- system "notify-send -t #{EXPIRATION_IN_SECONDS * 1000} -i #{img} '#{title}' '#{msg}'"
33
- end
34
-
35
- def kdialog(title, msg, img)
36
- system "kdialog --title '#{title}' --passivepopup '#{msg}' #{EXPIRATION_IN_SECONDS}"
37
- end
38
-
39
- def zenity(title, msg, img)
40
- system "zenity --info --text='#{msg}' --title='#{title}'"
41
- end
42
-
43
- def say(total, failures)
44
- if failures > 0
45
- DOOM_EDITION ? Doom.play_sound(total, failures) : system("/usr/bin/espeak '#{failures} test#{'s' unless failures == 1} failed'")
46
- else
47
- DOOM_EDITION ? Doom.play_sound(total, failures) : system("/usr/bin/espeak 'All tests passed successfully'")
48
- end
49
- rescue
50
- puts "You need the #{DOOM_EDITION ? 'mplayer' : 'espeak'} installed to hear the sounds."
51
- end
52
-
53
- end
54
- end
55
- end
@@ -1,25 +0,0 @@
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
- say(total, failures) if SPEAKING
10
- end
11
-
12
- def say(total, failures)
13
-
14
- if failures > 0
15
- DOOM_EDITION ? Doom.play_sound(total, failures) : system("say #{failures} test#{'s' unless failures == 1} failed.")
16
- @last_test_failed = true
17
- elsif @last_test_failed
18
- DOOM_EDITION ? Doom.play_sound(total, failures) : system("say All tests passed successfully.")
19
- @last_test_failed = false
20
- end
21
- end
22
-
23
- end
24
- end
25
- end