guard-minitest 2.4.1 → 2.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cebc98621cedd2348424d5b4872b63fbde0ed65d
4
- data.tar.gz: 6c51c1ba3ed8e4e1b83d812645579d999e95de46
3
+ metadata.gz: 851b5a2bd445b0f83efeb90aba66ae605c46ace2
4
+ data.tar.gz: 698e015c7ad9cafe7adad2e79814423e79d7f150
5
5
  SHA512:
6
- metadata.gz: b64957389041ea9e9cd39846afd6811dea4547a4bc9e5b159fe644a44cb96f7c8f246e7519f1c8e5da046f56c5646e210d570ebbe901f28b99a87a1816bcafe9
7
- data.tar.gz: c82e9647a519ddc06a34014e44f72f8398c48f5d695811a91d88320198ad12d519a10e0f81a3069f7b3973cd660c0bd5858dc7f233fdfb8a72d66de000979046
6
+ metadata.gz: 7137097036674b50c4956161ab6092c55077ff1b4852fb00932720890e825182c0f0fa8782a0fabfa181cf37c3cc3804a39b742a76fcad87cfe7a29905d8b2c0
7
+ data.tar.gz: 5f9cda4bb17dbcbad72e265bdbb837890df27e0acd4c33e930356ac8a35be7c8bce416feff722487128e537f3d726ee637928d0c3b5721673bee8630d6bfc6fa
@@ -2,7 +2,6 @@ require 'guard/compat/plugin'
2
2
 
3
3
  module Guard
4
4
  class Minitest < Plugin
5
-
6
5
  require 'guard/minitest/runner'
7
6
  require 'guard/minitest/utils'
8
7
  require 'guard/minitest/version'
@@ -51,6 +50,5 @@ module Guard
51
50
  def throw_on_failed_tests
52
51
  throw :task_has_failed unless yield
53
52
  end
54
-
55
53
  end
56
54
  end
@@ -0,0 +1,56 @@
1
+ require 'guard/compat/plugin'
2
+
3
+ module Guard
4
+ class Minitest < Plugin
5
+
6
+ require 'guard/minitest/runner'
7
+ require 'guard/minitest/utils'
8
+ require 'guard/minitest/version'
9
+
10
+ attr_accessor :runner
11
+
12
+ def initialize(options = {})
13
+ super
14
+ @options = {
15
+ all_on_start: true
16
+ }.merge(options)
17
+ @runner = Runner.new(@options)
18
+ end
19
+
20
+ def start
21
+ UI.info "Guard::Minitest #{MinitestVersion::VERSION} is running, with Minitest::Unit #{Utils.minitest_version}!"
22
+ run_all if @options[:all_on_start]
23
+ end
24
+
25
+ def stop
26
+ true
27
+ end
28
+
29
+ def reload
30
+ true
31
+ end
32
+
33
+ def run_all
34
+ throw_on_failed_tests { runner.run_all }
35
+ end
36
+
37
+ def run_on_modifications(paths = [])
38
+ throw_on_failed_tests { runner.run_on_modifications(paths) }
39
+ end
40
+
41
+ def run_on_additions(paths)
42
+ runner.run_on_additions(paths)
43
+ end
44
+
45
+ def run_on_removals(paths)
46
+ runner.run_on_removals(paths)
47
+ end
48
+
49
+ private
50
+
51
+ def throw_on_failed_tests
52
+ throw :task_has_failed unless yield
53
+ end
54
+
55
+ end
56
+ end
@@ -3,7 +3,6 @@ require 'guard/minitest'
3
3
  module Guard
4
4
  class Minitest < Plugin
5
5
  class Inspector
6
-
7
6
  attr_reader :test_folders, :test_file_patterns
8
7
 
9
8
  def initialize(test_folders, test_file_patterns)
@@ -50,7 +49,6 @@ module Guard
50
49
  def _join_for_glob(fragments)
51
50
  "{#{fragments.join(',')}}"
52
51
  end
53
-
54
52
  end
55
53
  end
56
54
  end
@@ -0,0 +1,54 @@
1
+ module Guard
2
+ class Minitest
3
+ class Inspector
4
+
5
+ attr_reader :test_folders, :test_file_patterns
6
+
7
+ def initialize(test_folders, test_file_patterns)
8
+ @test_folders = test_folders.uniq.compact
9
+ @test_file_patterns = test_file_patterns.uniq.compact
10
+ end
11
+
12
+ def clean_all
13
+ clean(test_folders)
14
+ end
15
+
16
+ def clean(paths)
17
+ paths.reduce([]) do |memo, path|
18
+ if File.directory?(path)
19
+ memo += _test_files_for_paths(path)
20
+ else
21
+ memo << path if _test_file?(path)
22
+ end
23
+ memo
24
+ end.uniq
25
+ end
26
+
27
+ def clear_memoized_test_files
28
+ @all_test_files = nil
29
+ end
30
+
31
+ def all_test_files
32
+ @all_test_files ||= _test_files_for_paths
33
+ end
34
+
35
+ private
36
+
37
+ def _test_files_for_paths(paths = test_folders)
38
+ paths = _join_for_glob(Array(paths))
39
+ files = _join_for_glob(test_file_patterns)
40
+
41
+ Dir["#{paths}/**/#{files}"]
42
+ end
43
+
44
+ def _test_file?(path)
45
+ _test_files_for_paths.include?(path)
46
+ end
47
+
48
+ def _join_for_glob(fragments)
49
+ "{#{fragments.join(',')}}"
50
+ end
51
+
52
+ end
53
+ end
54
+ end
@@ -1,12 +1,9 @@
1
1
  module Guard
2
2
  class Minitest < Plugin
3
3
  class Notifier
4
-
5
4
  def self.guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
6
5
  message = "#{test_count} tests"
7
- if skip_count > 0
8
- message << " (#{skip_count} skipped)"
9
- end
6
+ message << " (#{skip_count} skipped)" if skip_count > 0
10
7
  message << "\n#{assertion_count} assertions, #{failure_count} failures, #{error_count} errors"
11
8
  if test_count && assertion_count
12
9
  message << "\n\n%.2f tests/s, %.2f assertions/s\n\nFinished in %.4f seconds" % [test_count / duration, assertion_count / duration, duration]
@@ -31,7 +28,6 @@ module Guard
31
28
 
32
29
  Compat::UI.notify(message, title: 'Minitest results', image: image)
33
30
  end
34
-
35
31
  end
36
32
  end
37
33
  end
@@ -0,0 +1,39 @@
1
+ require 'guard/notifier'
2
+
3
+ module Guard
4
+ class Minitest
5
+ class Notifier
6
+
7
+ def self.guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
8
+ message = "#{test_count} tests"
9
+ if skip_count > 0
10
+ message << " (#{skip_count} skipped)"
11
+ end
12
+ message << "\n#{assertion_count} assertions, #{failure_count} failures, #{error_count} errors"
13
+ if test_count && assertion_count
14
+ message << "\n\n%.2f tests/s, %.2f assertions/s\n\nFinished in %.4f seconds" % [test_count / duration, assertion_count / duration, duration]
15
+ end
16
+ message
17
+ end
18
+
19
+ # failed | pending (skip) | success
20
+ def self.guard_image(failure_count, skip_count)
21
+ if failure_count > 0
22
+ :failed
23
+ elsif skip_count > 0
24
+ :pending
25
+ else
26
+ :success
27
+ end
28
+ end
29
+
30
+ def self.notify(test_count, assertion_count, failure_count, error_count, skip_count, duration)
31
+ message = guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
32
+ image = guard_image(failure_count + error_count, skip_count)
33
+
34
+ ::Guard::Notifier.notify(message, title: 'Minitest results', image: image)
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -4,15 +4,13 @@ require 'guard/minitest/notifier'
4
4
  module Guard
