autotest-mac 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/Manifest.txt +18 -0
- data/PostInstall.txt +24 -0
- data/README.rdoc +96 -0
- data/Rakefile +27 -0
- data/fsevent/fsevent_sleep +0 -0
- data/img/ruby_green.png +0 -0
- data/img/ruby_grey.png +0 -0
- data/img/ruby_red.png +0 -0
- data/img/ruby_yellow.png +0 -0
- data/lib/autotest-mac.rb +89 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/autotest-mac_spec.rb +11 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -0
- data/tasks/rspec.rake +21 -0
- metadata +106 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
PostInstall.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
fsevent/fsevent_sleep
|
7
|
+
img/ruby_green.png
|
8
|
+
img/ruby_grey.png
|
9
|
+
img/ruby_red.png
|
10
|
+
img/ruby_yellow.png
|
11
|
+
lib/autotest-mac.rb
|
12
|
+
script/console
|
13
|
+
script/destroy
|
14
|
+
script/generate
|
15
|
+
spec/autotest-mac_spec.rb
|
16
|
+
spec/spec.opts
|
17
|
+
spec/spec_helper.rb
|
18
|
+
tasks/rspec.rake
|
data/PostInstall.txt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
In order to use autotest-mac, the following line has to be added to the top
|
3
|
+
of your ~/.autotest file:
|
4
|
+
|
5
|
+
require 'autotest-mac'
|
6
|
+
|
7
|
+
Make sure Growl is installed on your computer. You can download it from:
|
8
|
+
|
9
|
+
http://growl.info
|
10
|
+
|
11
|
+
A glitch in Growl 1.1.4 on Mac OS X 10.5 randomly prevents some notifications
|
12
|
+
from being displayed. A workaround is built into autotest-mac, however, you
|
13
|
+
have to perform some additional steps to make it work:
|
14
|
+
|
15
|
+
Open “System Preferences -> Growl -> Network" and set the checkboxes "Listen
|
16
|
+
for incoming notifications" and "Allow remote application registration”. Once
|
17
|
+
the first notification has been displayed, you can unset the latter checkbox
|
18
|
+
again.
|
19
|
+
|
20
|
+
For more information, feedback and bug submissions, please visit:
|
21
|
+
|
22
|
+
See http://www.bitcetera.com/products/mac-autotest
|
23
|
+
|
24
|
+
|
data/README.rdoc
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
= Autotest for Mac
|
2
|
+
|
3
|
+
* Homepage: http://www.bitcetera.com/products/autotest-mac
|
4
|
+
* Issues and forum: https://forge.bitcetera.com/projects/show/autotest-mac
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
The autotest-mac gem contains a set of improvements for ZenTest's autotest
|
9
|
+
on Mac OS X. It's absolutely useless on any other platform.
|
10
|
+
|
11
|
+
== FEATURES:
|
12
|
+
|
13
|
+
=== FSEvent
|
14
|
+
|
15
|
+
ZenTest's autotest relies on filesystem polling to detect modifications in
|
16
|
+
source code files. In other words: The filesytem is constantly being traversed
|
17
|
+
which causes quite some load on both the CPU and the harddrive. This is not
|
18
|
+
healthy for your Mac and if you are working on a portable computer, it will
|
19
|
+
drain your battery in no time. Apple has introduces FSEvent with Mac OS X 10.5
|
20
|
+
which is a very efficient way to have the operating system monitor file
|
21
|
+
alterations. This gem teaches autotest to use FSEvent and therefore be nice
|
22
|
+
to your Mac.
|
23
|
+
|
24
|
+
=== Test/Scenario Results
|
25
|
+
|
26
|
+
With autotest-mac the terminal running autotest is cleared on every cycle. You
|
27
|
+
can, however, scroll up and see the output of previous cycles. Furthermore,
|
28
|
+
autotest-mac configures autotest to display test (RSpec and Test::Unit) and
|
29
|
+
scenario (Cubumber) results as Growl notifications, decorated with a cute set
|
30
|
+
of colored ruby icons.
|
31
|
+
|
32
|
+
Please note that autotest does not yet fully support Cucumber and therefore
|
33
|
+
autotest-mac has to use a workaround which may cause issues if you are using
|
34
|
+
custom :waiting hooks.
|
35
|
+
|
36
|
+
=== Exceptions
|
37
|
+
|
38
|
+
The following directories are added as exceptions by mac-autotest and thus
|
39
|
+
won't be monitored:
|
40
|
+
* .svn
|
41
|
+
* .hg
|
42
|
+
* .git
|
43
|
+
* vendor
|
44
|
+
|
45
|
+
== REQUIREMENTS:
|
46
|
+
|
47
|
+
* Mac OS X >= 10.5 (for FSEvent instead of filesystem polling)
|
48
|
+
* Growl
|
49
|
+
* ZenTest >= 4.0.0
|
50
|
+
|
51
|
+
== INSTALL:
|
52
|
+
|
53
|
+
First install the gem:
|
54
|
+
|
55
|
+
sudo gem install autotest-mac
|
56
|
+
|
57
|
+
Then add the following line to the top of your ~/.autotest file:
|
58
|
+
|
59
|
+
require 'autotest-mac'
|
60
|
+
|
61
|
+
Make sure Growl is installed on your computer. You can download it from
|
62
|
+
http://growl.info
|
63
|
+
|
64
|
+
A glitch in Growl 1.1.4 on Mac OS X 10.5 randomly prevents some notifications
|
65
|
+
from being displayed. A workaround is built into autotest-mac, however, you
|
66
|
+
have to perform some additional steps to make it work:
|
67
|
+
|
68
|
+
Open “System Preferences -> Growl -> Network" and set the checkboxes "Listen
|
69
|
+
for incoming notifications" and "Allow remote application registration”. Once
|
70
|
+
the first notification has been displayed, you can unset the latter checkbox
|
71
|
+
again.
|
72
|
+
|
73
|
+
== LICENSE:
|
74
|
+
|
75
|
+
(The MIT License)
|
76
|
+
|
77
|
+
Copyright (c) 2009 Sven Schwyn
|
78
|
+
|
79
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
80
|
+
a copy of this software and associated documentation files (the
|
81
|
+
'Software'), to deal in the Software without restriction, including
|
82
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
83
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
84
|
+
permit persons to whom the Software is furnished to do so, subject to
|
85
|
+
the following conditions:
|
86
|
+
|
87
|
+
The above copyright notice and this permission notice shall be
|
88
|
+
included in all copies or substantial portions of the Software.
|
89
|
+
|
90
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
91
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
92
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
93
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
94
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
95
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
96
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -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-mac'
|
4
|
+
|
5
|
+
$hoe = Hoe.new('autotest-mac', AutotestMac::VERSION) do |p|
|
6
|
+
p.developer('Sven Schwyn', 'ruby@bitcetera.com')
|
7
|
+
p.summary = %q{Mac OS X only set of improvements for ZenTest's autotest.}
|
8
|
+
p.description = %q{ZenTest's autotest relies on filesystem polling to detect modifications in source code files. This is both CPU expensive and unnecessary on Mac OS X 10.5 or higher which comes with the very efficient FSEvent core service for this purpose. This extension teaches autotest to use FSEvent and furthermore hooks autotest up to Growl for displaying the test results.}
|
9
|
+
p.url = %q{http://www.bitcetera.com/en/products/autotest-mac}
|
10
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
11
|
+
p.post_install_message = '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
|
data/img/ruby_green.png
ADDED
Binary file
|
data/img/ruby_grey.png
ADDED
Binary file
|
data/img/ruby_red.png
ADDED
Binary file
|
data/img/ruby_yellow.png
ADDED
Binary file
|
data/lib/autotest-mac.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'autotest'
|
2
|
+
|
3
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
4
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
5
|
+
|
6
|
+
unless RUBY_PLATFORM =~ /darwin/
|
7
|
+
puts "The autotest-mac gem is for Mac OS X only and thus useless on this platform."
|
8
|
+
exit 1
|
9
|
+
end
|
10
|
+
|
11
|
+
module AutotestMac
|
12
|
+
|
13
|
+
VERSION = '0.1.0'
|
14
|
+
GEM_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
15
|
+
|
16
|
+
module Autotest::Growl
|
17
|
+
|
18
|
+
##
|
19
|
+
# Display a message through Growl.
|
20
|
+
def self.growl title, message, color, priority=0, stick=""
|
21
|
+
icon = File.join(GEM_DIR, 'img', "ruby_#{color}.png")
|
22
|
+
system "growlnotify -H localhost -n autotest --image '#{icon}' -p #{priority} -m #{message.inspect} '#{title}' #{stick}"
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Set the label and clear the terminal.
|
27
|
+
Autotest.add_hook :run_command do
|
28
|
+
@label = File.basename(Dir.pwd).upcase
|
29
|
+
@run_scenarios = false
|
30
|
+
print "\n"*2 + '-'*80 + "\n"*2
|
31
|
+
print "\e[2J\e[f" # clear the terminal
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# Parse the test results and send them to Growl.
|
36
|
+
Autotest.add_hook :ran_command do |autotest|
|
37
|
+
gist = autotest.results.grep(/\d+\s+(example|test)s?/).map {|s| s.gsub(/(\e.*?m|\n)/, '') }.join(" / ")
|
38
|
+
if gist == ''
|
39
|
+
growl "#{@label} cannot run tests", '', 'grey'
|
40
|
+
else
|
41
|
+
if gist =~ /[1-9]\d*\s+(failure|error)/
|
42
|
+
growl "#{@label} fails some tests", "#{gist}", 'red'
|
43
|
+
elsif gist =~ /pending/
|
44
|
+
growl "#{@label} has pending tests", "#{gist}", 'yellow'
|
45
|
+
@run_scenarios = true
|
46
|
+
else
|
47
|
+
growl "#{@label} passes all tests", "#{gist}", 'green'
|
48
|
+
@run_scenarios = true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# FIXME: This is a temporary workaround until Cucumber is properly integrated!
|
54
|
+
Autotest.add_hook :waiting do |autotest|
|
55
|
+
if @run_scenarios
|
56
|
+
gist = autotest.results.grep(/\d+\s+(scenario|step)s?/).map {|s| s.gsub(/(\e.*?m|\n)/, '') }.join(" / ")
|
57
|
+
if gist == ''
|
58
|
+
growl "#{@label} cannot run scenarios", '', 'grey'
|
59
|
+
else
|
60
|
+
if gist =~ /failed/
|
61
|
+
growl "#{@label} fails some scenarios", "#{gist}", 'red'
|
62
|
+
elsif gist =~ /undefined/
|
63
|
+
growl "#{@label} has undefined scenarios", "#{gist}", 'yellow'
|
64
|
+
else
|
65
|
+
growl "#{@label} passes all scenarios", "#{gist}", 'green'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
##
|
74
|
+
# Add some exceptions
|
75
|
+
Autotest.add_hook :initialize do |autotest|
|
76
|
+
%w{.svn .hg .git vendor}.each {|exception| autotest.add_exception(exception) }
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# Use FSEvent if possible
|
81
|
+
Autotest.add_hook :waiting do |autotest|
|
82
|
+
if RUBY_PLATFORM.sub(/^.*?darwin(\d+)$/, '\1').to_i >= 9 # Darwin 9 alias Mac OS X 10.5 or above only
|
83
|
+
`#{File.join(GEM_DIR, 'fsevent', 'fsevent_sleep')} '#{Dir.pwd}' 2>&1`
|
84
|
+
else
|
85
|
+
puts "\nautotest-mac: FSEvent not available, falling back to filesystem polling."
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
data/script/console
ADDED
@@ -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-mac.rb'}"
|
9
|
+
puts "Loading autotest-mac gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -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)
|
data/script/generate
ADDED
@@ -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)
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
data/tasks/rspec.rake
ADDED
@@ -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,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: autotest-mac
|
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-26 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: ZenTest's autotest relies on filesystem polling to detect modifications in source code files. This is both CPU expensive and unnecessary on Mac OS X 10.5 or higher which comes with the very efficient FSEvent core service for this purpose. This extension teaches autotest to use FSEvent and furthermore hooks autotest up to Growl for displaying the test results.
|
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
|
+
- fsevent/fsevent_sleep
|
64
|
+
- img/ruby_green.png
|
65
|
+
- img/ruby_grey.png
|
66
|
+
- img/ruby_red.png
|
67
|
+
- img/ruby_yellow.png
|
68
|
+
- lib/autotest-mac.rb
|
69
|
+
- script/console
|
70
|
+
- script/destroy
|
71
|
+
- script/generate
|
72
|
+
- spec/autotest-mac_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/en/products/autotest-mac
|
78
|
+
licenses: []
|
79
|
+
|
80
|
+
post_install_message: PostInstall.txt
|
81
|
+
rdoc_options:
|
82
|
+
- --main
|
83
|
+
- README.rdoc
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: "0"
|
91
|
+
version:
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: "0"
|
97
|
+
version:
|
98
|
+
requirements: []
|
99
|
+
|
100
|
+
rubyforge_project: autotest-mac
|
101
|
+
rubygems_version: 1.3.3
|
102
|
+
signing_key:
|
103
|
+
specification_version: 3
|
104
|
+
summary: Mac OS X only set of improvements for ZenTest's autotest.
|
105
|
+
test_files: []
|
106
|
+
|