autotest-growl 0.1.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.
@@ -0,0 +1,5 @@
1
+ == 0.1.0 2009-05-28
2
+
3
+ * Initial release
4
+ * Growl notifications for Test::Unit, RSpec and Cucumber (workaround)
5
+ * Formerly part of autotest-mac which is now deprecated
@@ -0,0 +1,18 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ growl/growlnotify
7
+ img/error.png
8
+ img/failed.png
9
+ img/passed.png
10
+ img/pending.png
11
+ lib/autotest/growl.rb
12
+ script/console
13
+ script/destroy
14
+ script/generate
15
+ spec/autotest-growl_spec.rb
16
+ spec/spec.opts
17
+ spec/spec_helper.rb
18
+ tasks/rspec.rake
@@ -0,0 +1,24 @@
1
+
2
+ +--------------------------------------------------------------------------+
3
+ | |
4
+ | In order to use autotest-growl, the following line has to be added |
5
+ | to the top of ~/.autotest file: |
6
+ | |
7
+ | require 'autotest/growl' |
8
+ | |
9
+ | IMPORTANT: If you use ZenTest-4.0.0, this won't work. See the README |
10
+ | for further instructions. |
11
+ | |
12
+ | Make sure Growl is installed on your computer. Download it from: |
13
+ | |
14
+ | http://growl.info |
15
+ | |
16
+ | If Growl notifications are not always displayed, take a look at the |
17
+ | README for help. |
18
+ | |
19
+ | For more information, feedback and bug submissions, please visit: |
20
+ | |
21
+ | See http://www.bitcetera.com/products/autotest-growl |
22
+ | |
23
+ +--------------------------------------------------------------------------+
24
+
@@ -0,0 +1,124 @@
1
+ = Autotest Growl
2
+
3
+ * Homepage: http://www.bitcetera.com/products/autotest-growl
4
+ * Issues and forum: https://forge.bitcetera.com/projects/show/autotest-growl
5
+
6
+ == DESCRIPTION:
7
+
8
+ This gem aims to improve support for Growl notification by ZenTest's autotest.
9
+ It comes with a nice colored Ruby icon set and - for now - supports Cucumber
10
+ notifications by means of a workaround.
11
+
12
+ Furthermore the terminal running autotest is cleared on every cycle. Don't
13
+ worry though, it's still possible to scroll up to see the output of previous
14
+ cycles.
15
+
16
+ === Ruby 1.9.1 Note
17
+
18
+ For the moment, autotest-growl doesn't seem to work on Ruby 1.9.1. This will
19
+ change soon, however, it will take a few days as autotest itself is currently
20
+ misbehaving - at least on my setup.
21
+
22
+ == REQUIREMENTS:
23
+
24
+ * Growl >= 1.1.4
25
+ * ZenTest >= 4.0.0
26
+
27
+ == INSTALL:
28
+
29
+ Make sure Growl is installed on your computer. You can download it from:
30
+
31
+ http://growl.info
32
+
33
+ Now install the gem:
34
+
35
+ sudo gem install autotest-growl
36
+
37
+ === With ZenTest >4.0.0
38
+
39
+ Add the following line to your ~/.autotest file:
40
+
41
+ require 'autotest/growl'
42
+
43
+ === With ZenTest 4.0.0
44
+
45
+ ZenTest comes with a bundled Growl plugin which will be removed in the
46
+ near future. If you use ZenTest-4.0.0 or older, the above require won't do
47
+ the trick, instead do the following:
48
+
49
+ Find the full path to autotest-growl:
50
+
51
+ find /Library/Ruby /usr -name growl.rb | grep "gems/autotest"
52
+
53
+ Then add the output of the above to your ~/.autotest file:
54
+
55
+ require '--PUT-OUTPUT-HERE--'
56
+
57
+ == CONFIGURATION:
58
+
59
+ === Custom Icons
60
+
61
+ Using your own set of icons is pretty simple. Just create a directory
62
+ ~/.autotest-growl, copy your icons there and name them passed.png,
63
+ pending.png, failed.png and error.png.
64
+
65
+ === Hide the Label
66
+
67
+ If you prefer the Growl notifications not to show labels such as "LABEL:
68
+ All tests have passed", add the following to your ~/.autotest:
69
+
70
+ Autotest::Growl::hide_label = true
71
+
72
+ == TROUBLESHOOTING:
73
+
74
+ === Missing Cucumber Notifications
75
+
76
+ If you are using autotest-fsevent as well, the require statements are not
77
+ ordered correctly. The require for autotest-fsevent must come after all
78
+ other requires in your ~/.autotest.
79
+
80
+ === Unreliable Growl Notifications
81
+
82
+ Under some circumstances, Growl notifications seem to be swallowed randomly.
83
+ If this happens to you, try the following.
84
+
85
+ Add this to your ~/.autotest:
86
+
87
+ Autotest::Growl::remote_notification = true
88
+
89
+ Now open "System Preferences -> Growl -> Network" and set the checkboxes
90
+ "Listen for incoming notifications" and "Allow remote application
91
+ registration”. Try whether remote notifications work with the following
92
+ test:
93
+
94
+ find /Library/Ruby /usr -name growlnotify -exec {} -H localhost -n autotest -m ok \;
95
+
96
+ If you get a NSPortTimeoutException, you should restart Growl and check
97
+ whether a firewall is blocking the connection. Once the notification is
98
+ displayed, go back to the System Preferences and disable the checkbox
99
+ "Allow remote application registration" again.
100
+
101
+ == LICENSE:
102
+
103
+ (The MIT License)
104
+
105
+ Copyright (c) 2009 Sven Schwyn
106
+
107
+ Permission is hereby granted, free of charge, to any person obtaining
108
+ a copy of this software and associated documentation files (the
109
+ 'Software'), to deal in the Software without restriction, including
110
+ without limitation the rights to use, copy, modify, merge, publish,
111
+ distribute, sublicense, and/or sell copies of the Software, and to
112
+ permit persons to whom the Software is furnished to do so, subject to
113
+ the following conditions:
114
+
115
+ The above copyright notice and this permission notice shall be
116
+ included in all copies or substantial portions of the Software.
117
+
118
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
119
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
120
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
121
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
122
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
123
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
124
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,27 @@
1
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
2
+ %w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
3
+ require File.dirname(__FILE__) + '/lib/autotest/growl'
4
+
5
+ $hoe = Hoe.new('autotest-growl', Autotest::Growl::VERSION) do |p|
6
+ p.developer('Sven Schwyn', 'ruby@bitcetera.com')
7
+ p.summary = %q{Next generation Growl notification support for ZenTest's autotest.}
8
+ p.description = %q{This gem aims to improve support for Growl notification by ZenTest's autotest. It comes with a nice colored Ruby icon set and - for now - supports Cucumber by means of a workaround.}
9
+ p.url = %q{http://www.bitcetera.com/products/autotest-growl}
10
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
11
+ p.post_install_message = File.read('PostInstall.txt')
12
+ p.rubyforge_name = p.name
13
+ p.extra_deps = [
14
+ ['ZenTest','>= 4.0.0'],
15
+ ]
16
+ p.extra_dev_deps = [
17
+ ['newgem', ">= #{::Newgem::VERSION}"]
18
+ ]
19
+
20
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
21
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
22
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
23
+ p.rsync_args = '-av --delete --ignore-errors'
24
+ end
25
+
26
+ require 'newgem/tasks'
27
+ Dir['tasks/**/*.rake'].each { |t| load t }
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,99 @@
1
+ require 'rubygems'
2
+ require 'autotest'
3
+
4
+ $:.unshift(File.dirname(__FILE__)) unless
5
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
6
+
7
+ ##
8
+ # Autotest::Growl
9
+ #
10
+ # == FEATUERS:
11
+ # * Display autotest results as local or remote Growl notifications.
12
+ # * Clean the terminal on every test cycle while maintaining scrollback.
13
+ #
14
+ # == SYNOPSIS:
15
+ # ~/.autotest
16
+ # require 'autotest/growl'
17
+ module Autotest::Growl
18
+
19
+ VERSION = '0.1.0'
20
+ GEM_PATH = File.expand_path(File.join(File.dirname(__FILE__), '../..'))
21
+
22
+ @@remote_notification = false
23
+ @@hide_label = false
24
+
25
+ ##
26
+ # Whether to use remote or local notificaton (default).
27
+ def self.remote_notification=(boolean)
28
+ @@remote_notification = boolean
29
+ end
30
+
31
+ ##
32
+ # Whether to display the label (default) or not.
33
+ def self.hide_label=(boolean)
34
+ @@hide_label = boolean
35
+ end
36
+
37
+ ##
38
+ # Display a message through Growl.
39
+ def self.growl title, message, icon, priority=0, stick=""
40
+ growl = File.join(GEM_PATH, 'growl', 'growlnotify')
41
+ image = File.join(ENV['HOME'], '.autotest-growl', "#{icon}.png")
42
+ image = File.join(GEM_PATH, 'img', "#{icon}.png") unless File.exists?(image)
43
+ if @@remote_notification
44
+ system "#{growl} -H localhost -n autotest --image '#{image}' -p #{priority} -m #{message.inspect} '#{title}' #{stick}"
45
+ else
46
+ system "#{growl} -n autotest --image '#{image}' -p #{priority} -m #{message.inspect} '#{title}' #{stick}"
47
+ end
48
+ end
49
+
50
+ ##
51
+ # Set the label and clear the terminal.
52
+ Autotest.add_hook :run_command do
53
+ @label = (@@hide_label) ? ('') : (File.basename(Dir.pwd).upcase + ': ')
54
+ @run_scenarios = false
55
+ print "\n"*2 + '-'*80 + "\n"*2
56
+ print "\e[2J\e[f" # clear the terminal
57
+ false
58
+ end
59
+
60
+ ##
61
+ # Parse the test results and send them to Growl.
62
+ Autotest.add_hook :ran_command do |autotest|
63
+ gist = autotest.results.grep(/\d+\s+(example|test)s?/).map {|s| s.gsub(/(\e.*?m|\n)/, '') }.join(" / ")
64
+ if gist == ''
65
+ growl @label + 'Cannot run tests.', '', 'error'
66
+ else
67
+ if gist =~ /[1-9]\d*\s+(failure|error)/
68
+ growl @label + 'Some tests have failed.', gist, 'failed'
69
+ elsif gist =~ /pending/
70
+ growl @label + 'Some tests are pending.', gist, 'pending'
71
+ @run_scenarios = true
72
+ else
73
+ growl @label + 'All tests have passed.', gist, 'passed'
74
+ @run_scenarios = true
75
+ end
76
+ end
77
+ false
78
+ end
79
+
80
+ # FIXME: This is a temporary workaround until Cucumber is properly integrated!
81
+ Autotest.add_hook :waiting do |autotest|
82
+ if @run_scenarios && autotest.results.grep(/cucumber/)
83
+ gist = autotest.results.grep(/\d+\s+(scenario|step)s?/).map {|s| s.gsub(/(\e.*?m|\n)/, '') }.join(" / ")
84
+ if gist == ''
85
+ growl @label + 'Cannot run scenarios.', '', 'error'
86
+ else
87
+ if gist =~ /failed/
88
+ growl @label + 'Some scenarios have failed.', gist, 'failed'
89
+ elsif gist =~ /undefined/
90
+ growl @label + 'Some scenarios are undefined.', gist, 'pending'
91
+ else
92
+ growl @label + 'All scenarios have passed.', gist, 'passed'
93
+ end
94
+ end
95
+ end
96
+ false
97
+ end
98
+
99
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/autotest-growl.rb'}"
9
+ puts "Loading autotest-growl gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'autotest-growl'
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: autotest-growl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sven Schwyn
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-28 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: ZenTest
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 4.0.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: newgem
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.1
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.8.0
44
+ version:
45
+ description: This gem aims to improve support for Growl notification by ZenTest's autotest. It comes with a nice colored Ruby icon set and - for now - supports Cucumber by means of a workaround.
46
+ email:
47
+ - ruby@bitcetera.com
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ extra_rdoc_files:
53
+ - History.txt
54
+ - Manifest.txt
55
+ - PostInstall.txt
56
+ - README.rdoc
57
+ files:
58
+ - History.txt
59
+ - Manifest.txt
60
+ - PostInstall.txt
61
+ - README.rdoc
62
+ - Rakefile
63
+ - growl/growlnotify
64
+ - img/error.png
65
+ - img/failed.png
66
+ - img/passed.png
67
+ - img/pending.png
68
+ - lib/autotest/growl.rb
69
+ - script/console
70
+ - script/destroy
71
+ - script/generate
72
+ - spec/autotest-growl_spec.rb
73
+ - spec/spec.opts
74
+ - spec/spec_helper.rb
75
+ - tasks/rspec.rake
76
+ has_rdoc: true
77
+ homepage: http://www.bitcetera.com/products/autotest-growl
78
+ licenses: []
79
+
80
+ post_install_message: |+
81
+
82
+ +--------------------------------------------------------------------------+
83
+ | |
84
+ | In order to use autotest-growl, the following line has to be added |
85
+ | to the top of ~/.autotest file: |
86
+ | |
87
+ | require 'autotest/growl' |
88
+ | |
89
+ | IMPORTANT: If you use ZenTest-4.0.0, this won't work. See the README |
90
+ | for further instructions. |
91
+ | |
92
+ | Make sure Growl is installed on your computer. Download it from: |
93
+ | |
94
+ | http://growl.info |
95
+ | |
96
+ | If Growl notifications are not always displayed, take a look at the |
97
+ | README for help. |
98
+ | |
99
+ | For more information, feedback and bug submissions, please visit: |
100
+ | |
101
+ | See http://www.bitcetera.com/products/autotest-growl |
102
+ | |
103
+ +--------------------------------------------------------------------------+
104
+
105
+ rdoc_options:
106
+ - --main
107
+ - README.rdoc
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: "0"
115
+ version:
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: "0"
121
+ version:
122
+ requirements: []
123
+
124
+ rubyforge_project: autotest-growl
125
+ rubygems_version: 1.3.3
126
+ signing_key:
127
+ specification_version: 3
128
+ summary: Next generation Growl notification support for ZenTest's autotest.
129
+ test_files: []
130
+