5
5
  class Minitest < Plugin
6
6
  class Reporter < ::Minitest::StatisticsReporter
7
-
8
7
  def report
9
8
  super
10
9
 
11
- ::Guard::Minitest::Notifier.notify(self.count, self.assertions,
12
- self.failures, self.errors,
13
- self.skips, self.total_time)
10
+ ::Guard::Minitest::Notifier.notify(count, assertions,
11
+ failures, errors,
12
+ skips, total_time)
14
13
  end
15
-
16
14
  end
17
15
  end
18
16
  end
@@ -0,0 +1,18 @@
1
+ require 'minitest'
2
+ require 'guard/minitest/notifier'
3
+
4
+ module Guard
5
+ class Minitest
6
+ class Reporter < ::Minitest::StatisticsReporter
7
+
8
+ def report
9
+ super
10
+
11
+ ::Guard::Minitest::Notifier.notify(self.count, self.assertions,
12
+ self.failures, self.errors,
13
+ self.skips, self.total_time)
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -4,7 +4,6 @@ require 'guard/minitest/notifier'
4
4
  module Guard
5
5
  class Minitest < Plugin
6
6
  class Reporter < ::Minitest::Reporter
7
-
8
7
  def report
9
8
  aggregate = results.group_by { |r| r.failure.class }
10
9
  aggregate.default = [] # dumb. group_by should provide this
@@ -14,9 +13,8 @@ module Guard
14
13
  s = aggregate[::Minitest::Skip].size
15
14
  t = Time.now - start_time
16
15
 
17
- ::Guard::Minitest::Notifier.notify(count, self.assertions, f, e, s, t)
16
+ ::Guard::Minitest::Notifier.notify(count, assertions, f, e, s, t)
18
17
  end
19
-
20
18
  end
21
19
  end
22
20
  end
@@ -0,0 +1,22 @@
1
+ require 'minitest'
2
+ require 'guard/minitest/notifier'
3
+
4
+ module Guard
5
+ class Minitest
6
+ class Reporter < ::Minitest::Reporter
7
+
8
+ def report
9
+ aggregate = results.group_by { |r| r.failure.class }
10
+ aggregate.default = [] # dumb. group_by should provide this
11
+
12
+ f = aggregate[::Minitest::Assertion].size
13
+ e = aggregate[::Minitest::UnexpectedError].size
14
+ s = aggregate[::Minitest::Skip].size
15
+ t = Time.now - start_time
16
+
17
+ ::Guard::Minitest::Notifier.notify(count, self.assertions, f, e, s, t)
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -1,4 +1,5 @@
1
1
  require 'guard/minitest/inspector'
2
+ require 'English'
2
3
 
3
4
  module Guard
4
5
  class Minitest < Plugin
@@ -16,8 +17,8 @@ module Guard
16
17
  all_env: {},
17
18
  env: {},
18
19
  include: [],
19
- test_folders: %w[test spec],
20
- test_file_patterns: %w[*_test.rb test_*.rb *_spec.rb],
20
+ test_folders: %w(test spec),
21
+ test_file_patterns: %w(*_test.rb test_*.rb *_spec.rb),
21
22
  cli: nil,
22
23
  autorun: true
23
24
  }.merge(options)
@@ -37,19 +38,23 @@ module Guard
37
38
  message = "Running: #{options[:all] ? 'all tests' : paths.join(' ')}"
38
39
  Compat::UI.info message, reset: true
39
40
 
40
- status = _run_command(paths, options[:all])
41
+ begin
42
+ status = _run_possibly_bundled_command(paths, options[:all])
43
+ rescue Errno::ENOENT => e
44
+ Compat::UI.error e.message
45
+ throw :task_has_failed
46
+ end
47
+
48
+ success = status.zero?
41
49
 
42
50
  # When using zeus or spring, the Guard::Minitest::Reporter can't be used because the minitests run in another
43
51
  # process, but we can use the exit status of the client process to distinguish between :success and :failed.
