carlosbrando-autotest-notification 0.2.0 → 0.2.1

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/History.txt CHANGED
@@ -1,4 +1,7 @@
1
- == 0.2.0 2008-05-13
1
+ == 0.2.1 2008-05-13
2
+ * Starting to add tests.
3
+
4
+ * 0.2.0 2008-05-13
2
5
  * Added support to Gnome at linux.rb (zenity).
3
6
  * Changed filename windows.rb to cygwin.rb and added a new windows.rb file that uses Snarl to show the messages.
4
7
  * README.txt updated with windows and linux dependencies.
data/Manifest.txt CHANGED
@@ -22,6 +22,10 @@ tasks/environment.rake
22
22
  tasks/website.rake
23
23
  test/test_autotest_notification.rb
24
24
  test/test_helper.rb
25
+ test/autotest_notification/test_cygwin.rb
26
+ test/autotest_notification/test_linux.rb
27
+ test/autotest_notification/test_mac.rb
28
+ test/autotest_notification/test_windows.rb
25
29
  website/index.html
26
30
  website/index.txt
27
31
  website/javascripts/rounded_corners_lite.inc.js
data/README.txt CHANGED
@@ -80,11 +80,12 @@ To turn off the notifier:
80
80
 
81
81
  == Contributors
82
82
 
