guard-minitest 1.0.0.rc.2 → 1.0.0.rc.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db71d83f0be42030ab23615199f6c5bee71cdc2d
4
- data.tar.gz: d1f7ef82f176e014b8829a6dbde1a99c987bfe64
3
+ metadata.gz: 62bede663636e879d9ff397f906ff30fe4ef3b76
4
+ data.tar.gz: e4e2b0a5f32a0a318bc7c4685b08a61f34837027
5
5
  SHA512:
6
- metadata.gz: b0e1db26c8352155e8cb3e305832277f08d7f1612c6d97139d0b687dd233677f03a8bd86b3ad671215a85ef69c989fdc1610fba2e2435921faaddbc38330d8ee
7
- data.tar.gz: d670ccae2dcb550a1c3e75887a710f14da58cd0f90116fca264f0bde8a627e6f4263f9b00b049da9fe2862a4ea4b0dcf8b011cf7a124f12a046c70ff9fc464fe
6
+ metadata.gz: 8bedf120fee341516e402066089e4d4009f46880cc54e3d7fae27935ff163e308739c5c5d8ffbeb0e3f732a90ed28ffb5bb317c6d615b25904cfa547cd5004ea
7
+ data.tar.gz: 468176f1a886768246426c728fcc6a65167e06e36b51f8a02d5984d257e5bd6034a07ee6c7428c5be55f355e9060053e6f8f986361416f61d876013d48a6be83
@@ -1,6 +1,17 @@
1
1
  ## Unreleased Changes
2
2
 
