autotest-standalone 4.5.0 → 4.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -58,6 +58,7 @@ begin
58
58
  gem.summary = "Autotest, without ZenTest"
59
59
  gem.homepage = "http://github.com/grosser/autotest"
60
60
  gem.authors = ["Ryan Davis", "Michael Grosser"]
61
+ gem.files << 'lib/autotest/notify.rb'
61
62
  end
62
63
 
63
64
  Jeweler::GemcutterTasks.new
data/Readme.md CHANGED
@@ -1,4 +1,4 @@
1
- Standalone autotest extracted from ZenTest.
1
+ Standalone autotest extracted from ZenTest.
2
2
 
3
3
  As soon as you save a file, autotest will run the matching tests.
4
4
 
@@ -9,6 +9,7 @@ Improvements over ZenTest
9
9
  - `-p` use parallel_tests to run tests (Test::Unit only)
10
10
  - `-s` use any style you want -> `alias autospec2="autotest --style rspec2"`
11
11
  - `-b` use bundle exec to run tests
12
+ - `-n` notify about results (simple + experimental)
12
13
  - simplified test setup
13
14
  - simplified packaging
14
15
  - less globals
@@ -19,7 +20,7 @@ Install
19
20
  sudo gem uninstall ZenTest
20
21
  sudo gem install autotest-standalone
21
22
 
22
- Optional: Support for Test::Unit on Rails
23
+ Optional: [Autotest for Test::Unit on Rails](https://github.com/grosser/autotest-rails)
23
24
  sudo gem install autotest-rails-pure
24
25
  Optional: [ZenTest without Autotest](http://github.com/grosser/zentest) version:
25
26
  sudo gem install zentest-without-autotest
@@ -39,6 +40,7 @@ Usage
39
40
  -r, --rc CONFIG Path to config file. (Defaults to ~/.autotest or current_dir/.autotest)
40
41
  -s, --style STYLE Which style to use, e.g. rspec, rspec2
41
42
  -b, --bundle-exec Use bundle exec to run tests
43
+ -n, --notify Notify about success and failure via popups
42
44
  -h, --help Show this.
43
45
 
44
46
  Windows needs [diff.exe](http://gnuwin32.sourceforge.net/packages.html)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.5.0
1
+ 4.5.1
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{autotest-standalone}
8
- s.version = "4.5.0"
8
+ s.version = "4.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Davis", "Michael Grosser"]
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  "lib/autotest.rb",
29
29
  "lib/autotest/autoupdate.rb",
30
30
  "lib/autotest/bundler.rb",
31
+ "lib/autotest/notify.rb",
31
32
  "lib/autotest/once.rb",
32
33
  "lib/autotest/rcov.rb",
33
34
  "lib/autotest/restart.rb",
@@ -136,6 +136,10 @@ class Autotest
136
136
  require 'autotest/bundler'
137
137
  end
138
138
 
139
+ opts.on("-n", "--notify", "Notify about success and failure via popups") do
140
+ require 'autotest/notify'
141
+ end
142
+
139
143
  opts.on "-h", "--help", "Show this." do
140
144
  puts opts
141
145
  exit 1
@@ -0,0 +1,46 @@
1
+ class Autotest
2
+ class Notify
3
+ def self.notify(state)
4
+ title = "#{state.to_s.capitalize} -- Autotest"
5
+
6
+ command = case RUBY_PLATFORM
7
+ when /linux/
8
+ title = "'#{title}'"
9
+ case linux_lib
10
+ when :'notify-send' then "#{linux_lib} #{title}"
11
+ when :kdialog then "#{linux_lib} --title #{title}"
12
+ when :zenity then "#{linux_lib} --title #{title}"
13
+ end
14
+ when /darwin/
15
+ "growlnotify -n autotest -t #{title}"
16
+ when /cygwin/
17
+ "sncmd /m '#{title}'"
18
+ when /mswin/
19
+ require 'snarl'
20
+ Snarl.show_message(title)
21
+ end
22
+
23
+ system command
24
+ end
25
+
26
+ private
27
+
28
+ def self.linux_lib
29
+ libs = [:'notify-send', :kdialog, :zenity]
30
+ @@linux_lib ||= libs.detect do |l|
31
+ system("which #{l} > /dev/null 2>&1")
32
+ end or puts("Install one of #{libs.join(', ')} to get notified")
33
+ end
34
+ end
35
+ end
36
+
37
+ [:red, :green, :all_good].each do |hook|
38
+ Autotest.add_hook hook do
39
+ begin
40
+ Autotest::Notify.notify(hook)
41
+ rescue Exception => e # errors in autotest would fail silently
42
+ puts e.to_s
43
+ puts e.backtrace
44
+ end
45
+ end
46
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autotest-standalone
3
3
  version: !ruby/object:Gem::Version
4
- hash: 43
4
+ hash: 41
5
5
  prerelease: false
6
6
  segments:
7
7
  - 4
8
8
  - 5
9
- - 0
10
- version: 4.5.0
9
+ - 1
10
+ version: 4.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -46,6 +46,7 @@ files:
46
46
  - lib/autotest.rb
47
47
  - lib/autotest/autoupdate.rb
48
48
  - lib/autotest/bundler.rb
49
+ - lib/autotest/notify.rb
49
50
  - lib/autotest/once.rb
50
51
  - lib/autotest/rcov.rb
51
52
  - lib/autotest/restart.rb