83
- * carlosbrando [http://www.nomedojogo.com/]
84
- * simpsomboy [http://alexandredasilva.wordpress.com/]
85
- * urubatan [http://www.urubatan.info/]
86
- * chjunior [http://tas.milk-it.net/]
87
- * daviscabral [http://blog.impactmedia.com.br/]
83
+ * carlosbrando [http://www.nomedojogo.com]
84
+ * simpsomboy [http://alexandredasilva.wordpress.com]
85
+ * urubatan [http://www.urubatan.info]
86
+ * chjunior [http://tas.milk-it.net]
87
+ * daviscabral [http://blog.impactmedia.com.br]
88
+ * tapajos [http://www.improveit.com.br/tapajos]
88
89
 
89
90
 
90
91
  == LICENSE:
@@ -1,17 +1,17 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{autotest-notification}
3
- s.version = "0.2.0"
3
+ s.version = "0.2.1"
4
4
 
5
5
  s.specification_version = 2 if s.respond_to? :specification_version=
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"]
8
+ s.authors = ["Carlos Brando", "Rodrigo Urubatan", "Alexandre da Silva", "Carlos J\303\272nior", "Davis Zanetti Cabral", "Marcos Tapaj\303\263s"]
9
9
  s.date = %q{2008-05-13}
10
- s.description = %q{Set the autotest to display messages on the operating system using software such as Growl and LibNotify.}
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
11
  s.email = ["eduardobrando@gmail.com"]
12
12
  s.executables = ["an-install", "an-uninstall"]
13
13
  s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "website/index.txt"]
14
- s.files = ["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/mac.rb", "lib/autotest_notification/windows.rb", "lib/autotest_notification/cygwin.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", "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", "images/pass.png", "images/fail.png", "autotest-notification.gemspec"]
14
+ s.files = ["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/mac.rb", "lib/autotest_notification/windows.rb", "lib/autotest_notification/cygwin.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_mac.rb", "test/autotest_notification/test_windows.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", "images/pass.png", "images/fail.png", "autotest-notification.gemspec"]
15
15
  s.has_rdoc = true
16
16
  s.homepage = %q{http://github.com/carlosbrando/autotest-notification/}
17
17
  s.post_install_message = %q{
@@ -28,6 +28,6 @@ To turn off:
28
28
  s.require_paths = ["lib"]
29
29
  s.rubyforge_project = %q{}
30
30
  s.rubygems_version = %q{1.1.1}
31
- s.summary = %q{Set the autotest to display messages on the operating system using software such as Growl and LibNotify.}
32
- s.test_files = ["test/test_autotest_notification.rb", "test/test_helper.rb"]
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
33
  end
data/config/hoe.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  require 'autotest_notification/version'
2
2
 
3
- AUTHOR = "Carlos Brando, Rodrigo Urubatan, Alexandre da Silva, Carlos Júnior, Davis Zanetti Cabral"
3
+ AUTHOR = "Carlos Brando, Rodrigo Urubatan, Alexandre da Silva, Carlos Júnior, Davis Zanetti Cabral, Marcos Tapajós"
4
4
  EMAIL = "eduardobrando@gmail.com"
5
- DESCRIPTION = "Set the autotest to display messages on the operating system using software such as Growl and LibNotify."
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
6
  GEM_NAME = 'autotest-notification' # what ppl will type to install your gem
7
7
  RUBYFORGE_PROJECT = '' # The unix name for your project
8
8
  HOMEPATH = "http://github.com/carlosbrando/autotest-notification/"
@@ -2,11 +2,15 @@ module AutotestNotification
2
2
  class Cygwin
3
3
  class << self
4
4
  def notify(title, msg, img)
5
- img = `cygpath -m #{img}` if RUBY_PLATFORM =~ /cygwin/
5
+ img = get_image_path(img)
6
6
  img.strip!
7
7
 
8
8
  system "sncmd /m '#{title}' '#{msg}' '#{img}' /t #{EXPIRATION_IN_SECONDS}"
9
9
  end
10
+
11
+ def get_image_path(img)
12
+ `cygpath -m #{img}`
13
+ end
10
14
  end
11
15
  end
12
16
  end
@@ -2,7 +2,7 @@ module AutotestNotification
2
2
  class Mac
3
3
  class << self
4
4
  def notify(title, msg, img, pri = 0)
5
- system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title}"
5
+ system "growlnotify -n autotest --image #{img} -p #{pri} -m '#{msg}' #{title}"
6
6
  end
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@ module AutotestNotification #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ class TestCygwin < Test::Unit::TestCase
4
+
5
+ def test_notify
6
+ AutotestNotification::Cygwin.expects(:get_image_path).with("image").returns(" image ")
7
+ AutotestNotification::Cygwin.expects(:system).with('sncmd /m \'title\' \'msg\' \'image\' /t 3')
8
+ AutotestNotification::Cygwin.notify("title", "msg", "image")
9
+ end
10
+
11
+ end
@@ -0,0 +1,58 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ class TestLinux < Test::Unit::TestCase
4
+
5
+ def setup
6
+ turn_methods_public AutotestNotification::Linux
7
+ end
8
+
9
+ def test_notify_when_use_notify
10
+ AutotestNotification::Linux.expects(:has_notify?).returns(true)
11
+ verify_notify(:notify_send)
12
+ end
13
+
14
+ def test_notify_when_use_zenity
15
+ AutotestNotification::Linux.expects(:has_notify?).returns(false)
16
+ AutotestNotification::Linux.expects(:has_zenity?).returns(true)
17
+ verify_notify(:zenity)
18
+ end
19
+
20
+ def test_notify_when_use_kdialog
21
+ AutotestNotification::Linux.expects(:has_notify?).returns(false)
22
+ AutotestNotification::Linux.expects(:has_zenity?).returns(false)
23
+ verify_notify(:kdialog)
24
+ end
25
+
26
+ def test_notify_send
27
+ AutotestNotification::Linux.expects(:system).with('notify-send -t 3000 -i image \'title\' \'msg\'')
28
+ AutotestNotification::Linux.notify_send("title", "msg", "image")
29
+ end
30
+
31
+ def test_notify_kdialog
32
+ AutotestNotification::Linux.expects(:system).with('kdialog --title \'title\' --passivepopup \'msg\' 3')
33
+ AutotestNotification::Linux.kdialog("title", "msg", "image")
34
+ end
35
+
36
+ def test_notify_zenity
37
+ AutotestNotification::Linux.expects(:system).with('zenity --info --text=\'msg\' --title=\'title\'')
38
+ AutotestNotification::Linux.zenity("title", "msg", "image")
39
+ end
40
+
41
+ def test_has_zenity?
42
+ AutotestNotification::Linux.expects(:system).with('which zenity 2> /dev/null')
43
+ AutotestNotification::Linux.has_zenity?
44
+ end
45
+
46
+ def test_has_notify?
47
+ AutotestNotification::Linux.expects(:system).with('which notify-send 2> /dev/null')
48
+ AutotestNotification::Linux.has_notify?
49
+ end
50
+
51
+ private
52
+
53
+ def verify_notify(method)
54
+ AutotestNotification::Linux.expects(method).returns("title", "msg", "image")
55
+ AutotestNotification::Linux.notify("title", "msg", "image")
56
+ end
57
+
58
+ end
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ class TestMac < Test::Unit::TestCase
4
+
5
+ def test_notify
6
+ AutotestNotification::Mac.expects(:system).with("growlnotify -n autotest --image image -p 0 -m 'msg' title")
7
+ AutotestNotification::Mac.notify("title", "msg", "image")
8
+ end
9
+
10
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ class Snarl
4
+ end
5
+
6
+ class TestWindows < Test::Unit::TestCase
7
+
8
+ def test_notify
9
+ Snarl.expects(:show_message).with("title", "msg", "image")
10
+ AutotestNotification::Windows.notify("title", "msg", "image")
11
+ end
12
+
13
+ end
@@ -1,11 +1,38 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestAutotestNotification < Test::Unit::TestCase
4
-
5
- def setup
6
- end
7
-
8
- def test_truth
9
- assert true
10
- end
11
- end
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestAutotestNotification < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @title = "title"
7
+ @msg = "message"
8
+ @image = "image"
9
+ @pri = 1
10
+ end
11
+
12
+ def test_notify_when_os_is_cygwin
13
+ AutotestNotification::Cygwin.expects(:notify).with(@title, @msg, @image)
14
+ verify_to("cygwin")
15
+ end
16
+
17
+ def test_notify_when_os_is_windows
18
+ AutotestNotification::Windows.expects(:notify).with(@title, @msg, @image)
19
+ verify_to("mswin")
20
+ end
21
+
22
+ def test_notify_when_os_is_linux
23
+ AutotestNotification::Linux.expects(:notify).with(@title, @msg, @image)
24
+ verify_to("linux")
25
+ end
26
+
27
+ def test_notify_when_os_is_mac
28
+ AutotestNotification::Mac.expects(:notify).with(@title, @msg, @image, @pri)
29
+ verify_to("darwin")
30
+ end
31
+
32
+ private
33
+ def verify_to(so)
34
+ AutotestNotification.const_set("RUBY_PLATFORM", so)
35
+ AutotestNotification.notify(@title, @msg, @image, @pri)
36
+ end
37
+
38
+ end
data/test/test_helper.rb CHANGED
@@ -1,2 +1,28 @@
1
- require 'test/unit'
2
- require File.dirname(__FILE__) + '/../lib/autotest_notification'
1
+ require "test/unit"
2
+ require "rubygems"
3
+ require 'autotest'
4
+ require "mocha"
5
+ require File.dirname(__FILE__) + '/../lib/autotest_notification' unless defined?(AutotestNotification)
6
+
7
+ class Test::Unit::TestCase
8
+ def turn_methods_public(classe, method_name = nil)
9
+ if method_name
10
+ classe.class_eval do
11
+ public method_name
12
+ end
13
+ else
14
+ turn_all_methods_public classe
15
+ end
16
+ end
17
+ def turn_all_methods_public(classe)
18
+ classe.class_eval do
19
+ private_instance_methods.each { |instance_method| public instance_method }
20
+ private_methods.each { |method| public_class_method method }
21
+ protected_instance_methods.each { |instance_method| public instance_method }
22
+ protected_methods.each { |method| public_class_method method }
23
+ end
24
+ end
25
+ end
26
+
27
+
28
+
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  <h1>autotest_notification</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/autotest_notification"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/autotest_notification" class="numbers">0.2.0</a>
36
+ <a href="http://rubyforge.org/projects/autotest_notification" class="numbers">0.2.1</a>
37
37
  </div>
38
38
  <h1>&#x2192; &#8216;autotest_notification&#8217;</h1>
39
39
 
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: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Brando
@@ -9,6 +9,7 @@ authors:
9
9
  - Alexandre da Silva
10
10
  - "Carlos J\xC3\xBAnior"
11
11
  - Davis Zanetti Cabral
12
+ - "Marcos Tapaj\xC3\xB3s"
12
13
  autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
@@ -17,7 +18,7 @@ date: 2008-05-13 00:00:00 -07:00
17
18
  default_executable:
18
19
  dependencies: []
19
20
 
20
- description: Set the autotest to display messages on the operating system using software such as Growl and LibNotify.
21
+ description: This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.
21
22
  email:
22
23
  - eduardobrando@gmail.com
23
24
  executables:
@@ -57,6 +58,10 @@ files:
57
58
  - tasks/website.rake
58
59
  - test/test_autotest_notification.rb
59
60
  - test/test_helper.rb
61
+ - test/autotest_notification/test_cygwin.rb
62
+ - test/autotest_notification/test_linux.rb
63
+ - test/autotest_notification/test_mac.rb
64
+ - test/autotest_notification/test_windows.rb
60
65
  - website/index.html
61
66
  - website/index.txt
62
67
  - website/javascripts/rounded_corners_lite.inc.js
@@ -102,7 +107,11 @@ rubyforge_project: ""
102
107
  rubygems_version: 1.0.1
103
108
  signing_key:
104
109
  specification_version: 2
105
- summary: Set the autotest to display messages on the operating system using software such as Growl and LibNotify.
110
+ summary: This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.
106
111
  test_files:
112
+ - test/autotest_notification/test_cygwin.rb
113
+ - test/autotest_notification/test_linux.rb
114
+ - test/autotest_notification/test_mac.rb
115
+ - test/autotest_notification/test_windows.rb
107
116
  - test/test_autotest_notification.rb
108
117
  - test/test_helper.rb