44
52
  if zeus? || spring?
45
- Compat::UI.notify(message, title: 'Minitest results', image: status ? :success : :failed)
53
+ Compat::UI.notify(message, title: 'Minitest results', image: success ? :success : :failed)
46
54
  end
47
55
 
48
- if @options[:all_after_pass] && status && !options[:all]
49
- run_all
50
- else
51
- status
52
- end
56
+ run_all_coz_ok = @options[:all_after_pass] && success && !options[:all]
57
+ run_all_coz_ok ? run_all : success
53
58
  end
54
59
 
55
60
  def run_all
@@ -62,12 +67,12 @@ module Guard
62
67
  run(paths, all: all_paths?(paths))
63
68
  end
64
69
 
65
- def run_on_additions(paths)
70
+ def run_on_additions(_paths)
66
71
  inspector.clear_memoized_test_files
67
72
  true
68
73
  end
69
74
 
70
- def run_on_removals(paths)
75
+ def run_on_removals(_paths)
71
76
  inspector.clear_memoized_test_files
72
77
  end
73
78
 
@@ -117,30 +122,24 @@ module Guard
117
122
  @options[:autorun]
118
123
  end
119
124
 
120
- def _run_command(paths, all)
121
- if bundler?
122
- system(*minitest_command(paths, all))
123
- else
124
- if defined?(::Bundler)
125
- ::Bundler.with_clean_env do
126
- system(*minitest_command(paths, all))
127
- end
128
- else
129
- system(*minitest_command(paths, all))
130
- end
131
- end
125
+ def _run(*args)
126
+ Compat::UI.debug "Running: #{args.join(' ')}"
127
+ return $CHILD_STATUS.exitstatus unless Kernel.system(*args).nil?
128
+
129
+ fail Errno::ENOENT, args.join(' ')
130
+ end
131
+
132
+ def _run_possibly_bundled_command(paths, all)
133
+ args = minitest_command(paths, all)
134
+ bundler_env = !bundler? && defined?(::Bundler)
135
+ bundler_env ? ::Bundler.with_clean_env { _run(*args) } : _run(*args)
132
136
  end
133
137
 
134
138
  def _commander(paths)
135
- if drb?
136
- drb_command(paths)
137
- elsif zeus?
138
- zeus_command(paths)
139
- elsif spring?
140
- spring_command(paths)
141
- else
142
- ruby_command(paths)
143
- end
139
+ return drb_command(paths) if drb?
140
+ return zeus_command(paths) if zeus?
141
+ return spring_command(paths) if spring?
142
+ ruby_command(paths)
144
143
  end
145
144
 
146
145
  def minitest_command(paths, all)
@@ -156,7 +155,7 @@ module Guard
156
155
  end
157
156
 
158
157
  def drb_command(paths)
159
- %w[testdrb] + generate_includes(false) + relative_paths(paths)
158
+ %w(testdrb) + generate_includes(false) + relative_paths(paths)
160
159
  end
161
160
 
162
161
  def zeus_command(paths)
@@ -167,7 +166,7 @@ module Guard
167
166
  def spring_command(paths)
168
167
  command = @options[:spring].is_a?(String) ? @options[:spring] : 'bin/rake test'
169
168
  cmd_parts = [command]
170
- cmd_parts << File.expand_path('../runners/old_runner.rb', __FILE__) unless (Utils.minitest_version_gte_5? || command != 'spring testunit')
169
+ cmd_parts << File.expand_path('../runners/old_runner.rb', __FILE__) unless Utils.minitest_version_gte_5? || command != 'spring testunit'
171
170
  if cli_options.length > 0
172
171
  cmd_parts + paths + ['--'] + cli_options
173
172
  else
@@ -195,6 +194,7 @@ module Guard
195
194
 
196
195
  cmd_parts << '--'
197
196
  cmd_parts += cli_options
197
+ cmd_parts
198
198
  end
199
199
 
200
200
  def generate_includes(include_test_folders = true)