3
- [Full Changelog](https://github.com/guard/guard-minitest/compare/v1.0.0.rc.2...master)
3
+ [Full Changelog](https://github.com/guard/guard-minitest/compare/v1.0.0.rc.3...master)
4
+
5
+ ## 1.0.0.rc.3 - Jun 22, 2013
6
+
7
+ [Full Changelog](https://github.com/guard/guard-minitest/compare/v1.0.0.rc.2...v1.0.0.rc.3)
8
+
9
+ ### Improvements
10
+
11
+ * [#70][] Use `-r minitest/autorun` instead of `-e 'Minitest.autorun'` in the runner. ([@kejadlen][])
12
+ * Refactor / simplify `Guard::Minitest::Inspector`. ([@rymai][])
13
+ * [#69][] Use `Gem::Requirement.new` to compare versions. ([@kejadlen][])
14
+ * [#68][] Remove the unused test directory. ([@kejadlen][])
4
15
 
5
16
  ## 1.0.0.rc.2 - Jun 19, 2013
6
17
 
@@ -143,6 +154,9 @@ First stable release.
143
154
  [#62]: https://github.com/guard/guard/issues/62
144
155
  [#65]: https://github.com/guard/guard/issues/65
145
156
  [#66]: https://github.com/guard/guard/issues/66
157
+ [#68]: https://github.com/guard/guard/issues/68
158
+ [#69]: https://github.com/guard/guard/issues/69
159
+ [#70]: https://github.com/guard/guard/issues/70
146
160
  [@aflock]: https://github.com/aflock
147
161
  [@arronmabrey]: https://github.com/arronmabrey
148
162
  [@aspiers]: https://github.com/aspiers
@@ -6,8 +6,8 @@ module Guard
6
6
  attr_reader :test_folders, :test_file_patterns
7
7
 
8
8
  def initialize(test_folders, test_file_patterns)
9
- @test_folders = test_folders.uniq.compact.freeze
10
- @test_file_patterns = test_file_patterns.uniq.compact.freeze
9
+ @test_folders = test_folders.uniq.compact
10
+ @test_file_patterns = test_file_patterns.uniq.compact
11
11
  end
12
12
 
13
13
  def clean_all
@@ -15,57 +15,37 @@ module Guard
15
15
  end
16
16
 
17
17
  def clean(paths)
18
- paths = paths.uniq.compact unless paths == @test_folders
19
- paths = paths.select { |p| test_file?(p) || test_folder?(p) }
20
-
21
- paths.dup.each do |path|
18
+ paths.reduce([]) do |memo, path|
22
19
  if File.directory?(path)
23
- paths.delete(path)
24
- paths += test_files_for_paths([path])
20
+ memo += _test_files_for_paths(path)
21
+ else
22
+ memo << path if _test_file?(path)
25
23
  end
26
- end
27
-
28
- paths.uniq!
29
- paths.compact!
30
- clear_test_files_list
31
- paths
24
+ memo
25
+ end.uniq
32
26
  end
33
27
 
34
28
  private
35
29
 
36
- def test_folder_regex
37
- @_test_folder_regex ||= begin
38
- folders = test_folders.map { |f| Regexp.quote(f) }.join('|')
39
- Regexp.new("^/?(?:#{folders})(?:/|$)")
40
- end
41
- end
30
+ def _test_files_for_paths(paths = test_folders)
31
+ paths = _join_for_glob(Array(paths))
32
+ files = _join_for_glob(test_file_patterns)
42
33
 
43
- def test_folder?(path)
44
- path.match(test_folder_regex) && !path.match(/\..+$/) && File.directory?(path)
34
+ Dir["#{paths}/**/#{files}"]
45
35
  end
46
36
 
47
- def test_file?(path)
48
- test_files.include?(path)
37
+ def _all_test_files
38
+ @_all_test_files ||= _test_files_for_paths
49
39
  end
50
40
 
51
- def test_files
52
- @_test_files ||= test_files_for_paths(test_folders)
41
+ def _test_file?(path)
42
+ _all_test_files.include?(path)
53
43
  end
54
44
 
55
- def join_for_glob(fragments)
45
+ def _join_for_glob(fragments)
56
46
  "{#{fragments.join(',')}}"
57
47
  end
58
48
 
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)
63
- end
64
-
65
- def clear_test_files_list
66
- @_test_files = nil
67
- end
68
-
69
49
  end
70
50
  end
71
51
  end
@@ -1,4 +1,6 @@
1
1
  # encoding: utf-8
2
+ require 'rubygems/requirement'
3
+
2
4
  module Guard
3
5
  class Minitest
4
6
  class Runner
@@ -95,23 +97,29 @@ module Guard
95
97
 
96
98
  def spring_command(paths)
97
99
  cmd_parts = ['spring testunit']
98
- cmd_parts << File.expand_path('../runners/old_runner.rb', __FILE__) unless ::MiniTest::Unit::VERSION =~ /^5/
100
+ cmd_parts << File.expand_path('../runners/old_runner.rb', __FILE__) unless minitest_version_gte_5?
99
101
 
100
102
  cmd_parts + relative_paths(paths)
101
103
  end
102
104
 
103
105
  def ruby_command(paths)
104
106
  cmd_parts = ['ruby']
105
- cmd_parts += test_folders.map {|f| %[-I"#{f}"] }
107
+ cmd_parts.concat(test_folders.map {|f| %[-I"#{f}"] })
106
108
  cmd_parts << '-r rubygems' if rubygems?
107
109
  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
110
+ cmd_parts << '-r minitest/autorun'
111
+ cmd_parts.concat(paths.map { |path| "-r ./#{path}" })
112
+
113
+ unless minitest_version_gte_5?
112
114
  cmd_parts << "-r #{File.expand_path('../runners/old_runner.rb', __FILE__)}"
113
- cmd_parts << '-e \'MiniTest::Unit.autorun\''
114
115
  end
116
+
117
+ # All the work is done through minitest/autorun
118
+ # and requiring the test files, so this is just
119
+ # a placeholder so Ruby doesn't try to exceute
120
+ # code from STDIN.
121
+ cmd_parts << '-e ""'
122
+
115
123
  cmd_parts << '--'
116
124
  cmd_parts += cli_options
117
125
  end
@@ -136,6 +144,12 @@ module Guard
136
144
  end
137
145
  end
138
146
 
147
+ def minitest_version_gte_5?
148
+ requirement = Gem::Requirement.new('>= 5')
149
+ minitest_version = Gem::Version.new(::MiniTest::Unit::VERSION)
150
+ requirement.satisfied_by?(minitest_version)
151
+ end
152
+
139
153
  end
140
154
  end
141
155
  end
@@ -1,7 +1,7 @@
1
1
  module Guard
2
2
  class MinitestVersion
3
3
 
4
- VERSION = '1.0.0.rc.2'
4
+ VERSION = '1.0.0.rc.3'
5
5
 
6
6
  end
7
7
  end
@@ -1,5 +1,8 @@
1
- minitest_version = ::MiniTest::Unit::VERSION.split(/\./)
2
- if minitest_version[0].to_i >= 5 && (minitest_version[1].to_i > 0 || minitest_version[2].to_i >= 4)
1
+ require 'rubygems/requirement'
2
+
3
+ requirement = Gem::Requirement.new('>= 5.0.4')
4
+ minitest_version = Gem::Version.new(::MiniTest::Unit::VERSION)
5
+ if requirement.satisfied_by?(minitest_version)
3
6
  require 'guard/minitest/reporter'
4
7
  else
5
8
  require 'guard/minitest/reporters/old_reporter'
@@ -10,6 +13,6 @@ module Minitest
10
13
  end
11
14
 
12
15
  def self.plugin_guard_minitest_init(options) # :nodoc:
13
- self.reporter << ::Guard::Minitest::Reporter.new(File.open('/dev/null', 'w'))
16
+ self.reporter << ::Guard::Minitest::Reporter.new
14
17
  end
15
18
  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: 1.0.0.rc.2
4
+ version: 1.0.0.rc.3
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: 2013-06-19 00:00:00.000000000 Z
12
+ date: 2013-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard