notch8-autotest-notification 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/History.txt +38 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +54 -0
  4. data/PostInstall.txt +9 -0
  5. data/README.txt +123 -0
  6. data/Rakefile +4 -0
  7. data/autotest-notification.gemspec +35 -0
  8. data/bin/an-install +76 -0
  9. data/bin/an-uninstall +50 -0
  10. data/config/hoe.rb +75 -0
  11. data/config/requirements.rb +15 -0
  12. data/images/doom/doom_0.png +0 -0
  13. data/images/doom/doom_1.png +0 -0
  14. data/images/doom/doom_2.png +0 -0
  15. data/images/doom/doom_3.png +0 -0
  16. data/images/doom/doom_4.png +0 -0
  17. data/images/doom/doom_5.png +0 -0
  18. data/images/doom/doom_6.png +0 -0
  19. data/images/fail.png +0 -0
  20. data/images/pass.png +0 -0
  21. data/lib/autotest_notification.rb +105 -0
  22. data/lib/autotest_notification/cygwin.rb +14 -0
  23. data/lib/autotest_notification/doom.rb +10 -0
  24. data/lib/autotest_notification/linux.rb +51 -0
  25. data/lib/autotest_notification/mac.rb +22 -0
  26. data/lib/autotest_notification/version.rb +9 -0
  27. data/lib/autotest_notification/windows.rb +11 -0
  28. data/script/console +10 -0
  29. data/script/destroy +14 -0
  30. data/script/generate +14 -0
  31. data/script/txt2html +82 -0
  32. data/setup.rb +1585 -0
  33. data/tasks/deployment.rake +34 -0
  34. data/tasks/environment.rake +7 -0
  35. data/tasks/website.rake +17 -0
  36. data/test/autotest_notification/test_cygwin.rb +11 -0
  37. data/test/autotest_notification/test_linux.rb +92 -0
  38. data/test/autotest_notification/test_mac.rb +21 -0
  39. data/test/autotest_notification/test_windows.rb +13 -0
  40. data/test/test_autotest_notification.rb +39 -0
  41. data/test/test_helper.rb +25 -0
  42. data/website/index.html +141 -0
  43. data/website/index.txt +83 -0
  44. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  45. data/website/stylesheets/screen.css +138 -0
  46. data/website/template.html.erb +48 -0
  47. metadata +133 -0