@@ -204,23 +204,20 @@ module Guard
204
204
  folders = include_folders
205
205
  end
206
206
 
207
- folders.map {|f| %[-I"#{f}"] }
207
+ folders.map { |f| %(-I"#{f}") }
208
208
  end
209
209
 
210
- def generate_env(all=false)
210
+ def generate_env(all = false)
211
211
  base_env.merge(all ? all_env : {})
212
212
  end
213
213
 
214
214
  def base_env
215
- Hash[(@options[:env] || {}).map{|key, value| [key.to_s, value.to_s]}]
215
+ Hash[(@options[:env] || {}).map { |key, value| [key.to_s, value.to_s] }]
216
216
  end
217
217
 
218
218
  def all_env
219
- if @options[:all_env].kind_of? Hash
220
- Hash[@options[:all_env].map{|key, value| [key.to_s, value.to_s]}]
221
- else
222
- {@options[:all_env].to_s => "true"}
223
- end
219
+ return { @options[:all_env].to_s => 'true' } unless @options[:all_env].is_a? Hash
220
+ Hash[@options[:all_env].map { |key, value| [key.to_s, value.to_s] }]
224
221
  end
225
222
 
226
223
  def relative_paths(paths)
@@ -233,20 +230,20 @@ module Guard
233
230
 
234
231
  def parse_deprecated_options
235
232
  if @options.key?(:notify)
236
- UI.info %{DEPRECATION WARNING: The :notify option is deprecated. Guard notification configuration is used.}
233
+ # TODO: no coverage
234
+ Compat::UI.info %(DEPRECATION WARNING: The :notify option is deprecated. Guard notification configuration is used.)
237
235
  end
238
236
 
239
237
  [:seed, :verbose].each do |key|
240
- if value = @options.delete(key)
241
- final_value = "--#{key}"
242
- final_value << " #{value}" unless [TrueClass, FalseClass].include?(value.class)
243
- cli_options << final_value
238
+ next unless (value = @options.delete(key))
239
+
240
+ final_value = "--#{key}"
241
+ final_value << " #{value}" unless [TrueClass, FalseClass].include?(value.class)
242
+ cli_options << final_value
244
243
 
