guard-minitest 0.2.2 → 0.3.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.
- data/README.rdoc +20 -2
- data/lib/guard/minitest.rb +6 -5
- data/lib/guard/minitest/notifier.rb +22 -24
- data/lib/guard/minitest/runner.rb +57 -34
- data/lib/guard/minitest/runners/default_runner.rb +1 -1
- data/lib/guard/minitest/version.rb +1 -1
- metadata +11 -9
data/README.rdoc
CHANGED
@@ -49,18 +49,36 @@ Please read {guard doc}[http://github.com/guard/guard#readme] for more info abou
|
|
49
49
|
|
50
50
|
== Options
|
51
51
|
|
52
|
-
You can force seed
|
52
|
+
You can force minitest seed with:
|
53
53
|
|
54
54
|
guard 'minitest', :seed => 12345 do
|
55
55
|
...
|
56
56
|
end
|
57
57
|
|
58
|
-
You can set verbose mode
|
58
|
+
You can set minitest verbose mode with:
|
59
59
|
|
60
60
|
guard 'minitest', :verbose => true do
|
61
61
|
...
|
62
62
|
end
|
63
63
|
|
64
|
+
You can disable desktop notification with:
|
65
|
+
|
66
|
+
guard 'minitest', :notify => false do
|
67
|
+
...
|
68
|
+
end
|
69
|
+
|
70
|
+
You can disable bundler usage to run minitest with:
|
71
|
+
|
72
|
+
guard 'minitest', :bundler => false do
|
73
|
+
...
|
74
|
+
end
|
75
|
+
|
76
|
+
You can enable rubygems usage to run minitest (only if bundler is not present or disabale) with:
|
77
|
+
|
78
|
+
guard 'minitest', :rubygems => true do
|
79
|
+
...
|
80
|
+
end
|
81
|
+
|
64
82
|
== Development
|
65
83
|
|
66
84
|
- Source hosted at {GitHub}[http://github.com/guard/guard-minitest]
|
data/lib/guard/minitest.rb
CHANGED
@@ -7,21 +7,22 @@ module Guard
|
|
7
7
|
|
8
8
|
autoload :Runner, 'guard/minitest/runner'
|
9
9
|
autoload :Inspector, 'guard/minitest/inspector'
|
10
|
-
autoload :Notifier, 'guard/minitest/notifier'
|
11
10
|
|
12
11
|
def start
|
13
|
-
Runner.
|
14
|
-
|
12
|
+
@runner ||= Runner.new(options)
|
13
|
+
true
|
15
14
|
end
|
16
15
|
|
17
16
|
def run_all
|
18
17
|
paths = Inspector.clean(['test', 'spec'])
|
19
|
-
|
18
|
+
return @runner.run(paths, :message => 'Running all tests') unless paths.empty?
|
19
|
+
true
|
20
20
|
end
|
21
21
|
|
22
22
|
def run_on_change(paths = [])
|
23
23
|
paths = Inspector.clean(paths)
|
24
|
-
|
24
|
+
return @runner.run(paths) unless paths.empty?
|
25
|
+
true
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
@@ -1,35 +1,33 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Guard
|
3
|
-
class
|
4
|
-
class Notifier
|
3
|
+
class MinitestNotifier
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
message << "\nin %.6f seconds, %.4f tests/s, %.4f assertions/s." % [duration, test_count / duration, assertion_count / duration]
|
12
|
-
message
|
5
|
+
def self.guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
|
6
|
+
message = "#{test_count} examples, #{assertion_count} assertions, #{failure_count} failures, #{error_count} errors"
|
7
|
+
if skip_count > 0
|
8
|
+
message << " (#{skip_count} skips)"
|
13
9
|
end
|
10
|
+
message << "\nin %.6f seconds, %.4f tests/s, %.4f assertions/s." % [duration, test_count / duration, assertion_count / duration]
|
11
|
+
message
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
14
|
+
# failed | pending (skip) | success
|
15
|
+
def self.guard_image(failure_count, skip_count)
|
16
|
+
icon = if failure_count > 0
|
17
|
+
:failed
|
18
|
+
elsif skip_count > 0
|
19
|
+
:pending
|
20
|
+
else
|
21
|
+
:success
|
24
22
|
end
|
23
|
+
end
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
::Guard::Notifier.notify(message, :title => 'MiniTest results', :image => image)
|
31
|
-
end
|
25
|
+
def self.notify(test_count, assertion_count, failure_count, error_count, skip_count, duration)
|
26
|
+
message = guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
|
27
|
+
image = guard_image(failure_count + error_count, skip_count)
|
32
28
|
|
29
|
+
::Guard::Notifier.notify(message, :title => 'MiniTest results', :image => image)
|
33
30
|
end
|
31
|
+
|
34
32
|
end
|
35
33
|
end
|
@@ -2,50 +2,73 @@
|
|
2
2
|
module Guard
|
3
3
|
class Minitest
|
4
4
|
class Runner
|
5
|
+
|
5
6
|
class << self
|
6
|
-
attr_reader :seed
|
7
7
|
|
8
|
-
def
|
9
|
-
|
8
|
+
def run(paths = [], options = {})
|
9
|
+
Runner.new(options).run(paths, options)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
@verbose = !!options[:verbose]
|
14
|
-
end
|
12
|
+
end
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
def initialize(options = {})
|
15
|
+
@options = {
|
16
|
+
:verbose => false,
|
17
|
+
:notify => true,
|
18
|
+
:bundler => File.exist?("#{Dir.pwd}/Gemfile"),
|
19
|
+
:rubygems => false
|
20
|
+
}.merge(options)
|
21
|
+
end
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
def run(paths, options = {})
|
24
|
+
message = options[:message] || "Running: #{paths.join(' ')}"
|
25
|
+
UI.info message, :reset => true
|
26
|
+
system(minitest_command(paths))
|
27
|
+
end
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
cmd_parts = []
|
30
|
-
cmd_parts << "bundle exec" if bundler?
|
31
|
-
cmd_parts << 'ruby -Itest -Ispec'
|
32
|
-
cmd_parts << '-r bundler/setup' if bundler?
|
33
|
-
paths.each do |path|
|
34
|
-
cmd_parts << "-r #{path}"
|
35
|
-
end
|
36
|
-
cmd_parts << "-r #{File.expand_path('../runners/default_runner.rb', __FILE__)}"
|
37
|
-
cmd_parts << '-e \'MiniTest::Unit.autorun\''
|
38
|
-
cmd_parts << '--'
|
39
|
-
cmd_parts << "--seed #{seed}" unless seed.nil?
|
40
|
-
cmd_parts << '--verbose' if verbose?
|
41
|
-
cmd_parts.join(' ')
|
42
|
-
end
|
29
|
+
def seed
|
30
|
+
@options[:seed]
|
31
|
+
end
|
43
32
|
|
44
|
-
|
45
|
-
|
46
|
-
|
33
|
+
def verbose?
|
34
|
+
@options[:verbose]
|
35
|
+
end
|
47
36
|
|
37
|
+
def notify?
|
38
|
+
@options[:notify]
|
48
39
|
end
|
40
|
+
|
41
|
+
def bundler?
|
42
|
+
@options[:bundler]
|
43
|
+
end
|
44
|
+
|
45
|
+
def rubygems?
|
46
|
+
!bundler? && @options[:rubygems]
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def minitest_command(paths)
|
52
|
+
cmd_parts = []
|
53
|
+
cmd_parts << "bundle exec" if bundler?
|
54
|
+
cmd_parts << 'ruby -Itest -Ispec'
|
55
|
+
cmd_parts << '-r rubygems' if rubygems?
|
56
|
+
cmd_parts << '-r bundler/setup' if bundler?
|
57
|
+
paths.each do |path|
|
58
|
+
cmd_parts << "-r #{path}"
|
59
|
+
end
|
60
|
+
cmd_parts << "-r #{File.expand_path('../runners/default_runner.rb', __FILE__)}"
|
61
|
+
if notify?
|
62
|
+
cmd_parts << '-e \'GUARD_NOTIFY=true; MiniTest::Unit.autorun\''
|
63
|
+
else
|
64
|
+
cmd_parts << '-e \'GUARD_NOTIFY=false; MiniTest::Unit.autorun\''
|
65
|
+
end
|
66
|
+
cmd_parts << '--'
|
67
|
+
cmd_parts << "--seed #{seed}" unless seed.nil?
|
68
|
+
cmd_parts << '--verbose' if verbose?
|
69
|
+
cmd_parts.join(' ')
|
70
|
+
end
|
71
|
+
|
49
72
|
end
|
50
73
|
end
|
51
74
|
end
|
@@ -54,7 +54,7 @@ module MiniTest
|
|
54
54
|
@@out.puts
|
55
55
|
|
56
56
|
status
|
57
|
-
Guard::
|
57
|
+
Guard::MinitestNotifier.notify(test_count, assertion_count, failures, errors, skips, duration) if GUARD_NOTIFY
|
58
58
|
|
59
59
|
@@out.puts
|
60
60
|
@@out.puts "Test run options: #{help}"
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Yann Lugrin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-27 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 19
|
30
30
|
segments:
|
31
31
|
- 0
|
32
32
|
- 2
|
33
|
-
-
|
34
|
-
version: 0.2.
|
33
|
+
- 2
|
34
|
+
version: 0.2.2
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -106,8 +106,10 @@ homepage: http://rubygems.org/gems/guard-minitest
|
|
106
106
|
licenses: []
|
107
107
|
|
108
108
|
post_install_message:
|
109
|
-
rdoc_options:
|
110
|
-
|
109
|
+
rdoc_options:
|
110
|
+
- --charset=UTF-8
|
111
|
+
- --main=README.rdoc
|
112
|
+
- --exclude='(lib|test|spec)|(Gem|Guard|Rake)file'
|
111
113
|
require_paths:
|
112
114
|
- lib
|
113
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|