carlosbrando-autotest-notification 1.7.2 → 1.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +11 -13
- data/License.txt +20 -0
- data/Manifest.txt +36 -19
- data/README.txt +138 -0
- data/Rakefile +3 -27
- data/autotest-notification.gemspec +49 -0
- data/bin/an-install +86 -5
- data/bin/an-uninstall +44 -4
- data/config/hoe.rb +75 -0
- data/config/requirements.rb +15 -0
- data/lib/autotest_notification.rb +2 -7
- data/lib/autotest_notification/buuf.rb +9 -0
- data/lib/autotest_notification/cygwin.rb +14 -0
- data/lib/autotest_notification/doom.rb +25 -0
- data/lib/autotest_notification/linux.rb +55 -0
- data/lib/autotest_notification/mac.rb +25 -0
- data/lib/autotest_notification/version.rb +9 -0
- data/lib/autotest_notification/windows.rb +11 -0
- data/script/console +2 -2
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/test/test_autotest_notification.rb +44 -44
- 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 +60 -34
- data/README.rdoc +0 -137
- data/lib/an_install/cli.rb +0 -79
- data/lib/an_uninstall/cli.rb +0 -46
- data/test/test_an-install_cli.rb +0 -19
- data/test/test_an-uninstall_cli.rb +0 -19
data/History.txt
CHANGED
@@ -1,34 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
* 1.7.0 - Nov 13, 2008
|
4
|
-
* Update to new newgem gem.
|
5
|
-
|
6
|
-
* 1.6.0 - Oct 08, 2008
|
1
|
+
1.6.0 - Oct 08, 2008
|
7
2
|
* Buuf Edition - display Buuf icons by Mattahan [http://mattahan.deviantart.com] (samflores)
|
8
3
|
* Added --sticky flag to an-install to keep notifications on screen in case of errors/failures or pending specs (samflores)
|
9
4
|
* Pending notifications now have a priority different from Passed and Failled notifications, to allow set diff color with Growl (samflores)
|
10
5
|
|
11
|
-
|
6
|
+
1.5.0 - Oct 02, 2008
|
12
7
|
* If an-install is run with --pending, shows a yellow warning when there are no errors/failures but there are pending specs. (lucasuyezu)
|
13
8
|
|
14
|
-
|
9
|
+
1.4.0 - Jun 18, 2008
|
15
10
|
* Special Doom Edition for Linux (ozsantana)
|
16
11
|
|
17
|
-
|
12
|
+
1.3.1 - Jun 18, 2008
|
18
13
|
* Added backup to old .autotest file (tchandy)
|
19
14
|
|
20
|
-
|
15
|
+
1.3.0 - Jun 18, 2008
|
21
16
|
* Added Doom sounds.
|
22
17
|
|
23
|
-
|
18
|
+
1.2.0 - Jun 17, 2008
|
24
19
|
* Special Doom Edition
|
25
20
|
|
26
|
-
|
21
|
+
1.1.2
|
27
22
|
* Refactoring code.
|
28
23
|
|
29
24
|
* 1.1.1
|
30
25
|
* Changed to speak when passing the tests after a series of failures. Only in Mac.
|
31
|
-
|
26
|
+
|
32
27
|
* 1.1.0
|
33
28
|
* Now speaking in Linux too.
|
34
29
|
|
@@ -58,3 +53,6 @@
|
|
58
53
|
|
59
54
|
* 0.0.4:
|
60
55
|
* Added an-uninstall to remove the autotest hook.
|
56
|
+
|
57
|
+
* 1 major enhancement:
|
58
|
+
* Initial release
|
data/License.txt
ADDED
@@ -0,0 +1,20 @@
|
|
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.
|
data/Manifest.txt
CHANGED
@@ -1,11 +1,45 @@
|
|
1
|
+
autotest-notification.gemspec
|
1
2
|
History.txt
|
3
|
+
License.txt
|
2
4
|
Manifest.txt
|
3
5
|
PostInstall.txt
|
4
|
-
README.
|
6
|
+
README.txt
|
5
7
|
Rakefile
|
8
|
+
config/hoe.rb
|
9
|
+
config/requirements.rb
|
10
|
+
lib/autotest_notification.rb
|
11
|
+
lib/autotest_notification/version.rb
|
12
|
+
lib/autotest_notification/linux.rb
|
13
|
+
lib/autotest_notification/windows.rb
|
14
|
+
lib/autotest_notification/cygwin.rb
|
15
|
+
lib/autotest_notification/mac.rb
|
16
|
+
lib/autotest_notification/doom.rb
|
17
|
+
lib/autotest_notification/buuf.rb
|
18
|
+
script/console
|
19
|
+
script/destroy
|
20
|
+
script/generate
|
21
|
+
script/txt2html
|
22
|
+
setup.rb
|
23
|
+
tasks/deployment.rake
|
24
|
+
tasks/environment.rake
|
25
|
+
tasks/website.rake
|
26
|
+
test/test_autotest_notification.rb
|
27
|
+
test/test_helper.rb
|
28
|
+
test/autotest_notification/test_cygwin.rb
|
29
|
+
test/autotest_notification/test_linux.rb
|
30
|
+
test/autotest_notification/test_windows.rb
|
31
|
+
test/autotest_notification/test_mac.rb
|
32
|
+
website/index.html
|
33
|
+
website/index.txt
|
34
|
+
website/javascripts/rounded_corners_lite.inc.js
|
35
|
+
website/stylesheets/screen.css
|
36
|
+
website/template.html.erb
|
6
37
|
bin/an-install
|
7
38
|
bin/an-uninstall
|
8
39
|
bin/playsound
|
40
|
+
images/pass.png
|
41
|
+
images/fail.png
|
42
|
+
images/pending.png
|
9
43
|
images/buuf/fail.png
|
10
44
|
images/buuf/pass.png
|
11
45
|
images/buuf/pending.png
|
@@ -16,27 +50,10 @@ images/doom/doom_3.png
|
|
16
50
|
images/doom/doom_4.png
|
17
51
|
images/doom/doom_5.png
|
18
52
|
images/doom/doom_6.png
|
19
|
-
images/fail.png
|
20
|
-
images/pass.png
|
21
|
-
images/pending.png
|
22
|
-
lib/an_install/cli.rb
|
23
|
-
lib/an_uninstall/cli.rb
|
24
|
-
lib/autotest_notification.rb
|
25
|
-
script/console
|
26
|
-
script/destroy
|
27
|
-
script/generate
|
28
53
|
sounds/doom/0.wav
|
29
54
|
sounds/doom/1.wav
|
30
55
|
sounds/doom/2.wav
|
31
56
|
sounds/doom/3.wav
|
32
57
|
sounds/doom/4.wav
|
33
58
|
sounds/doom/5.wav
|
34
|
-
sounds/doom/6.wav
|
35
|
-
test/autotest_notification/test_cygwin.rb
|
36
|
-
test/autotest_notification/test_linux.rb
|
37
|
-
test/autotest_notification/test_mac.rb
|
38
|
-
test/autotest_notification/test_windows.rb
|
39
|
-
test/test_an-install_cli.rb
|
40
|
-
test/test_an-uninstall_cli.rb
|
41
|
-
test/test_autotest_notification.rb
|
42
|
-
test/test_helper.rb
|
59
|
+
sounds/doom/6.wav
|
data/README.txt
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
= THE AUTOTEST NOTIFICATION GEM
|
2
|
+
|
3
|
+
* http://github.com/carlosbrando/autotest-notification/
|
4
|
+
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.
|
9
|
+
|
10
|
+
|
11
|
+
== REQUIREMENTS:
|
12
|
+
|
13
|
+
Independent of operating system you are using, you must install the ZenTest:
|
14
|
+
|
15
|
+
$ gem install ZenTest
|
16
|
+
|
17
|
+
|
18
|
+
* If you're using a Mac:
|
19
|
+
You need to have Growl and growlnotify installed on your machine.
|
20
|
+
|
21
|
+
Download the Growl [http://growl.info/index.php] and install it like any other application on your Mac
|
22
|
+
|
23
|
+
Then you must install the growlnotify.
|
24
|
+
|
25
|
+
In your shell, cd to the directory on the Growl disk image containing growlnotify, and type ./install.sh.
|
26
|
+
That script will install growlnotify to /usr/local/bin and the manpage to /usr/local/man.
|
27
|
+
|
28
|
+
If you want to be notified with voice of the test results, when running an-install, pass a "-s" switch, when you do not want voices notifications anymore, just run it again without the "-s" switch.
|
29
|
+
|
30
|
+
|
31
|
+
* If you're using Windows (with cygwin):
|
32
|
+
You need to have Snarl and sncmd installed on your machine.
|
33
|
+
|
34
|
+
Download Snarl [http://www.fullphat.net/] and install it like any other application on your machine.
|
35
|
+
|
36
|
+
Then download sncmd [http://www.k23productions.com/download.php?view.105] open the zip file and place
|
37
|
+
the executable from the zip in any directory in windows PATH (for example c:\windows).
|
38
|
+
|
39
|
+
|
40
|
+
* If you're using Windows (without cygwin):
|
41
|
+
You need to have Snarl, diffutils and ruby-snarl installed on your machine.
|
42
|
+
|
43
|
+
Download Snarl [http://www.fullphat.net/] and install it like any other application on your machine.
|
44
|
+
|
45
|
+
Download DiffUtils for Windows [http://gnuwin32.sourceforge.net/packages/diffutils.htm] and follow the installation instructions on the site.
|
46
|
+
|
47
|
+
Run in the command prompt:
|
48
|
+
|
49
|
+
$ gem install ruby-snarl
|
50
|
+
|
51
|
+
After all that. You must update the environment variable PATH with the path to the bin of diffutils.
|
52
|
+
It's the price that was paid for using Windows (try cygwin).
|
53
|
+
|
54
|
+
|
55
|
+
* If you're using Linux:
|
56
|
+
You need to have libnotify binaries installed.
|
57
|
+
|
58
|
+
For ubuntu this means: sudo apt-get install libnotify-bin
|
59
|
+
|
60
|
+
Other distributions may package it with other names, do a search for libnotify using your distribution package manager.
|
61
|
+
|
62
|
+
If you use KDE and do not have libnotify-bin installed, it will try to use kdialog wich is part of KDE.
|
63
|
+
It also works if you have zenity installed.
|
64
|
+
|
65
|
+
If you want to be notified with voice of the test results, instal espeak [http://espeak.sourceforge.net/] too, it is not needed.
|
66
|
+
And when running an-install, pass a "-s" switch, when you do not want voices notifications anymore, just run it again without the "-s" switch.
|
67
|
+
|
68
|
+
To hear the sounds of Doom Edition, you need the mplayer [http://www.mplayerhq.hu/design7/dload.html] installed.
|
69
|
+
|
70
|
+
|
71
|
+
== INSTALL:
|
72
|
+
|
73
|
+
$ sudo gem install carlosbrando-autotest-notification --source=http://gems.github.com
|
74
|
+
|
75
|
+
Run it to let the notifier in automatic mode:
|
76
|
+
|
77
|
+
$ an-install
|
78
|
+
|
79
|
+
In Windows without cygwin, it's necessary to install in the directory of the project:
|
80
|
+
|
81
|
+
$ an-install --path=C:\projects\my_project
|
82
|
+
|
83
|
+
To turn off the notifier:
|
84
|
+
|
85
|
+
$ an-uninstall
|
86
|
+
|
87
|
+
|
88
|
+
== Special Doom Edition
|
89
|
+
|
90
|
+
$ an-install --doom --speaking
|
91
|
+
|
92
|
+
== Buuf Edition - Display Buuf icons by Mattahan [http://mattahan.deviantart.com]
|
93
|
+
|
94
|
+
$ an-install --buuf
|
95
|
+
|
96
|
+
== Showing a yellow warning image when there are no errors/failures but there are pending specs
|
97
|
+
|
98
|
+
$ an-install --pending
|
99
|
+
|
100
|
+
== CONTRIBUTORS:
|
101
|
+
|
102
|
+
* carlosbrando [http://www.nomedojogo.com]
|
103
|
+
* simpsomboy [http://alexandredasilva.wordpress.com]
|
104
|
+
* urubatan [http://www.urubatan.info]
|
105
|
+
* chjunior [http://tas.milk-it.net]
|
106
|
+
* daviscabral [http://blog.impactmedia.com.br]
|
107
|
+
* tapajos [http://www.improveit.com.br/tapajos]
|
108
|
+
* tchandy [http://tchandy.wordpress.com]
|
109
|
+
* ozsantana [http://blog.iconcreative.net]
|
110
|
+
* lucasuyezu [http://xucros.com]
|
111
|
+
* samflores [http://www.thoughtsoverflow.com]
|
112
|
+
* dcrec1 [http://www.mouseoverstudio.com/blog]
|
113
|
+
* nuxlli [http://www.nuxlli.com.br]
|
114
|
+
|
115
|
+
== LICENSE:
|
116
|
+
|
117
|
+
(The MIT License)
|
118
|
+
|
119
|
+
Copyright (c) 2008
|
120
|
+
|
121
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
122
|
+
a copy of this software and associated documentation files (the
|
123
|
+
'Software'), to deal in the Software without restriction, including
|
124
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
125
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
126
|
+
permit persons to whom the Software is furnished to do so, subject to
|
127
|
+
the following conditions:
|
128
|
+
|
129
|
+
The above copyright notice and this permission notice shall be
|
130
|
+
included in all copies or substantial portions of the Software.
|
131
|
+
|
132
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
133
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
134
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
135
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
136
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
137
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
138
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,28 +1,4 @@
|
|
1
|
-
|
2
|
-
require
|
1
|
+
require 'config/requirements'
|
2
|
+
require 'config/hoe' # setup Hoe + all gem configuration
|
3
3
|
|
4
|
-
|
5
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
|
-
$hoe = Hoe.new('autotest-notification', AutotestNotification::VERSION) do |p|
|
7
|
-
p.developer('Carlos Brando', 'eduardobrando@gmail.com')
|
8
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
|
-
p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
10
|
-
p.rubyforge_name = p.name # TODO this is default value
|
11
|
-
p.extra_deps = [
|
12
|
-
['ZenTest', '>= 3.9.2']
|
13
|
-
]
|
14
|
-
p.extra_dev_deps = [
|
15
|
-
['newgem', ">= #{::Newgem::VERSION}"]
|
16
|
-
]
|
17
|
-
|
18
|
-
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
19
|
-
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
20
|
-
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
21
|
-
p.rsync_args = '-av --delete --ignore-errors'
|
22
|
-
end
|
23
|
-
|
24
|
-
require 'newgem/tasks' # load /tasks/*.rake
|
25
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
26
|
-
|
27
|
-
# TODO - want other tests/tasks run by default? Add them to the list
|
28
|
-
# task :default => [:spec, :features]
|
4
|
+
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{autotest-notification}
|
5
|
+
s.version = "1.7.3"
|
6
|
+
|
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{2008-11-14}
|
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
|
+
s.email = ["autotest-notification@carlosbrando.com"]
|
12
|
+
s.executables = ["an-install", "an-uninstall", "playsound"]
|
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"]
|
15
|
+
s.has_rdoc = true
|
16
|
+
s.homepage = %q{http://github.com/carlosbrando/autotest-notification/}
|
17
|
+
s.post_install_message = %q{
|
18
|
+
For more information on autotest_notification, see http://github.com/carlosbrando/autotest-notification/
|
19
|
+
|
20
|
+
To turn on the notifier you need to run the following command:
|
21
|
+
an-install
|
22
|
+
|
23
|
+
To turn off:
|
24
|
+
an-uninstall
|
25
|
+
|
26
|
+
}
|
27
|
+
s.rdoc_options = ["--main", "README.txt"]
|
28
|
+
s.require_paths = ["lib"]
|
29
|
+
s.rubyforge_project = %q{autotest-notification}
|
30
|
+
s.rubygems_version = %q{1.3.0}
|
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_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
|
+
|
34
|
+
if s.respond_to? :specification_version then
|
35
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
36
|
+
s.specification_version = 2
|
37
|
+
|
38
|
+
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"])
|
41
|
+
else
|
42
|
+
s.add_dependency(%q<ZenTest>, [">= 3.9.2"])
|
43
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
44
|
+
end
|
45
|
+
else
|
46
|
+
s.add_dependency(%q<ZenTest>, [">= 3.9.2"])
|
47
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
48
|
+
end
|
49
|
+
end
|
data/bin/an-install
CHANGED
@@ -1,10 +1,91 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Created on 2008-11
|
2
|
+
#
|
3
|
+
# Created on 2008-5-11.
|
4
4
|
# Copyright (c) 2008. All rights reserved.
|
5
5
|
|
6
|
-
|
6
|
+
begin
|
7
|
+
require 'rubygems'
|
8
|
+
rescue LoadError
|
9
|
+
# no rubygems to load, so we fail silently
|
10
|
+
end
|
7
11
|
|
8
|
-
require
|
12
|
+
require 'optparse'
|
13
|
+
require 'ftools'
|
9
14
|
|
10
|
-
|
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
|