245
- Compat::UI.info %{DEPRECATION WARNING: The :#{key} option is deprecated. Pass standard command line argument "--#{key}" to Minitest with the :cli option.}
246
- end
244
+ Compat::UI.info %(DEPRECATION WARNING: The :#{key} option is deprecated. Pass standard command line argument "--#{key}" to Minitest with the :cli option.)
247
245
  end
248
246
  end
249
-
250
247
  end
251
248
  end
252
249
  end
@@ -0,0 +1,252 @@
1
+ require 'guard/minitest/inspector'
2
+
3
+ module Guard
4
+ class Minitest
5
+ class Runner
6
+ attr_accessor :inspector
7
+
8
+ def initialize(options = {})
9
+ @options = {
10
+ all_after_pass: false,
11
+ bundler: File.exist?("#{Dir.pwd}/Gemfile"),
12
+ rubygems: false,
13
+ drb: false,
14
+ zeus: false,
15
+ spring: false,
16
+ all_env: {},
17
+ env: {},
18
+ include: [],
19
+ test_folders: %w[test spec],
20
+ test_file_patterns: %w[*_test.rb test_*.rb *_spec.rb],
21
+ cli: nil,
22
+ autorun: true
23
+ }.merge(options)
24
+
25
+ parse_deprecated_options
26
+
27
+ [:test_folders, :test_file_patterns].each do |k|
28
+ @options[k] = Array(@options[k]).uniq.compact
29
+ end
30
+
31
+ @inspector = Inspector.new(test_folders, test_file_patterns)
32
+ end
33
+
34
+ def run(paths, options = {})
35
+ return unless options[:all] || !paths.empty?
36
+
37
+ message = "Running: #{options[:all] ? 'all tests' : paths.join(' ')}"
38
+ UI.info message, reset: true
39
+
40
+ status = _run_command(paths, options[:all])
41
+
42
+ # When using zeus or spring, the Guard::Minitest::Reporter can't be used because the minitests run in another
43
+ # process, but we can use the exit status of the client process to distinguish between :success and :failed.
44
+ if zeus? || spring?
45
+ ::Guard::Notifier.notify(message, title: 'Minitest results', image: status ? :success : :failed)
46
+ end
47
+
48
+ if @options[:all_after_pass] && status && !options[:all]
49
+ run_all
50
+ else
51
+ status
52
+ end
53
+ end
54
+
55
+ def run_all
56
+ paths = inspector.clean_all
57
+ run(paths, all: true)
58
+ end
59
+
60
+ def run_on_modifications(paths = [])
61
+ paths = inspector.clean(paths)
62
+ run(paths, all: all_paths?(paths))
63
+ end
64
+
65
+ def run_on_additions(paths)
66
+ inspector.clear_memoized_test_files
67
+ true
68
+ end
69
+
70
+ def run_on_removals(paths)
71
+ inspector.clear_memoized_test_files
72
+ end
73
+
74
+ private
75
+
76
+ def cli_options
77
+ @cli_options ||= Array(@options[:cli])
78
+ end
79
+
80
+ def bundler?
81
+ @options[:bundler] && !@options[:spring]
82
+ end
83
+
84
+ def rubygems?
85
+ !bundler? && @options[:rubygems]
86
+ end
87
+
88
+ def drb?
89
+ @options[:drb]
90
+ end
91
+
92
+ def zeus?
93
+ @options[:zeus].is_a?(String) || @options[:zeus]
94
+ end
95
+
96
+ def spring?
97
+ @options[:spring].is_a?(String) || @options[:spring]
98
+ end
99
+
100
+ def all_after_pass?
101
+ @options[:all_after_pass]
102
+ end
103
+
104
+ def test_folders
105
+ @options[:test_folders]
106
+ end
107
+
108
+ def include_folders
109
+ @options[:include]
110
+ end
111
+
112
+ def test_file_patterns
113
+ @options[:test_file_patterns]
114
+ end
115
+
116
+ def autorun?
117
+ @options[:autorun]
118
+ end
119
+
120
+ def _run_command(paths, all)
121
+ if bundler?
122
+ system(*minitest_command(paths, all))
123
+ else
124
+ if defined?(::Bundler)
125
+ ::Bundler.with_clean_env do
126
+ system(*minitest_command(paths, all))
127
+ end
128
+ else
129
+ system(*minitest_command(paths, all))
130
+ end
131
+ end
132
+ end
133
+
134
+ def _commander(paths)
135
+ if drb?
136
+ drb_command(paths)
137
+ elsif zeus?
138
+ zeus_command(paths)
139
+ elsif spring?
140
+ spring_command(paths)
141
+ else
142
+ ruby_command(paths)
143
+ end
144
+ end
145
+
146
+ def minitest_command(paths, all)
147
+ cmd_parts = []
148
+
149
+ cmd_parts << 'bundle exec' if bundler?
150
+ cmd_parts << _commander(paths)
151
+
152
+ [cmd_parts.compact.join(' ')].tap do |args|
153
+ env = generate_env(all)
154
+ args.unshift(env) if env.length > 0
155
+ end
156
+ end
157
+
158
+ def drb_command(paths)
159
+ %w[testdrb] + generate_includes(false) + relative_paths(paths)
160
+ end
161
+
162
+ def zeus_command(paths)
163
+ command = @options[:zeus].is_a?(String) ? @options[:zeus] : 'test'
164
+ ['zeus', command] + relative_paths(paths)
165
+ end
166
+
167
+ def spring_command(paths)
168
+ command = @options[:spring].is_a?(String) ? @options[:spring] : 'bin/rake test'
169
+ cmd_parts = [command]
170
+ cmd_parts << File.expand_path('../runners/old_runner.rb', __FILE__) unless (Utils.minitest_version_gte_5? || command != 'spring testunit')
171
+ if cli_options.length > 0
172
+ cmd_parts + paths + ['--'] + cli_options
173
+ else
174
+ cmd_parts + paths
175
+ end
176
+ end
177
+
178
+ def ruby_command(paths)
179
+ cmd_parts = ['ruby']
180
+ cmd_parts.concat(generate_includes)
181
+ cmd_parts << '-r rubygems' if rubygems?
182
+ cmd_parts << '-r bundler/setup' if bundler?
183
+ cmd_parts << '-r minitest/autorun' if autorun?
184
+ cmd_parts.concat(paths.map { |path| "-r ./#{path}" })
185
+
186
+ unless Utils.minitest_version_gte_5?
187
+ cmd_parts << "-r #{File.expand_path('../runners/old_runner.rb', __FILE__)}"
188
+ end
189
+
190
+ # All the work is done through minitest/autorun
191
+ # and requiring the test files, so this is just
192
+ # a placeholder so Ruby doesn't try to exceute
193
+ # code from STDIN.
194
+ cmd_parts << '-e ""'
195
+
196
+ cmd_parts << '--'
197
+ cmd_parts += cli_options
198
+ end
199
+
200
+ def generate_includes(include_test_folders = true)
201
+ if include_test_folders
202
+ folders = test_folders + include_folders
203
+ else
204
+ folders = include_folders
205
+ end
206
+
207
+ folders.map {|f| %[-I"#{f}"] }
208
+ end
209
+
210
+ def generate_env(all=false)
211
+ base_env.merge(all ? all_env : {})
212
+ end
213
+
214
+ def base_env
215
+ Hash[(@options[:env] || {}).map{|key, value| [key.to_s, value.to_s]}]
216
+ end
217
+
218
+ def all_env
219
+ if @options[:all_env].kind_of? Hash
220
+ Hash[@options[:all_env].map{|key, value| [key.to_s, value.to_s]}]
221
+ else
222
+ {@options[:all_env].to_s => "true"}
223
+ end
224
+ end
225
+
226
+ def relative_paths(paths)
227
+ paths.map { |p| "./#{p}" }
228
+ end
229
+
230
+ def all_paths?(paths)
231
+ paths == inspector.all_test_files
232
+ end
233
+
234
+ def parse_deprecated_options
235
+ if @options.key?(:notify)
236
+ UI.info %{DEPRECATION WARNING: The :notify option is deprecated. Guard notification configuration is used.}
237
+ end
238
+
239
+ [:seed, :verbose].each do |key|
240
+ if value = @options.delete(key)
241
+ final_value = "--#{key}"
242
+ final_value << " #{value}" unless [TrueClass, FalseClass].include?(value.class)
243
+ cli_options << final_value
244
+
245
+ UI.info %{DEPRECATION WARNING: The :#{key} option is deprecated. Pass standard command line argument "--#{key}" to Minitest with the :cli option.}
246
+ end
247
+ end
248
+ end
249
+
250
+ end
251
+ end
252
+ end
@@ -3,7 +3,6 @@ require 'guard/minitest/notifier'
3
3
 
4
4
  module MiniTest
5
5
  class MiniTest::Unit
6
-
7
6
  begin
8
7
  alias_method :_run_anything_without_guard, :_run_anything
9
8
  def _run_anything(type)
@@ -13,6 +12,5 @@ module MiniTest
13
12
  ::Guard::Minitest::Notifier.notify(test_count, assertion_count, failures, errors, skips, duration)
14
13
  end
15
14
  end
16
-
17
15
  end
18
16
  end
@@ -5,7 +5,6 @@ require 'guard/minitest'
5
5
  module Guard
6
6
  class Minitest < Plugin
7
7
  class Utils
8
-
9
8
  def self.minitest_version
10
9
  @@minitest_version ||= begin
11
10
  require 'minitest'
@@ -24,7 +23,6 @@ module Guard
24
23
  def self.minitest_version_gte_5_0_4?
25
24
  @@minitest_version_gte_5_0_4 ||= Gem::Requirement.new('>= 5.0.4').satisfied_by?(Gem::Version.new(minitest_version))
26
25
  end
27
-
28
26
  end
29
27
  end
30
28
  end
@@ -0,0 +1,28 @@
1
+ require 'rubygems/requirement'
2
+
3
+ module Guard
4
+ class Minitest
5
+ class Utils
6
+
7
+ def self.minitest_version
8
+ @@minitest_version ||= begin
9
+ require 'minitest'
10
+ ::Minitest::VERSION
11
+
12
+ rescue LoadError, NameError
13
+ require 'minitest/unit'
14
+ ::MiniTest::Unit::VERSION
15
+ end
16
+ end
17
+
18
+ def self.minitest_version_gte_5?
19
+ @@minitest_version_gte_5 ||= Gem::Requirement.new('>= 5').satisfied_by?(Gem::Version.new(minitest_version))
20
+ end
21
+
22
+ def self.minitest_version_gte_5_0_4?
23
+ @@minitest_version_gte_5_0_4 ||= Gem::Requirement.new('>= 5.0.4').satisfied_by?(Gem::Version.new(minitest_version))
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  class MinitestVersion
3
- VERSION = '2.4.1'
3
+ VERSION = '2.4.2'
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ module Guard
2
+ class MinitestVersion
3
+
4
+ VERSION = '2.3.2'
5
+
6
+ end
7
+ end
@@ -7,10 +7,10 @@ else
7
7
  end
8
8
 
9
9
  module Minitest
10
- def self.plugin_guard_minitest_options(opts, options) # :nodoc:
10
+ def self.plugin_guard_minitest_options(_opts, _options) # :nodoc:
11
11
  end
12
12
 
13
- def self.plugin_guard_minitest_init(options) # :nodoc:
14
- self.reporter << ::Guard::Minitest::Reporter.new
13
+ def self.plugin_guard_minitest_init(_options) # :nodoc:
14
+ reporter << ::Guard::Minitest::Reporter.new
15
15
  end
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yann Lugrin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-14 00:00:00.000000000 Z
12
+ date: 2015-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard-compat
@@ -65,15 +65,23 @@ files:
65
65
  - LICENSE
66
66
  - README.md
67
67
  - lib/guard/minitest.rb
68
+ - lib/guard/minitest.rb.orig
68
69
  - lib/guard/minitest/inspector.rb
70
+ - lib/guard/minitest/inspector.rb.orig
69
71
  - lib/guard/minitest/notifier.rb
72
+ - lib/guard/minitest/notifier.rb.orig
70
73
  - lib/guard/minitest/reporter.rb
74
+ - lib/guard/minitest/reporter.rb.orig
71
75
  - lib/guard/minitest/reporters/old_reporter.rb
76
+ - lib/guard/minitest/reporters/old_reporter.rb.orig
72
77
  - lib/guard/minitest/runner.rb
78
+ - lib/guard/minitest/runner.rb.orig
73
79
  - lib/guard/minitest/runners/old_runner.rb
74
80
  - lib/guard/minitest/templates/Guardfile
75
81
  - lib/guard/minitest/utils.rb
82
+ - lib/guard/minitest/utils.rb.orig
76
83
  - lib/guard/minitest/version.rb
84
+ - lib/guard/minitest/version.rb.orig
77
85
  - lib/minitest/guard_minitest_plugin.rb
78
86
  homepage: https://rubygems.org/gems/guard-minitest
79
87
  licenses:
@@ -95,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
103
  version: '0'
96
104
  requirements: []
97
105
  rubyforge_project:
98
- rubygems_version: 2.4.2
106
+ rubygems_version: 2.4.3
99
107
  signing_key:
100
108
  specification_version: 4
101
109
  summary: Guard plugin for the Minitest framework