carlosbrando-autotest-notification 1.7.1 → 1.7.2

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/Manifest.txt CHANGED
@@ -3,6 +3,9 @@ Manifest.txt
3
3
  PostInstall.txt
4
4
  README.rdoc
5
5
  Rakefile
6
+ bin/an-install
7
+ bin/an-uninstall
8
+ bin/playsound
6
9
  images/buuf/fail.png
7
10
  images/buuf/pass.png
8
11
  images/buuf/pending.png
@@ -16,6 +19,8 @@ images/doom/doom_6.png
16
19
  images/fail.png
17
20
  images/pass.png
18
21
  images/pending.png
22
+ lib/an_install/cli.rb
23
+ lib/an_uninstall/cli.rb
19
24
  lib/autotest_notification.rb
20
25
  script/console
21
26
  script/destroy
@@ -31,5 +36,7 @@ test/autotest_notification/test_cygwin.rb
31
36
  test/autotest_notification/test_linux.rb
32
37
  test/autotest_notification/test_mac.rb
33
38
  test/autotest_notification/test_windows.rb
39
+ test/test_an-install_cli.rb
40
+ test/test_an-uninstall_cli.rb
34
41
  test/test_autotest_notification.rb
35
42
  test/test_helper.rb
data/README.rdoc CHANGED
@@ -107,7 +107,7 @@ To turn off the notifier:
107
107
  * tchandy [http://tchandy.wordpress.com]
108
108
  * ozsantana [http://blog.iconcreative.net]
109
109
  * lucasuyezu [http://xucros.com]
110
- * samflores [http://github.com/samflores]
110
+ * samflores [http://www.thoughtsoverflow.com]
111
111
  * dcrec1 [http://www.mouseoverstudio.com/blog]
112
112
  * nuxlli [http://www.nuxlli.com.br]
113
113
 
data/bin/an-install ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created on 2008-11-14.
4
+ # Copyright (c) 2008. All rights reserved.
5
+
6
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/autotest-notification")
7
+
8
+ require "an_install/cli"
9
+
10
+ AnInstall::CLI.execute(STDOUT, ARGV)
data/bin/an-uninstall ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created on 2008-11-14.
4
+ # Copyright (c) 2008. All rights reserved.
5
+
6
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/autotest-notification")
7
+
8
+ require "an_uninstall/cli"
9
+
10
+ AnUninstall::CLI.execute(STDOUT, ARGV)
data/bin/playsound ADDED
Binary file
@@ -0,0 +1,79 @@
1
+ require 'optparse'
2
+
3
+ module AnInstall
4
+ class CLI
5
+ def self.execute(stdout, arguments=[])
6
+
7
+ # NOTE: the option -p/--path= is given as an example, and should be replaced in your application.
8
+
9
+ options = {
10
+ :path => '~',
11
+ :speaking => false,
12
+ :doom => false,
13
+ :sticky => false,
14
+ :pending => false,
15
+ :buuf => false
16
+ }
17
+ mandatory_options = %w( )
18
+
19
+ parser = OptionParser.new do |opts|
20
+ opts.banner = <<-BANNER.gsub(/^ /,'')
21
+ This application is wonderful because...
22
+
23
+ Usage: #{File.basename($0)} [options]
24
+
25
+ Options are:
26
+ BANNER
27
+ opts.separator ""
28
+ opts.on("-p", "--path=PATH", String,
29
+ "This is a sample message.",
30
+ "For multiple lines, add more strings.",
31
+ "Default: ~") { |arg| options[:path] = arg }
32
+ opts.on("-s", "--speaking",
33
+ "If a test failed, the computer will speak.",
34
+ "For all plataforms.") { options[:speaking] = true }
35
+ opts.on("-d", "--doom",
36
+ "Special Doom Edition.",
37
+ "Only for Mac.") { options[:doom] = true }
38
+ opts.on("-b", "--buuf",
39
+ "Special Buuf Images.",
40
+ "For all platforms") { options[:buuf] = true }
41
+ opts.on("--pending",
42
+ "Shows a different image when there are no errors/failures",
43
+ "but there are pending specs. Only for Mac.") { options[:pending] = true }
44
+ opts.on("--sticky",
45
+ "Keep notification on screen in case of errros/failures or pending specs.",
46
+ "Only for Mac.") { options[:sticky] = true }
47
+ opts.on("-h", "--help",
48
+ "Show this help message.") { stdout.puts opts; exit }
49
+ opts.parse!(arguments)
50
+
51
+ if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
52
+ stdout.puts opts; exit
53
+ end
54
+ end
55
+
56
+ path = options[:path]
57
+
58
+ autotest_path = File.expand_path(path)
59
+
60
+ if File.exists?("#{autotest_path}/.autotest")
61
+ puts "\nYou Already have a .autotest file, renamed to .autotest.backup"
62
+ FileUtils.cp "#{autotest_path}/.autotest", "#{autotest_path}/.autotest.backup"
63
+ end
64
+
65
+ f = File.new("#{autotest_path}/.autotest", "w")
66
+ f.write "# ~.autotest\n"
67
+ f.write "require 'autotest_notification'\n"
68
+ f.write("SPEAKING = #{options[:speaking]}\n")
69
+ f.write("DOOM_EDITION = #{options[:doom]}\n")
70
+ f.write("BUUF = #{options[:buuf]}\n")
71
+ f.write("PENDING = #{options[:pending]}\n")
72
+ f.write("STICKY = #{options[:sticky]}\n")
73
+ f.close
74
+
75
+ puts "\nAs from now all tests will be notified automatically."
76
+ puts "" # a blank line
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,46 @@
1
+ require 'optparse'
2
+
3
+ module AnUninstall
4
+ class CLI
5
+ def self.execute(stdout, arguments=[])
6
+
7
+ # NOTE: the option -p/--path= is given as an example, and should be replaced in your application.
8
+
9
+ options = {
10
+ :path => '~'
11
+ }
12
+ mandatory_options = %w( )
13
+
14
+ parser = OptionParser.new do |opts|
15
+ opts.banner = <<-BANNER.gsub(/^ /,'')
16
+ This application is wonderful because...
17
+
18
+ Usage: #{File.basename($0)} [options]
19
+
20
+ Options are:
21
+ BANNER
22
+ opts.separator ""
23
+ opts.on("-p", "--path=PATH", String,
24
+ "This is a sample message.",
25
+ "For multiple lines, add more strings.",
26
+ "Default: ~") { |arg| options[:path] = arg }
27
+ opts.on("-h", "--help",
28
+ "Show this help message.") { stdout.puts opts; exit }
29
+ opts.parse!(arguments)
30
+
31
+ if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
32
+ stdout.puts opts; exit
33
+ end
34
+ end
35
+
36
+ path = options[:path]
37
+
38
+ autotest_file = File.expand_path(path) + "/.autotest"
39
+ if File.exist?(autotest_file)
40
+ File.delete(autotest_file)
41
+ puts "\nYou no longer receive notifications of your tests."
42
+ puts "" # a blank line
43
+ end
44
+ end
45
+ end
46
+ end
@@ -5,7 +5,7 @@ require "autotest"
5
5
  %w{ linux mac windows cygwin doom buuf }.each { |x| require "autotest_notification/#{x}" }
6
6
 
7
7
  module AutotestNotification
8
- VERSION = '1.7.1'
8
+ VERSION = '1.7.2'
9
9
 
10
10
  IMAGES_DIRECTORY = File.expand_path(File.dirname(__FILE__) + "/../images/")
11
11
  SUCCESS_IMAGE = "#{IMAGES_DIRECTORY}/pass.png";
@@ -75,4 +75,4 @@ module AutotestNotification
75
75
  "#{pluralize('example', examples)}, #{pluralize('failure', failures)}, #{pendings} pending"
76
76
  end
77
77
  end
78
- end
78
+ end
@@ -0,0 +1,19 @@
1
+ require File.join(File.dirname(__FILE__), "test_helper.rb")
2
+ require 'an_install/cli'
3
+
4
+ class TestAnInstallCli < Test::Unit::TestCase
5
+ def setup
6
+ @stdout_io = StringIO.new
7
+ AnInstall::CLI.execute(@stdout_io, [])
8
+ @stdout_io.rewind
9
+ @stdout = @stdout_io.read
10
+ end
11
+
12
+ def test_not_print_default_output
13
+ assert_no_match(/To update this executable/, @stdout)
14
+ end
15
+
16
+ # def test_print_successful_message
17
+ # assert_match(/As from now all tests will be notified automatically/, @stdout)
18
+ # end
19
+ end
@@ -0,0 +1,19 @@
1
+ require File.join(File.dirname(__FILE__), "test_helper.rb")
2
+ require 'an_uninstall/cli'
3
+
4
+ class TestAnUninstallCli < Test::Unit::TestCase
5
+ def setup
6
+ @stdout_io = StringIO.new
7
+ AnUninstall::CLI.execute(@stdout_io, [])
8
+ @stdout_io.rewind
9
+ @stdout = @stdout_io.read
10
+ end
11
+
12
+ def test_not_print_default_output
13
+ assert_no_match(/To update this executable/, @stdout)
14
+ end
15
+
16
+ # def test_print_successful_message
17
+ # assert_match(/You no longer receive notifications of your tests/, @stdout)
18
+ # end
19
+ 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.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Brando
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-13 00:00:00 -08:00
12
+ date: 2008-11-14 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -42,8 +42,10 @@ dependencies:
42
42
  description: This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.
43
43
  email:
44
44
  - eduardobrando@gmail.com
45
- executables: []
46
-
45
+ executables:
46
+ - an-install
47
+ - an-uninstall
48
+ - playsound
47
49
  extensions: []
48
50
 
49
51
  extra_rdoc_files:
@@ -57,6 +59,9 @@ files:
57
59
  - PostInstall.txt
58
60
  - README.rdoc
59
61
  - Rakefile
62
+ - bin/an-install
63
+ - bin/an-uninstall
64
+ - bin/playsound
60
65
  - images/buuf/fail.png
61
66
  - images/buuf/pass.png
62
67
  - images/buuf/pending.png
@@ -70,6 +75,8 @@ files:
70
75
  - images/fail.png
71
76
  - images/pass.png
72
77
  - images/pending.png
78
+ - lib/an_install/cli.rb
79
+ - lib/an_uninstall/cli.rb
73
80
  - lib/autotest_notification.rb
74
81
  - script/console
75
82
  - script/destroy
@@ -85,6 +92,8 @@ files:
85
92
  - test/autotest_notification/test_linux.rb
86
93
  - test/autotest_notification/test_mac.rb
87
94
  - test/autotest_notification/test_windows.rb
95
+ - test/test_an-install_cli.rb
96
+ - test/test_an-uninstall_cli.rb
88
97
  - test/test_autotest_notification.rb
89
98
  - test/test_helper.rb
90
99
  has_rdoc: true
@@ -119,5 +128,7 @@ test_files:
119
128
  - test/autotest_notification/test_linux.rb
120
129
  - test/autotest_notification/test_mac.rb
121
130
  - test/autotest_notification/test_windows.rb
131
+ - test/test_an-install_cli.rb
132
+ - test/test_an-uninstall_cli.rb
122
133
  - test/test_autotest_notification.rb
123
134
  - test/test_helper.rb