guard-minitest 1.0.0.beta1 → 1.0.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0bcd2150ad6d82a9346b585f9070df25e67ef74c
4
+ data.tar.gz: 274627dde2b37eb4b89a2e414b1466f6a183da3e
5
+ SHA512:
6
+ metadata.gz: fd9a40805f36b9dfe2e82712ab3cb27c828d0d7277aeab6519306ceddd0f8d5d6d7dcfc82b5874d2d4094d9d73d16f72c65ca9b27be482c28004334533bba7f6
7
+ data.tar.gz: c4b41126138fecaa381207877bb3969c581bc2671fffa9c6e573aa5ed63e4494a5f2d3be90386fe58552c9e23fd482063322f141e3ea463f23ad329053847bae
@@ -1,77 +1,139 @@
1
- ## 1.0.0 (beta 1)
1
+ ## Unreleased Changes
2
+
3
+ [Full Changelog](https://github.com/guard/guard-minitest/compare/v1.0.0.beta.2...master)
4
+
5
+ ## 1.0.0.beta.2 - Jun 5, 2013
6
+
7
+ [Full Changelog](https://github.com/guard/guard-minitest/compare/v1.0.0.beta1...v1.0.0.beta.2)
8
+
9
+ ### Improvements
10
+
11
+ * [#62][] Add notification when `spring` is used. ([@rymai][])
12
+ * [#39][] Fix `watch` `Regex` for `lib` directory. ([@rymai][])
13
+ * [#51][] Add color using the pride Minitest plugin (`--pride` option). ([@rymai][])
14
+ * [#59][] Update spring command from test to testunit. ([@sbrink][])
15
+ * [#57][] Added support for spring. ([@aspiers][])
16
+ * [#56][] Include test directory in load path when DRb used. ([@sbleon][])
17
+ * [#54][] Added support for zeus. ([@leemhenson][])
18
+ * [#55][] Add `:all_on_start` option. ([@aflock][])
19
+ * [#41][] Simplifying the DRb version of the runner. ([@chadoh][])
20
+ * [#38][] Improves notification message formatting. ([@arronmabrey][])
21
+
22
+ ## 1.0.0.beta1 - Dec 10, 2012
23
+
24
+ [Full Changelog](https://github.com/guard/guard-minitest/compare/0.5.0...v1.0.0.beta1)
25
+
26
+ ### Improvements
2
27
 
3
28
  Upgrade to match Guard 1.1 API:
4
29
 
5
- * Deprecate `:notify` option, use guard notification configuration (Yann
6
- Lugrin)
7
- * Use `guard_on_change` method (Jason Staten)
30
+ * Deprecate the `:notify` option. Use Guard notification configuration instead ([via the CLI](https://github.com/guard/guard#-n--notify-option) or [via the Guardfile](https://github.com/guard/guard#notification)) ([@yannlugrin][])
31
+ * [#45][] Use `run_on_changes` method. ([@statianzo][])
32
+
33
+ ### New feature
34
+
35
+ * Add `:cli` option and deprecate `:seed` and `:verbose` options ([@yannlugrin][])
36
+
37
+ ### Improvements
38
+
39
+ * [#49][] Update Guardfile template for Rails 4. ([@itzki][])
40
+ * [#43][] & [#46][] Fix README links. ([@manewitz][] & [@sometimesfood][])
41
+
42
+ ## 0.5.0 - Feb 24, 2012
8
43
 
9
- Features:
44
+ [Full Changelog](https://github.com/guard/guard-minitest/compare/0.4.0...0.5.0)
10
45
 
11
- * Add `:cli` option and deprecate `:seed` and `:verbose` options (Yann
12
- Lugrin)
46
+ ### Bug fixes
13
47
 
14
- Documentation:
48
+ * Hard coded tests folders path. (Nathan Youngman)
49
+ * Watch subfolder in Guardfile template. (Wilker Lúcio, Mark Kremer)
50
+ * Notifications work with DRb. (Brian Morearty)
51
+ * Initialized constant with Ruby 1.9. (Jonas Grimfelt)
15
52
 
16
- * Update Guardfile template for Rails 4 (itzki)
17
- * Fix README links (Mike Manewitz & Sebastian Boehm)
53
+ ### New features
18
54
 
19
- ## 0.5.0 (Feb 24, 2012)
55
+ * Option to overwrite test folders and test files pattern. ([@japgolly][])
20
56
 
21
- Bug Fixes:
57
+ ## 0.4.0 - Jun 15, 2011
22
58
 
23
- * Hard coded tests folders path (Nathan Youngman)
24
- * Watch subfolder in Guardfile template (Wilker Lúcio, Mark Kremer)
25
- * Notification work with DRB (Brian Morearty)
26
- * Initialized constant with ruby 1.9 (Jonas Grimfelt)
59
+ [Full Changelog](https://github.com/guard/guard-minitest/compare/0.3.0...0.4.0)
27
60
 
28
- Features:
61
+ ### New features
29
62
 
30
- * Option to overwrite test folders and test files pattern (japgolly)
63
+ * Support of MiniTest 2. ([@yannlugrin][])
64
+ * DRB support. (Oriol Gual)
65
+ * Use regexp in Guardfile Template. (Emmanuel Gomez)
31
66
 
32
- ## 0.4.0 (Jun 15, 2011)
67
+ ### Improvement
33
68
 
34
- Features:
69
+ * Need guard 0.4 ([@yannlugrin][])
35
70
 
36
- * Support of MiniTest 2 (Yann Lugrin)
37
- * DRB support (Oriol Gual)
38
- * Use regexp in Guardfile Template (Emmanuel Gomez)
71
+ ## 0.3.0 - Oct 27, 2010
39
72
 
40
- Dependencies:
73
+ [Full Changelog](https://github.com/guard/guard-minitest/compare/0.2.2...0.3.0)
41
74
 
42
- * Need guard 0.4 (Yann Lugrin)
75
+ ### Bug fixes
43
76
 
44
- ## 0.3.0 (Oct 27, 2010)
77
+ * All guard API action return a boolean value
78
+ * Depends on guard 0.2.2 to fix darwin watching problems
45
79
 
46
- Bug Fixes:
80
+ ### New features
47
81
 
48
- * All guard API action return a boolean value
49
- * Depends on guard 0.2.2 to fix darwin watching problems
82
+ * Desktop notification can be disabled
83
+ * Bundler usage can be disabled
84
+ * Rubygems usage can be enable (only if bundler is not present or disable)
50
85
 
51
- Features:
86
+ ## 0.2.2 - Oct 24, 2010
52
87
 
53
- * Desktop notification can be disabled
54
- * Bundler usage can be disabled
55
- * Rubygems usage can be enable (only if bundler is not present or disable)
88
+ [Full Changelog](https://github.com/guard/guard-minitest/compare/0.2.1...0.2.2)
56
89
 
57
- ## 0.2.2 (Oct 24, 2010)
90
+ ### Bug fixes
58
91
 
59
- Bug Fixes:
92
+ * Depends on guard 0.2.1 to fix linux watching probalems
93
+ * Remove duplicate code
60
94
 
61
- * Depends on guard 0.2.1 to fix linux watching probalems
62
- * Remove duplicate code
95
+ ## 0.2.1 - Oct 22, 2010
63
96
 
64
- ## 0.2.1 (Oct 22, 2010)
97
+ [Full Changelog](https://github.com/guard/guard-minitest/compare/0.2.0...0.2.1)
65
98
 
66
- Bug Fixes:
99
+ ### Bug fixes
67
100
 
68
- * Don't set minitest seed option by default
101
+ * Don't set minitest seed option by default
69
102
 
70
- Documentation:
103
+ ### Improvement
71
104
 
72
- * Tested on ruby 1.8.6
105
+ * Tested on Ruby 1.8.6
73
106
 
74
- ## 0.2.0 (Oct 20, 2010)
107
+ ## 0.2.0 - Oct 20, 2010
75
108
 
76
- First stable release
109
+ First stable release.
77
110
 
111
+ <!--- The following link definition list is generated by PimpMyChangelog --->
112
+ [#38]: https://github.com/guard/guard/issues/38
113
+ [#39]: https://github.com/guard/guard/issues/39
114
+ [#41]: https://github.com/guard/guard/issues/41
115
+ [#43]: https://github.com/guard/guard/issues/43
116
+ [#45]: https://github.com/guard/guard/issues/45
117
+ [#46]: https://github.com/guard/guard/issues/46
118
+ [#49]: https://github.com/guard/guard/issues/49
119
+ [#51]: https://github.com/guard/guard/issues/51
120
+ [#54]: https://github.com/guard/guard/issues/54
121
+ [#55]: https://github.com/guard/guard/issues/55
122
+ [#56]: https://github.com/guard/guard/issues/56
123
+ [#57]: https://github.com/guard/guard/issues/57
124
+ [#59]: https://github.com/guard/guard/issues/59
125
+ [#62]: https://github.com/guard/guard/issues/62
126
+ [@aflock]: https://github.com/aflock
127
+ [@arronmabrey]: https://github.com/arronmabrey
128
+ [@aspiers]: https://github.com/aspiers
129
+ [@chadoh]: https://github.com/chadoh
130
+ [@itzki]: https://github.com/itzki
131
+ [@japgolly]: https://github.com/japgolly
132
+ [@leemhenson]: https://github.com/leemhenson
133
+ [@manewitz]: https://github.com/manewitz
134
+ [@rymai]: https://github.com/rymai
135
+ [@sbleon]: https://github.com/sbleon
136
+ [@sbrink]: https://github.com/sbrink
137
+ [@sometimesfood]: https://github.com/sometimesfood
138
+ [@statianzo]: https://github.com/statianzo
139
+ [@yannlugrin]: https://github.com/yannlugrin
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Yann Lugrin
1
+ Copyright (c) 2010-2012 Yann Lugrin, 2013 Rémy Coutable
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,112 +1,147 @@
1
- Guard::Minitest [![Build Status](https://secure.travis-ci.org/guard/guard-minitest.png?branch=master)](http://travis-ci.org/guard/guard-minitest)
2
- ===============
1
+ # Guard::Minitest
2
+ [![Gem Version](https://badge.fury.io/rb/guard-minitest.png)](http://badge.fury.io/rb/guard-minitest) [![Build Status](https://travis-ci.org/guard/guard-minitest.png?branch=master)](https://travis-ci.org/guard/guard-minitest) [![Dependency Status](https://gemnasium.com/guard/guard-minitest.png)](https://gemnasium.com/guard/guard-minitest) [![Code Climate](https://codeclimate.com/github/guard/guard-minitest.png)](https://codeclimate.com/github/guard/guard-minitest) [![Coverage Status](https://coveralls.io/repos/guard/guard-minitest/badge.png?branch=master)](https://coveralls.io/r/guard/guard-minitest)
3
3
 
4
- Minitest guard allows to automatically & intelligently launch tests with
5
- [minitest framework](http://github.com/seattlerb/minitest) when files are modified.
4
+ Guard::Minitest allows to automatically & intelligently launch tests with the
5
+ [minitest framework](https://github.com/seattlerb/minitest) when files are modified.
6
6
 
7
- * Compatible with MiniTest 1.7.x & 2.x
8
- * Tested on Ruby 1.8.7, 1.9.2 & 1.9.3
7
+ * Compatible with minitest >= 2.1 (optimal support for 5.x).
8
+ * Tested against Ruby 1.8.7, 1.9.3, 2.0.0, JRuby (1.8 mode & 1.9 mode) & Rubinius (1.8 mode & 1.9 mode).
9
9
 
10
- Install
11
- -------
10
+ ## Install
12
11
 
13
12
  Please be sure to have [Guard](http://github.com/guard/guard) installed before continue.
14
13
 
15
- Install the gem:
14
+ The simplest way to install Guard::Minitest is to use [Bundler](http://gembundler.com/).
16
15
 
17
- ```bash
18
- gem install guard-minitest
16
+ Add Guard::Minitest to your `Gemfile`:
17
+
18
+ ```ruby
19
+ group :development do
20
+ gem 'guard-minitest'
21
+ end
19
22
  ```
20
23
 
21
- Add it to your Gemfile (inside test group):
24
+ and install it by running Bundler:
22
25
 
23
- ```ruby
24
- gem 'guard-minitest'
26
+ ```bash
27
+ $ bundle
25
28
  ```
26
29
 
27
- Add guard definition to your Guardfile by running this command:
30
+ Add guard definition to your Guardfile by running the following command:
28
31
 
29
32
  ```bash
30
33
  guard init minitest
31
34
  ```
32
35
 
33
- Usage
34
- -----
36
+ ## Usage
35
37
 
36
38
  Please read [Guard usage doc](http://github.com/guard/guard#readme)
37
39
 
38
- Guardfile
39
- ---------
40
+ ## Guardfile
40
41
 
41
- Minitest guard can be really adapated to all kind of projects.
42
+ Guard::Minitest can be really adapated to all kind of projects.
42
43
  Please read [guard doc](http://github.com/guard/guard#readme) for more info about Guardfile DSL.
43
44
 
44
- ### Standard ruby gems with Minitest::Unit
45
+ ### Standard Guardfile when using Minitest::Unit
45
46
 
46
47
  ```ruby
47
- guard 'minitest' do
48
- watch(%r|^test/test_(.*)\.rb|)
49
- watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
50
- watch(%r|^test/test_helper\.rb|) { "test" }
48
+ guard :minitest do
49
+ watch(%r{^test/(.*)\/?test_(.*)\.rb})
50
+ watch(%r{^lib/(.*/)?([^/]+)\.rb}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
51
+ watch(%r{^test/test_helper\.rb}) { 'test' }
51
52
  end
52
53
  ```
53
54
 
54
- ### Standard ruby gems with Minitest::Spec
55
+ ### Standard Guardfile when using Minitest::Spec
55
56
 
56
57
  ```ruby
57
- guard 'minitest' do
58
- watch(%r|^spec/(.*)_spec\.rb|)
59
- watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
60
- watch(%r|^spec/spec_helper\.rb|) { "spec" }
58
+ guard :minitest do
59
+ watch(%r{^spec/(.*)_spec\.rb})
60
+ watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
61
+ watch(%r{^spec/spec_helper\.rb}) { 'spec' }
61
62
  end
62
63
  ```
63
64
 
64
- Options
65
- -------
65
+ ## Options
66
+
67
+ ### List of available options
68
+
69
+ ```ruby
70
+ :all_on_start => false # run all tests in group on startup, default: true
71
+ :cli => '--test' # pass arbitrary Minitest CLI arguments, default: ''
72
+ :test_folders => ['tests'] # specify an array of paths that contain test files, default: %w[test spec]
73
+ :test_file_patterns => true # specify an array of patterns that test files must match in order to be run, default: %w[*_test.rb test_*.rb *_spec.rb]
74
+ :spring => true # enable spring support, default: false
75
+ :zeus => true # enable zeus support; default: false
76
+ :drb => true # enable DRb support, default: false
77
+ :bundler => false # don't use "bundle exec" to run the minitest command, default: true
78
+ :rubygems => true # require rubygems when run the minitest command (only if bundler is disabled), default: false
79
+ ```
80
+
81
+ ### Options usage examples
66
82
 
67
- You can change the default location and pattern of minitest files:
83
+ You can change the default location of test files using the `:test_folders` option and pattern of test files using the `:test_file_patterns` option:
68
84
 
69
85
  ```ruby
70
- guard 'minitest', test_folders: 'test/unit', test_file_patterns: '*_test.rb' do
86
+ guard :minitest, :test_folders => 'test/unit', :test_file_patterns => '*_test.rb' do
71
87
  # ...
72
88
  end
73
89
  ```
74
90
 
75
- You can pass any of the standard MiniTest CLI options using the :cli option:
91
+ You can pass any of the standard MiniTest CLI options using the `:cli` option:
76
92
 
77
93
  ```ruby
78
- guard 'minitest', :cli => "--seed 123456 --verbose" do
94
+ guard :minitest, :cli => '--seed 123456 --verbose' do
79
95
  # ...
80
96
  end
81
97
  ```
82
98
 
83
- If you use [spork-testunit](https://github.com/sporkrb/spork-testunit) you can enable it with (you'll have to load it before):
99
+ [Spring](https://github.com/jonleighton/spring) is supported (Ruby 1.9.X / Rails 3.2+ only), but you must enable it:
84
100
 
85
101
  ```ruby
86
- guard 'minitest', :drb => true do
102
+ guard :minitest, :spring => true do
87
103
  # ...
88
104
  end
89
105
  ```
90
106
 
91
- ### List of available options:
107
+ [Zeus](https://github.com/burke/zeus) is supported, but you must enable it.
108
+ Please note that notification are currently disabled when using Zeus, if
109
+ you're interested in adding notification support for Zeus, please participate
110
+ in the [issue #62](https://github.com/guard/guard-minitest/issues/62).
92
111
 
93
112
  ```ruby
94
- :notify => false # disable desktop notifications
95
- :bundler => false # don't use "bundle exec" to run the minitest command, default: true
96
- :rubygems => true # require rubygems when run the minitest command (only if bundler is disabled), default: false
113
+ guard :minitest, :zeus => true do
114
+ # ...
115
+ end
97
116
  ```
98
117
 
99
- Development
100
- -----------
118
+ [Spork / spork-testunit](https://github.com/sporkrb/spork-testunit) is supported, but you must enable it:
119
+
120
+ ```ruby
121
+ guard :minitest, :drb => true do
122
+ # ...
123
+ end
124
+ ```
125
+
126
+ ## Development
127
+
128
+ * Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/guard-minitest/master/frames).
129
+ * Source hosted at [GitHub](https://github.com/guard/guard-minitest).
130
+
131
+ Pull requests are very welcome! Please try to follow these simple rules if applicable:
132
+
133
+ * Please create a topic branch for every separate change you make.
134
+ * Make sure your patches are well tested. All specs run by Travis CI must pass.
135
+ * Update the [README](https://github.com/guard/guard-minitest/blob/master/README.md).
136
+ * Please **do not change** the version number.
101
137
 
102
- * Source hosted on [GitHub](http://github.com/guard/guard-minitest)
103
- * Report issues/Questions/Feature requests on [GitHub Issues](http://github.com/guard/guard-minitest/issues)
138
+ For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
139
+ `#guard` (irc.freenode.net).
104
140
 
105
- Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
106
- you make.
141
+ ## Maintainer
107
142
 
108
- Authors
109
- -------
143
+ [Rémy Coutable](https://github.com/rymai) ([@rymai](http://twitter.com/rymai), [rymai.me](http://rymai.me))
110
144
 
111
- [Yann Lugrin](http://github.com/yannlugrin)
145
+ ## Author
112
146
 
147
+ [Yann Lugrin](https://github.com/yannlugrin)
@@ -5,18 +5,24 @@ require 'guard/guard'
5
5
  module Guard
6
6
  class Minitest < Guard
7
7
 
8
- autoload :Runner, 'guard/minitest/runner'
9
- autoload :Inspector, 'guard/minitest/inspector'
8
+ require 'guard/minitest/inspector'
9
+ require 'guard/minitest/runner'
10
+ require 'guard/minitest/version'
11
+ require 'minitest/autorun'
10
12
 
11
13
  def initialize(watchers = [], options = {})
12
14
  super
15
+ @options = {
16
+ :all_on_start => true
17
+ }.merge(options)
13
18
 
14
- @runner = Runner.new(options)
19
+ @runner = Runner.new(@options)
15
20
  @inspector = Inspector.new(@runner.test_folders, @runner.test_file_patterns)
16
21
  end
17
22
 
18
23
  def start
19
- true
24
+ UI.info "Guard::Minitest #{MinitestVersion::VERSION} is running, with Minitest::Unit #{::MiniTest::Unit::VERSION}!"
25
+ run_all if @options[:all_on_start]
20
26
  end
21
27
 
22
28
  def stop
@@ -29,14 +35,13 @@ module Guard
29
35
 
30
36
  def run_all
31
37
  paths = @inspector.clean_all
32
- return @runner.run(paths, :message => 'Running all tests') unless paths.empty?
33
- true
38
+ @runner.run(paths, :message => 'Running all tests')
34
39
  end
35
40
 
36
41
  def run_on_changes(paths = [])
37
42
  paths = @inspector.clean(paths)
38
- return @runner.run(paths) unless paths.empty?
39
- true
43
+ @runner.run(paths)
40
44
  end
45
+
41
46
  end
42
47
  end
@@ -11,7 +11,7 @@ module Guard
11
11
  end
12
12
 
13
13
  def clean_all
14
- clean self.test_folders
14
+ clean(test_folders)
15
15
  end
16
16
 
17
17
  def clean(paths)
@@ -21,7 +21,7 @@ module Guard
21
21
  paths.dup.each do |path|
22
22
  if File.directory?(path)
23
23
  paths.delete(path)
24
- paths += test_files_for_pathes([path])
24
+ paths += test_files_for_paths([path])
25
25
  end
26
26
  end
27
27
 
@@ -31,12 +31,13 @@ module Guard
31
31
  paths
32
32
  end
33
33
 
34
- private
34
+ private
35
+
35
36
  def test_folder_regex
36
- @test_folder_regex ||= (
37
- folders= self.test_folders.map {|f| Regexp.quote f}.join '|'
37
+ @_test_folder_regex ||= begin
38
+ folders = test_folders.map { |f| Regexp.quote(f) }.join('|')
38
39
  Regexp.new("^/?(?:#{folders})(?:/|$)")
39
- )
40
+ end
40
41
  end
41
42
 
42
43
  def test_folder?(path)
@@ -48,21 +49,21 @@ module Guard
48
49
  end
49
50
 
50
51
  def test_files
51
- @test_files ||= test_files_for_pathes(self.test_folders)
52
+ @_test_files ||= test_files_for_paths(test_folders)
52
53
  end
53
54
 
54
55
  def join_for_glob(fragments)
55
- "{#{fragments.join ','}}"
56
+ "{#{fragments.join(',')}}"
56
57
  end
57
58
 
58
- def test_files_for_pathes(pathes)
59
- pathes= join_for_glob(pathes)
60
- files= join_for_glob(self.test_file_patterns)
61
- Dir.glob(pathes + '/**/' + files)
59
+ def test_files_for_paths(paths)
60
+ paths = join_for_glob(paths)
61
+ files = join_for_glob(test_file_patterns)
62
+ Dir.glob(paths + '/**/' + files)
62
63
  end
63
64
 
64
65
  def clear_test_files_list
65
- @test_files = nil
66
+ @_test_files = nil
66
67
  end
67
68
 
68
69
  end
@@ -2,36 +2,39 @@
2
2
  require 'guard/notifier'
3
3
 
4
4
  module Guard
5
- class MinitestNotifier
5
+ class Minitest
6
+ class Notifier
6
7
 
7
- def self.guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
8
- message = "#{test_count} examples, #{assertion_count} assertions, #{failure_count} failures, #{error_count} errors"
9
- if skip_count > 0
10
- message << " (#{skip_count} skips)"
8
+ def self.guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
9
+ message = "#{test_count} tests"
10
+ if skip_count > 0
11
+ message << " (#{skip_count} skipped)"
12
+ end
13
+ message << "\n#{assertion_count} assertions, #{failure_count} failures, #{error_count} errors"
14
+ if test_count && assertion_count
15
+ message << "\n\n%.2f tests/s, %.2f assertions/s\n\nFinished in %.4f seconds" % [test_count / duration, assertion_count / duration, duration]
16
+ end
17
+ message
11
18
  end
12
- if test_count && assertion_count
13
- message << "\nin %.6f seconds, %.4f tests/s, %.4f assertions/s." % [duration, test_count / duration, assertion_count / duration]
14
- end
15
- message
16
- end
17
19
 
18
- # failed | pending (skip) | success
19
- def self.guard_image(failure_count, skip_count)
20
- icon = if failure_count > 0
21
- :failed
22
- elsif skip_count > 0
23
- :pending
24
- else
25
- :success
20
+ # failed | pending (skip) | success
21
+ def self.guard_image(failure_count, skip_count)
22
+ icon = if failure_count > 0
23
+ :failed
24
+ elsif skip_count > 0
25
+ :pending
26
+ else
27
+ :success
28
+ end
26
29
  end
27
- end
28
30
 
29
- def self.notify(test_count, assertion_count, failure_count, error_count, skip_count, duration)
30
- message = guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
31
- image = guard_image(failure_count + error_count, skip_count)
31
+ def self.notify(test_count, assertion_count, failure_count, error_count, skip_count, duration)
32
+ message = guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
33
+ image = guard_image(failure_count + error_count, skip_count)
32
34
 
33
- ::Guard::Notifier.notify(message, :title => 'MiniTest results', :image => image)
34
- end
35
+ ::Guard::Notifier.notify(message, :title => 'Minitest results', :image => image)
36
+ end
35
37
 
38
+ end
36
39
  end
37
40
  end
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+ require 'minitest'
3
+ require 'guard/minitest/notifier'
4
+
5
+ module Guard
6
+ class Minitest
7
+ class Reporter < ::Minitest::Reporter
8
+
9
+ def report
10
+ aggregate = results.group_by { |r| r.failure.class }
11
+ aggregate.default = [] # dumb. group_by should provide this
12
+
13
+ f = aggregate[::Minitest::Assertion].size
14
+ e = aggregate[::Minitest::UnexpectedError].size
15
+ s = aggregate[::Minitest::Skip].size
16
+ t = Time.now - start_time
17
+
18
+ ::Guard::Minitest::Notifier.notify(count, self.assertions, f, e, s, t)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -3,27 +3,27 @@ module Guard
3
3
  class Minitest
4
4
  class Runner
5
5
 
6
- class << self
7
-
8
- def run(paths = [], options = {})
9
- Runner.new(options).run(paths, options)
10
- end
11
-
6
+ def self.run(paths = [], options = {})
7
+ Runner.new(options).run(paths, options)
12
8
  end
13
9
 
14
10
  def initialize(options = {})
15
- parse_deprecated_options(options)
16
-
17
11
  @options = {
18
- :bundler => File.exist?("#{Dir.pwd}/Gemfile"),
19
- :rubygems => false,
20
- :drb => false,
12
+ :bundler => File.exist?("#{Dir.pwd}/Gemfile"),
13
+ :rubygems => false,
14
+ :drb => false,
15
+ :zeus => false,
16
+ :spring => false,
21
17
  :test_folders => %w[test spec],
22
18
  :test_file_patterns => %w[*_test.rb test_*.rb *_spec.rb],
23
- :cli => ''
19
+ :cli => nil
24
20
  }.merge(options)
25
- [:test_folders,:test_file_patterns].each {|k| (@options[k]= [@options[k]].flatten.uniq.compact).freeze}
26
- options= options.freeze
21
+
22
+ parse_deprecated_options
23
+
24
+ [:test_folders, :test_file_patterns].each do |k|
25
+ @options[k] = Array(@options[k]).uniq.compact
26
+ end
27
27
  end
28
28
 
29
29
  def run(paths, options = {})
@@ -33,19 +33,11 @@ module Guard
33
33
  end
34
34
 
35
35
  def cli_options
36
- @options[:cli] ||= ''
37
- end
38
-
39
- def verbose?
40
- @options[:cli].include?('--verbose')
41
- end
42
-
43
- def notify?
44
- !!@options[:notification]
36
+ @cli_options ||= Array(@options[:cli])
45
37
  end
46
38
 
47
39
  def bundler?
48
- @options[:bundler]
40
+ @options[:bundler] && ! @options[:spring]
49
41
  end
50
42
 
51
43
  def rubygems?
@@ -56,6 +48,14 @@ module Guard
56
48
  @options[:drb]
57
49
  end
58
50
 
51
+ def zeus?
52
+ @options[:zeus].is_a?(String) || @options[:zeus]
53
+ end
54
+
55
+ def spring?
56
+ @options[:spring]
57
+ end
58
+
59
59
  def test_folders
60
60
  @options[:test_folders]
61
61
  end
@@ -69,50 +69,74 @@ module Guard
69
69
  def minitest_command(paths)
70
70
  cmd_parts = []
71
71
 
72
- cmd_parts << "bundle exec" if bundler?
73
- if drb?
74
- cmd_parts << 'testdrb'
75
- cmd_parts << "-r #{File.expand_path('../runners/default_runner.rb', __FILE__)}"
76
- cmd_parts << "-e '::GUARD_NOTIFY=#{notify?}'"
77
- test_folders.each do |f|
78
- cmd_parts << "#{f}/test_helper.rb" if File.exist?("#{f}/test_helper.rb")
79
- cmd_parts << "#{f}/spec_helper.rb" if File.exist?("#{f}/spec_helper.rb")
80
- end
81
- cmd_parts += paths.map{|path| "./#{path}" }
72
+ cmd_parts << 'bundle exec' if bundler?
73
+ cmd_parts << if drb?
74
+ drb_command(paths)
75
+ elsif zeus?
76
+ zeus_command(paths)
77
+ elsif spring?
78
+ spring_command(paths)
82
79
  else
83
- cmd_parts << 'ruby'
84
- cmd_parts += test_folders.map{|f| %[-I"#{f}"] }
85
- cmd_parts << '-r rubygems' if rubygems?
86
- cmd_parts << '-r bundler/setup' if bundler?
87
- cmd_parts += paths.map{|path| "-r ./#{path}" }
88
- cmd_parts << "-r #{File.expand_path('../runners/default_runner.rb', __FILE__)}"
89
- cmd_parts << '-e \'MiniTest::Unit.autorun\''
90
- cmd_parts << '--' << cli_options unless cli_options.empty?
80
+ ruby_command(paths)
91
81
  end
92
82
 
93
- cmd_parts.join(' ')
83
+ cmd_parts.compact.join(' ')
94
84
  end
95
85
 
96
- def parse_deprecated_options(options)
97
- options[:cli] ||= ''
86
+ def drb_command(paths)
87
+ %w[testdrb -Itest] + relative_paths(paths)
88
+ end
89
+
90
+ def zeus_command(paths)
91
+ command = @options[:zeus].is_a?(String) ? @options[:zeus] : 'test'
92
+
93
+ ['zeus', command] + relative_paths(paths)
94
+ end
95
+
96
+ def spring_command(paths)
97
+ cmd_parts = ['spring testunit']
98
+ cmd_parts << File.expand_path('../runners/old_runner.rb', __FILE__) unless ::MiniTest::Unit::VERSION =~ /^5/
99
+
100
+ cmd_parts + relative_paths(paths)
101
+ end
102
+
103
+ def ruby_command(paths)
104
+ cmd_parts = ['ruby']
105
+ cmd_parts += test_folders.map {|f| %[-I"#{f}"] }
106
+ cmd_parts << '-r rubygems' if rubygems?
107
+ cmd_parts << '-r bundler/setup' if bundler?
108
+ cmd_parts += paths.map { |path| "-r ./#{path}" }
109
+ if ::MiniTest::Unit::VERSION =~ /^5/
110
+ cmd_parts << '-e \'Minitest.autorun\''
111
+ else
112
+ cmd_parts << "-r #{File.expand_path('../runners/old_runner.rb', __FILE__)}"
113
+ cmd_parts << '-e \'MiniTest::Unit.autorun\''
114
+ end
115
+ cmd_parts << '--'
116
+ cmd_parts += cli_options
117
+ cmd_parts << '--pride' # uses pride for output colorization
118
+ end
98
119
 
99
- if value = options.delete(:notify)
100
- options[:notification] = value
120
+ def relative_paths(paths)
121
+ paths.map { |p| "./#{p}" }
122
+ end
123
+
124
+ def parse_deprecated_options
125
+ if @options.key?(:notify)
101
126
  UI.info %{DEPRECATION WARNING: The :notify option is deprecated. Guard notification configuration is used.}
102
127
  end
103
128
 
104
129
  [:seed, :verbose].each do |key|
105
- if value = options.delete(key)
106
- options[:cli] << " --#{key}"
107
- if ![TrueClass, FalseClass].include?(value.class)
108
- options[:cli] << " #{value}"
109
- end
130
+ if value = @options.delete(key)
131
+ final_value = "--#{key}"
132
+ final_value << " #{value}" unless [TrueClass, FalseClass].include?(value.class)
133
+ cli_options << final_value
110
134
 
111
- UI.info %{DEPRECATION WARNING: The :#{key} option is deprecated. Pass standard command line argument "--#{key}" to MiniTest with the :cli option.}
135
+ UI.info %{DEPRECATION WARNING: The :#{key} option is deprecated. Pass standard command line argument "--#{key}" to Minitest with the :cli option.}
112
136
  end
113
137
  end
114
138
  end
139
+
115
140
  end
116
141
  end
117
142
  end
118
-
@@ -11,11 +11,8 @@ module MiniTest
11
11
  start = Time.now
12
12
  _run_anything_without_guard(type)
13
13
  duration = Time.now - start
14
- ::Guard::MinitestNotifier.notify(test_count, assertion_count, failures, errors, skips, duration) if GUARD_NOTIFY
14
+ ::Guard::Minitest::Notifier.notify(test_count, assertion_count, failures, errors, skips, duration)
15
15
  end
16
- rescue NameError
17
- puts "*** WARN: if you use MiniTest 1, please add version option in your 'Guardfile`."
18
- raise
19
16
  end
20
17
 
21
18
  end
@@ -1,30 +1,30 @@
1
- guard 'minitest' do
1
+ guard :minitest do
2
2
  # with Minitest::Unit
3
- watch(%r|^test/(.*)\/?test_(.*)\.rb|)
4
- watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
5
- watch(%r|^test/test_helper\.rb|) { "test" }
3
+ watch(%r{^test/(.*)\/?test_(.*)\.rb})
4
+ watch(%r{^lib/(.*/)?([^/]+)\.rb}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
5
+ watch(%r{^test/test_helper\.rb}) { 'test' }
6
6
 
7
7
  # with Minitest::Spec
8
- # watch(%r|^spec/(.*)_spec\.rb|)
9
- # watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
10
- # watch(%r|^spec/spec_helper\.rb|) { "spec" }
8
+ # watch(%r{^spec/(.*)_spec\.rb})
9
+ # watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
10
+ # watch(%r{^spec/spec_helper\.rb}) { 'spec' }
11
11
 
12
12
  # Rails 4
13
- # watch(%r|^test/test_helper\.rb|) { "test" }
14
- # watch(%r|^test/.+_test\.rb|)
15
- # watch(%r|^app/(.+)\.rb|) { |m| "test/#{m[1]}_test.rb" }
16
- # watch(%r|^app/controllers/application_controller\.rb|) { "test/controllers" }
17
- # watch(%r|^app/controllers/(.+)_controller\.rb|) { |m| "test/integration/#{m[1]}_test.rb" }
18
- # watch(%r|^app/views/(.+)_mailer/.+|) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
19
- # watch(%r|^lib/(.+)\.rb|) { |m| "test/lib/#{m[1]}_test.rb" }
13
+ # watch(%r{^test/test_helper\.rb}) { 'test' }
14
+ # watch(%r{^test/.+_test\.rb})
15
+ # watch(%r{^app/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
16
+ # watch(%r{^app/controllers/application_controller\.rb}) { 'test/controllers' }
17
+ # watch(%r{^app/controllers/(.+)_controller\.rb}) { |m| "test/integration/#{m[1]}_test.rb" }
18
+ # watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
19
+ # watch(%r{^lib/(.+)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" }
20
20
 
21
21
  # Rails 3.2
22
- # watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
23
- # watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
24
- # watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
22
+ # watch(%r{^app/controllers/(.*)\.rb}) { |m| "test/controllers/#{m[1]}_test.rb" }
23
+ # watch(%r{^app/helpers/(.*)\.rb}) { |m| "test/helpers/#{m[1]}_test.rb" }
24
+ # watch(%r{^app/models/(.*)\.rb}) { |m| "test/unit/#{m[1]}_test.rb" }
25
25
 
26
26
  # Rails
27
- # watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/functional/#{m[1]}_test.rb" }
28
- # watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
29
- # watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
27
+ # watch(%r{^app/controllers/(.*)\.rb}) { |m| "test/functional/#{m[1]}_test.rb" }
28
+ # watch(%r{^app/helpers/(.*)\.rb}) { |m| "test/helpers/#{m[1]}_test.rb" }
29
+ # watch(%r{^app/models/(.*)\.rb}) { |m| "test/unit/#{m[1]}_test.rb" }
30
30
  end
@@ -1,6 +1,7 @@
1
- # encoding: utf-8
2
1
  module Guard
3
- module MinitestVersion
4
- VERSION = '1.0.0.beta1'
2
+ class MinitestVersion
3
+
4
+ VERSION = '1.0.0.beta.2'
5
+
5
6
  end
6
7
  end
@@ -0,0 +1,10 @@
1
+ require 'guard/minitest/reporter'
2
+
3
+ module Minitest
4
+ def self.plugin_guard_minitest_options(opts, options) # :nodoc:
5
+ end
6
+
7
+ def self.plugin_guard_minitest_init(options) # :nodoc:
8
+ self.reporter << ::Guard::Minitest::Reporter.new(File.open('/dev/null', 'w'))
9
+ end
10
+ end
metadata CHANGED
@@ -1,144 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta1
5
- prerelease: 6
4
+ version: 1.0.0.beta.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Yann Lugrin
8
+ - Rémy Coutable
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-10 00:00:00.000000000 Z
12
+ date: 2013-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - ~>
18
+ - - '>='
20
19
  - !ruby/object:Gem::Version
21
- version: '1.1'
20
+ version: '1.8'
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
- - - ~>
25
+ - - '>='
28
26
  - !ruby/object:Gem::Version
29
- version: '1.1'
30
- - !ruby/object:Gem::Dependency
31
- name: rake
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
27
+ version: '1.8'
46
28
  - !ruby/object:Gem::Dependency
47
29
  name: minitest
48
30
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
31
  requirements:
51
- - - ~>
32
+ - - '>='
52
33
  - !ruby/object:Gem::Version
53
34
  version: '2.1'
54
- type: :development
35
+ type: :runtime
55
36
  prerelease: false
56
37
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
38
  requirements:
59
- - - ~>
39
+ - - '>='
60
40
  - !ruby/object:Gem::Version
61
41
  version: '2.1'
62
42
  - !ruby/object:Gem::Dependency
63
43
  name: bundler
64
44
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
45
  requirements:
67
- - - ~>
46
+ - - '>='
68
47
  - !ruby/object:Gem::Version
69
- version: '1.0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: '1.0'
78
- - !ruby/object:Gem::Dependency
79
- name: mocha
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ~>
84
- - !ruby/object:Gem::Version
85
- version: '0.10'
48
+ version: '0'
86
49
  type: :development
87
50
  prerelease: false
88
51
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
52
  requirements:
91
- - - ~>
53
+ - - '>='
92
54
  - !ruby/object:Gem::Version
93
- version: '0.10'
94
- description: Guard::Minitest automatically run your tests with MiniTest framework
55
+ version: '0'
56
+ description: Guard::Minitest automatically run your tests with Minitest framework
95
57
  (much like autotest)
96
58
  email:
97
- - yann.lugrin@sans-savoir.net
59
+ - remy@rymai.me
98
60
  executables: []
99
61
  extensions: []
100
62
  extra_rdoc_files: []
101
63
  files:
102
64
  - lib/guard/minitest/inspector.rb
103
65
  - lib/guard/minitest/notifier.rb
66
+ - lib/guard/minitest/reporter.rb
104
67
  - lib/guard/minitest/runner.rb
105
- - lib/guard/minitest/runners/default_runner.rb
106
- - lib/guard/minitest/runners/version_1_runner.rb
107
- - lib/guard/minitest/runners/version_2_runner.rb
68
+ - lib/guard/minitest/runners/old_runner.rb
108
69
  - lib/guard/minitest/templates/Guardfile
109
70
  - lib/guard/minitest/version.rb
110
71
  - lib/guard/minitest.rb
72
+ - lib/minitest/guard_minitest_plugin.rb
73
+ - CHANGELOG.md
111
74
  - LICENSE
112
75
  - README.md
113
- - CHANGELOG.md
114
- homepage: http://rubygems.org/gems/guard-minitest
76
+ homepage: https://github.com/guard/guard-minitest
115
77
  licenses: []
78
+ metadata: {}
116
79
  post_install_message:
117
- rdoc_options:
118
- - --charset=UTF-8
119
- - --main=README.rdoc
120
- - --exclude='(lib|test|spec)|(Gem|Guard|Rake)file'
80
+ rdoc_options: []
121
81
  require_paths:
122
82
  - lib
123
83
  required_ruby_version: !ruby/object:Gem::Requirement
124
- none: false
125
84
  requirements:
126
- - - ! '>='
85
+ - - '>='
127
86
  - !ruby/object:Gem::Version
128
87
  version: '0'
129
- segments:
130
- - 0
131
- hash: 97313028328538676
132
88
  required_rubygems_version: !ruby/object:Gem::Requirement
133
- none: false
134
89
  requirements:
135
- - - ! '>='
90
+ - - '>'
136
91
  - !ruby/object:Gem::Version
137
- version: 1.3.6
92
+ version: 1.3.1
138
93
  requirements: []
139
- rubyforge_project: guard-minitest
140
- rubygems_version: 1.8.24
94
+ rubyforge_project:
95
+ rubygems_version: 2.0.3
141
96
  signing_key:
142
- specification_version: 3
143
- summary: Guard gem for MiniTest framework
97
+ specification_version: 4
98
+ summary: Guard gem for the Minitest framework
144
99
  test_files: []
@@ -1,8 +0,0 @@
1
- # encoding: utf-8
2
- require 'minitest/unit'
3
-
4
- if MiniTest::Unit::VERSION =~ /^1/
5
- load File.expand_path('../version_1_runner.rb', __FILE__)
6
- else
7
- load File.expand_path('../version_2_runner.rb', __FILE__)
8
- end
@@ -1,17 +0,0 @@
1
- # encoding: utf-8
2
- require 'minitest/unit'
3
- require 'guard/minitest/notifier'
4
-
5
- module MiniTest
6
- class MiniTest::Unit
7
-
8
- alias_method :run_without_guard, :run
9
- def run(args = [])
10
- start = Time.now
11
- run_without_guard(args)
12
- duration = Time.now - start
13
- ::Guard::MinitestNotifier.notify(test_count, assertion_count, failures, errors, skips, duration) if GUARD_NOTIFY
14
- end
15
-
16
- end
17
- end