@@ -0,0 +1,34 @@
1
+ desc 'Release the website and new gem version'
2
+ task :deploy => [:check_version, :website, :release] do
3
+ puts "Remember to create SVN tag:"
4
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
+ puts "Suggested comment:"
7
+ puts "Tagging release #{CHANGES}"
8
+ end
9
+
10
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
+ task :local_deploy => [:website_generate, :install_gem]
12
+
13
+ task :check_version do
14
+ unless ENV['VERSION']
15
+ puts 'Must pass a VERSION=x.y.z release version'
16
+ exit
17
+ end
18
+ unless ENV['VERSION'] == VERS
19
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
20
+ exit
21
+ end
22
+ end
23
+
24
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
+ task :install_gem_no_doc => [:clean, :package] do
26
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
+ end
28
+
29
+ namespace :manifest do
30
+ desc 'Recreate Manifest.txt to include ALL files'
31
+ task :refresh do
32
+ `rake check_manifest | patch -p0 > Manifest.txt`
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
@@ -0,0 +1,17 @@
1
+ desc 'Generate website files'
2
+ task :website_generate => :ruby_env do
3
+ (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
+ sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
+ end
6
+ end
7
+
8
+ desc 'Upload website files to rubyforge'
9
+ task :website_upload do
10
+ host = "#{rubyforge_username}@rubyforge.org"
11
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
12
+ local_dir = 'website'
13
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
14
+ end
15
+
16
+ desc 'Generate and upload website files'
17
+ task :website => [:website_generate, :website_upload, :publish_docs]
@@ -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,92 @@
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_without_speak
10
+ Object.const_set :SPEAKING, false
11
+ AutotestNotification::Linux.expects(:has_notify?).returns(true)
12
+ verify_notify(:notify_send)
13
+ end
14
+
15
+ def test_notify_when_use_zenity_without_speak
16
+ Object.const_set :SPEAKING, false
17
+ AutotestNotification::Linux.expects(:has_notify?).returns(false)
18
+ AutotestNotification::Linux.expects(:has_zenity?).returns(true)
19
+ verify_notify(:zenity)
20
+ end
21
+
22
+ def test_notify_when_use_kdialog_without_speak
23
+ Object.const_set :SPEAKING, false
24
+ AutotestNotification::Linux.expects(:has_notify?).returns(false)
25
+ AutotestNotification::Linux.expects(:has_zenity?).returns(false)
26
+ AutotestNotification::Linux.expects(:has_kdialog?).returns(true)
27
+ verify_notify(:kdialog)
28
+ end
29
+
30
+ def test_notify_when_use_notify_with_speak
31
+ Object.const_set :SPEAKING, true
32
+ AutotestNotification::Linux.expects(:has_notify?).returns(true)
33
+ AutotestNotification::Linux.expects(:system).with("/usr/bin/espeak '1 test failed'")
34
+ verify_notify(:notify_send)
35
+ end
36
+
37
+ def test_notify_when_use_zenity_with_speak
38
+ Object.const_set :SPEAKING, true
39
+ AutotestNotification::Linux.expects(:has_notify?).returns(false)
40
+ AutotestNotification::Linux.expects(:has_zenity?).returns(true)
41
+ AutotestNotification::Linux.expects(:system).with("/usr/bin/espeak '1 test failed'")
42
+ verify_notify(:zenity)
43
+ end
44
+
45
+ def test_notify_when_use_kdialog_with_speak
46
+ Object.const_set :SPEAKING, true
47
+ AutotestNotification::Linux.expects(:has_notify?).returns(false)
48
+ AutotestNotification::Linux.expects(:has_zenity?).returns(false)
49
+ AutotestNotification::Linux.expects(:has_kdialog?).returns(true)
50
+ AutotestNotification::Linux.expects(:system).with("/usr/bin/espeak '1 test failed'")
51
+ verify_notify(:kdialog)
52
+ end
53
+
54
+ def test_notify_send
55
+ AutotestNotification::Linux.expects(:system).with('notify-send -t 3000 -i image \'title\' \'msg\'')
56
+ AutotestNotification::Linux.notify_send("title", "msg", "image")
57
+ end
58
+
59
+ def test_notify_kdialog
60
+ AutotestNotification::Linux.expects(:system).with('kdialog --title \'title\' --passivepopup \'msg\' 3')
61
+ AutotestNotification::Linux.kdialog("title", "msg", "image")
62
+ end
63
+
64
+ def test_notify_zenity
65
+ AutotestNotification::Linux.expects(:system).with('zenity --info --text=\'msg\' --title=\'title\'')
66
+ AutotestNotification::Linux.zenity("title", "msg", "image")
67
+ end
68
+
69
+ def test_has_zenity?
70
+ AutotestNotification::Linux.expects(:system).with('which zenity 2> /dev/null')
71
+ AutotestNotification::Linux.has_zenity?
72
+ end
73
+
74
+ def test_has_notify?
75
+ AutotestNotification::Linux.expects(:system).with('which notify-send 2> /dev/null')
76
+ AutotestNotification::Linux.has_notify?
77
+ end
78
+
79
+ def test_has_kdialog?
80
+ AutotestNotification::Linux.expects(:system).with('which kdialog 2> /dev/null')
81
+ AutotestNotification::Linux.has_kdialog?
82
+ end
83
+
84
+ private
85
+
86
+ def verify_notify(method)
87
+ AutotestNotification::Linux.expects(method).returns("title", "msg", "image", 1)
88
+ AutotestNotification::Linux.notify("title", "msg", "image",1)
89
+ end
90
+
91
+ end
92
+
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ class TestMac < Test::Unit::TestCase
4
+
5
+ def test_notify_without_voice_or_noise
6
+ Object.const_set :SPEAKING, false
7
+ AutotestNotification::Mac.expects(:system).with("growlnotify -n autotest --image image -p 0 -m 'msg' title")
8
+ AutotestNotification::Mac.notify("title", "msg", "image", 1)
9
+ end
10
+
11
+ def test_notify_with_voice_only
12
+ Object.const_set :SPEAKING, true
13
+ AutotestNotification::Mac.expects(:system).with("growlnotify -n autotest --image image -p 0 -m 'msg' title")
14
+ AutotestNotification::Mac.expects(:system).with("say 1 test failed.")
15
+ AutotestNotification::Mac.notify("title", "msg", "image", 1)
16
+ end
17
+
18
+
19
+
20
+ end
21
+
@@ -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
@@ -0,0 +1,39 @@
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
+
10
+ Object.const_set :DOOM_EDITION, false
11
+ end
12
+
13
+ def test_notify_when_os_is_cygwin
14
+ AutotestNotification::Cygwin.expects(:notify).with(@title, @msg, @image)
15
+ verify_to("cygwin")
16
+ end
17
+
18
+ def test_notify_when_os_is_windows
19
+ AutotestNotification::Windows.expects(:notify).with(@title, @msg, @image)
20
+ verify_to("mswin")
21
+ end
22
+
23
+ def test_notify_when_os_is_linux
24
+ AutotestNotification::Linux.expects(:notify).with(@title, @msg, @image, 0)
25
+ verify_to("linux")
26
+ end
27
+
28
+ def test_notify_when_os_is_mac
29
+ AutotestNotification::Mac.expects(:notify).with(@title, @msg, @image, 0, 0)
30
+ verify_to("darwin")
31
+ end
32
+
33
+ private
34
+ def verify_to(so)
35
+ AutotestNotification.const_set("RUBY_PLATFORM", so)
36
+ AutotestNotification.notify(@title, @msg, @image)
37
+ end
38
+
39
+ end
@@ -0,0 +1,25 @@
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
@@ -0,0 +1,141 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>
8
+ autotest_notification
9
+ </title>
10
+ <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
+ <style>
12
+
13
+ </style>
14
+ <script type="text/javascript">
15
+ window.onload = function() {
16
+ settings = {
17
+ tl: { radius: 10 },
18
+ tr: { radius: 10 },
19
+ bl: { radius: 10 },
20
+ br: { radius: 10 },
21
+ antiAlias: true,
22
+ autoPad: true,
23
+ validTags: ["div"]
24
+ }
25
+ var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
+ versionBox.applyCornersToAll();
27
+ }
28
+ </script>
29
+ </head>
30
+ <body>
31
+ <div id="main">
32
+
33
+ <h1>autotest_notification</h1>
34
+ <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/autotest_notification"; return false'>
35
+ <p>Get Version</p>
36
+ <a href="http://rubyforge.org/projects/autotest_notification" class="numbers">1.2.0</a>
37
+ </div>
38
+ <h1>&#x2192; &#8216;autotest_notification&#8217;</h1>
39
+
40
+
41
+ <h2>What</h2>
42
+
43
+
44
+ <h2>Installing</h2>
45
+
46
+
47
+ <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">autotest_notification</span></pre></p>
48
+
49
+
50
+ <h2>The basics</h2>
51
+
52
+
53
+ <h2>Demonstration of usage</h2>
54
+
55
+
56
+ <h2>Forum</h2>
57
+
58
+
59
+ <p><a href="http://groups.google.com/group/autotest_notification">http://groups.google.com/group/autotest_notification</a></p>
60
+
61
+
62
+ <p><span class="caps">TODO</span> &#8211; create Google Group &#8211; autotest_notification</p>
63
+
64
+
65
+ <h2>How to submit patches</h2>
66
+
67
+
68
+ <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
69
+
70
+
71
+ <p><span class="caps">TODO</span> &#8211; pick <span class="caps">SVN</span> or Git instructions</p>
72
+
73
+
74
+ <p>The trunk repository is <code>svn://rubyforge.org/var/svn/autotest_notification/trunk</code> for anonymous access.</p>
75
+
76
+
77
+ <p><span class="caps">OOOORRRR</span></p>
78
+
79
+
80
+ <p>You can fetch the source from either:</p>
81
+
82
+
83
+ <ul>
84
+ <li>rubyforge: <span class="caps">MISSING IN ACTION</span></li>
85
+ </ul>
86
+
87
+
88
+ <p><span class="caps">TODO</span> &#8211; You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
89
+ yet to refresh your local rubyforge data with this projects&#8217; id information.</p>
90
+
91
+
92
+ <p>When you do this, this message will magically disappear!</p>
93
+
94
+
95
+ <p>Or you can hack website/index.txt and make it all go away!!</p>
96
+
97
+
98
+ <ul>
99
+ <li>github: <a href="http://github.com/GITHUB_USERNAME/autotest_notification/tree/master">http://github.com/GITHUB_USERNAME/autotest_notification/tree/master</a></li>
100
+ </ul>
101
+
102
+
103
+ <pre>git clone git://github.com/GITHUB_USERNAME/autotest_notification.git</pre>
104
+
105
+ <p><span class="caps">TODO</span> &#8211; add &#8220;github_username: username&#8221; to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.</p>
106
+
107
+
108
+ <ul>
109
+ <li>gitorious: <a href="git://gitorious.org/autotest_notification/mainline.git">git://gitorious.org/autotest_notification/mainline.git</a></li>
110
+ </ul>
111
+
112
+
113
+ <pre>git clone git://gitorious.org/autotest_notification/mainline.git</pre>
114
+
115
+ <h3>Build and test instructions</h3>
116
+
117
+
118
+ <pre>cd autotest_notification
119
+ rake test
120
+ rake install_gem</pre>
121
+
122
+ <h2>License</h2>
123
+
124
+
125
+ <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
126
+
127
+
128
+ <h2>Contact</h2>
129
+
130
+
131
+ <p>Comments are welcome. Send an email to <a href="mailto:eduardobrando@gmail.com">Carlos Brando</a> via the <a href="http://groups.google.com/group/autotest_notification">forum</a></p>
132
+ <p class="coda">
133
+ <a href="FIXME email">FIXME full name</a>, 15th June 2008<br>
134
+ Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
135
+ </p>
136
+ </div>
137
+
138
+ <!-- insert site tracking codes here, like Google Urchin -->
139
+
140
+ </body>
141
+ </html>
data/website/index.txt ADDED
@@ -0,0 +1,83 @@
1
+ h1. autotest_notification
2
+
3
+ h1. &#x2192; 'autotest_notification'
4
+
5
+
6
+ h2. What
7
+
8
+
9
+ h2. Installing
10
+
11
+ <pre syntax="ruby">sudo gem install autotest_notification</pre>
12
+
13
+ h2. The basics
14
+
15
+
16
+ h2. Demonstration of usage
17
+
18
+
19
+
20
+ h2. Forum
21
+
22
+ "http://groups.google.com/group/autotest_notification":http://groups.google.com/group/autotest_notification
23
+
24
+ TODO - create Google Group - autotest_notification
25
+
26
+ h2. How to submit patches
27
+
28
+ Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
29
+
30
+ TODO - pick SVN or Git instructions
31
+
32
+ The trunk repository is <code>svn://rubyforge.org/var/svn/autotest_notification/trunk</code> for anonymous access.
33
+
34
+ OOOORRRR
35
+
36
+ You can fetch the source from either:
37
+
38
+ <% if rubyforge_project_id %>
39
+
40
+ * rubyforge: "http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>":http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>
41
+
42
+ <pre>git clone git://rubyforge.org/autotest_notification.git</pre>
43
+
44
+ <% else %>
45
+
46
+ * rubyforge: MISSING IN ACTION
47
+
48
+ TODO - You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
49
+ yet to refresh your local rubyforge data with this projects' id information.
50
+
51
+ When you do this, this message will magically disappear!
52
+
53
+ Or you can hack website/index.txt and make it all go away!!
54
+
55
+ <% end %>
56
+
57
+ * github: "http://github.com/GITHUB_USERNAME/autotest_notification/tree/master":http://github.com/GITHUB_USERNAME/autotest_notification/tree/master
58
+
59
+ <pre>git clone git://github.com/GITHUB_USERNAME/autotest_notification.git</pre>
60
+
61
+
62
+ TODO - add "github_username: username" to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.
63
+
64
+
65
+ * gitorious: "git://gitorious.org/autotest_notification/mainline.git":git://gitorious.org/autotest_notification/mainline.git
66
+
67
+ <pre>git clone git://gitorious.org/autotest_notification/mainline.git</pre>
68
+
69
+ h3. Build and test instructions
70
+
71
+ <pre>cd autotest_notification
72
+ rake test
73
+ rake install_gem</pre>
74
+
75
+
76
+ h2. License
77
+
78
+ This code is free to use under the terms of the MIT license.
79
+
80
+ h2. Contact
81
+
82
+ Comments are welcome. Send an email to "Carlos Brando":mailto:eduardobrando@gmail.com via the "forum":http://groups.google.com/group/autotest_notification
83
+