guard-minitest 0.5.0 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,77 @@
1
+ ## 1.0.0 (beta 1)
2
+
3
+ Upgrade to match Guard 1.1 API:
4
+
5
+ * Deprecate `:notify` option, use guard notification configuration (Yann
6
+ Lugrin)
7
+ * Use `guard_on_change` method (Jason Staten)
8
+
9
+ Features:
10
+
11
+ * Add `:cli` option and deprecate `:seed` and `:verbose` options (Yann
12
+ Lugrin)
13
+
14
+ Documentation:
15
+
16
+ * Update Guardfile template for Rails 4 (itzki)
17
+ * Fix README links (Mike Manewitz & Sebastian Boehm)
18
+
19
+ ## 0.5.0 (Feb 24, 2012)
20
+
21
+ Bug Fixes:
22
+
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)
27
+
28
+ Features:
29
+
30
+ * Option to overwrite test folders and test files pattern (japgolly)
31
+
32
+ ## 0.4.0 (Jun 15, 2011)
33
+
34
+ Features:
35
+
36
+ * Support of MiniTest 2 (Yann Lugrin)
37
+ * DRB support (Oriol Gual)
38
+ * Use regexp in Guardfile Template (Emmanuel Gomez)
39
+
40
+ Dependencies:
41
+
42
+ * Need guard 0.4 (Yann Lugrin)
43
+
44
+ ## 0.3.0 (Oct 27, 2010)
45
+
46
+ Bug Fixes:
47
+
48
+ * All guard API action return a boolean value
49
+ * Depends on guard 0.2.2 to fix darwin watching problems
50
+
51
+ Features:
52
+
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)
56
+
57
+ ## 0.2.2 (Oct 24, 2010)
58
+
59
+ Bug Fixes:
60
+
61
+ * Depends on guard 0.2.1 to fix linux watching probalems
62
+ * Remove duplicate code
63
+
64
+ ## 0.2.1 (Oct 22, 2010)
65
+
66
+ Bug Fixes:
67
+
68
+ * Don't set minitest seed option by default
69
+
70
+ Documentation:
71
+
72
+ * Tested on ruby 1.8.6
73
+
74
+ ## 0.2.0 (Oct 20, 2010)
75
+
76
+ First stable release
77
+
@@ -0,0 +1,112 @@
1
+ Guard::Minitest [![Build Status](https://secure.travis-ci.org/guard/guard-minitest.png?branch=master)](http://travis-ci.org/guard/guard-minitest)
2
+ ===============
3
+
4
+ Minitest guard allows to automatically & intelligently launch tests with
5
+ [minitest framework](http://github.com/seattlerb/minitest) when files are modified.
6
+
7
+ * Compatible with MiniTest 1.7.x & 2.x
8
+ * Tested on Ruby 1.8.7, 1.9.2 & 1.9.3
9
+
10
+ Install
11
+ -------
12
+
13
+ Please be sure to have [Guard](http://github.com/guard/guard) installed before continue.
14
+
15
+ Install the gem:
16
+
17
+ ```bash
18
+ gem install guard-minitest
19
+ ```
20
+
21
+ Add it to your Gemfile (inside test group):
22
+
23
+ ```ruby
24
+ gem 'guard-minitest'
25
+ ```
26
+
27
+ Add guard definition to your Guardfile by running this command:
28
+
29
+ ```bash
30
+ guard init minitest
31
+ ```
32
+
33
+ Usage
34
+ -----
35
+
36
+ Please read [Guard usage doc](http://github.com/guard/guard#readme)
37
+
38
+ Guardfile
39
+ ---------
40
+
41
+ Minitest guard can be really adapated to all kind of projects.
42
+ Please read [guard doc](http://github.com/guard/guard#readme) for more info about Guardfile DSL.
43
+
44
+ ### Standard ruby gems with Minitest::Unit
45
+
46
+ ```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" }
51
+ end
52
+ ```
53
+
54
+ ### Standard ruby gems with Minitest::Spec
55
+
56
+ ```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" }
61
+ end
62
+ ```
63
+
64
+ Options
65
+ -------
66
+
67
+ You can change the default location and pattern of minitest files:
68
+
69
+ ```ruby
70
+ guard 'minitest', test_folders: 'test/unit', test_file_patterns: '*_test.rb' do
71
+ # ...
72
+ end
73
+ ```
74
+
75
+ You can pass any of the standard MiniTest CLI options using the :cli option:
76
+
77
+ ```ruby
78
+ guard 'minitest', :cli => "--seed 123456 --verbose" do
79
+ # ...
80
+ end
81
+ ```
82
+
83
+ If you use [spork-testunit](https://github.com/sporkrb/spork-testunit) you can enable it with (you'll have to load it before):
84
+
85
+ ```ruby
86
+ guard 'minitest', :drb => true do
87
+ # ...
88
+ end
89
+ ```
90
+
91
+ ### List of available options:
92
+
93
+ ```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
97
+ ```
98
+
99
+ Development
100
+ -----------
101
+
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)
104
+
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.
107
+
108
+ Authors
109
+ -------
110
+
111
+ [Yann Lugrin](http://github.com/yannlugrin)
112
+
@@ -11,8 +11,8 @@ module Guard
11
11
  def initialize(watchers = [], options = {})
12
12
  super
13
13
 
14
- @runner ||= Runner.new(options)
15
- @inspector= Inspector.new(@runner.test_folders, @runner.test_file_patterns)
14
+ @runner = Runner.new(options)
15
+ @inspector = Inspector.new(@runner.test_folders, @runner.test_file_patterns)
16
16
  end
17
17
 
18
18
  def start
@@ -33,7 +33,7 @@ module Guard
33
33
  true
34
34
  end
35
35
 
36
- def run_on_change(paths = [])
36
+ def run_on_changes(paths = [])
37
37
  paths = @inspector.clean(paths)
38
38
  return @runner.run(paths) unless paths.empty?
39
39
  true
@@ -12,14 +12,15 @@ module Guard
12
12
  end
13
13
 
14
14
  def initialize(options = {})
15
+ parse_deprecated_options(options)
16
+
15
17
  @options = {
16
- :verbose => false,
17
- :notify => true,
18
18
  :bundler => File.exist?("#{Dir.pwd}/Gemfile"),
19
19
  :rubygems => false,
20
20
  :drb => false,
21
21
  :test_folders => %w[test spec],
22
22
  :test_file_patterns => %w[*_test.rb test_*.rb *_spec.rb],
23
+ :cli => ''
23
24
  }.merge(options)
24
25
  [:test_folders,:test_file_patterns].each {|k| (@options[k]= [@options[k]].flatten.uniq.compact).freeze}
25
26
  options= options.freeze
@@ -31,16 +32,16 @@ module Guard
31
32
  system(minitest_command(paths))
32
33
  end
33
34
 
34
- def seed
35
- @options[:seed]
35
+ def cli_options
36
+ @options[:cli] ||= ''
36
37
  end
37
38
 
38
39
  def verbose?
39
- @options[:verbose]
40
+ @options[:cli].include?('--verbose')
40
41
  end
41
42
 
42
43
  def notify?
43
- @options[:notify]
44
+ !!@options[:notification]
44
45
  end
45
46
 
46
47
  def bundler?
@@ -67,45 +68,50 @@ module Guard
67
68
 
68
69
  def minitest_command(paths)
69
70
  cmd_parts = []
71
+
70
72
  cmd_parts << "bundle exec" if bundler?
71
73
  if drb?
72
74
  cmd_parts << 'testdrb'
73
75
  cmd_parts << "-r #{File.expand_path('../runners/default_runner.rb', __FILE__)}"
74
- if notify?
75
- cmd_parts << '-e \'::GUARD_NOTIFY=true\''
76
- else
77
- cmd_parts << '-e \'::GUARD_NOTIFY=false\''
78
- end
76
+ cmd_parts << "-e '::GUARD_NOTIFY=#{notify?}'"
79
77
  test_folders.each do |f|
80
78
  cmd_parts << "#{f}/test_helper.rb" if File.exist?("#{f}/test_helper.rb")
81
79
  cmd_parts << "#{f}/spec_helper.rb" if File.exist?("#{f}/spec_helper.rb")
82
80
  end
83
- paths.each do |path|
84
- cmd_parts << "./#{path}"
85
- end
81
+ cmd_parts += paths.map{|path| "./#{path}" }
86
82
  else
87
83
  cmd_parts << 'ruby'
88
- cmd_parts.concat test_folders.map{|f| %[-I"#{f}"]}
84
+ cmd_parts += test_folders.map{|f| %[-I"#{f}"] }
89
85
  cmd_parts << '-r rubygems' if rubygems?
90
86
  cmd_parts << '-r bundler/setup' if bundler?
91
- paths.each do |path|
92
- cmd_parts << "-r ./#{path}"
93
- end
87
+ cmd_parts += paths.map{|path| "-r ./#{path}" }
94
88
  cmd_parts << "-r #{File.expand_path('../runners/default_runner.rb', __FILE__)}"
95
- if notify?
96
- cmd_parts << '-e \'GUARD_NOTIFY=true; MiniTest::Unit.autorun\''
97
- else
98
- cmd_parts << '-e \'GUARD_NOTIFY=false; MiniTest::Unit.autorun\''
99
- end
100
- cmd_parts << '--'
101
- cmd_parts << "--seed #{seed}" unless seed.nil?
102
- cmd_parts << '--verbose' if verbose?
89
+ cmd_parts << '-e \'MiniTest::Unit.autorun\''
90
+ cmd_parts << '--' << cli_options unless cli_options.empty?
103
91
  end
104
- cmd= cmd_parts.join(' ')
105
- puts "Running: #{cmd}\n\n" if verbose?
106
- cmd
92
+
93
+ cmd_parts.join(' ')
107
94
  end
108
95
 
96
+ def parse_deprecated_options(options)
97
+ options[:cli] ||= ''
98
+
99
+ if value = options.delete(:notify)
100
+ options[:notification] = value
101
+ UI.info %{DEPRECATION WARNING: The :notify option is deprecated. Guard notification configuration is used.}
102
+ end
103
+
104
+ [: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
110
+
111
+ UI.info %{DEPRECATION WARNING: The :#{key} option is deprecated. Pass standard command line argument "--#{key}" to MiniTest with the :cli option.}
112
+ end
113
+ end
114
+ end
109
115
  end
110
116
  end
111
117
  end
@@ -9,13 +9,22 @@ guard 'minitest' do
9
9
  # watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
10
10
  # watch(%r|^spec/spec_helper\.rb|) { "spec" }
11
11
 
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" }
20
+
12
21
  # Rails 3.2
13
22
  # watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
14
23
  # watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
15
- # watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
16
-
24
+ # watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
25
+
17
26
  # Rails
18
27
  # watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/functional/#{m[1]}_test.rb" }
19
28
  # watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
20
- # watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
29
+ # watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
21
30
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Guard
3
3
  module MinitestVersion
4
- VERSION = '0.5.0'
4
+ VERSION = '1.0.0.beta1'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,60 +1,96 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
5
- prerelease:
4
+ version: 1.0.0.beta1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Yann Lugrin
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-24 00:00:00.000000000Z
12
+ date: 2012-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
- requirement: &70345958430120 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0.4'
21
+ version: '1.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70345958430120
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !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'
25
46
  - !ruby/object:Gem::Dependency
26
47
  name: minitest
27
- requirement: &70345958427960 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
28
49
  none: false
29
50
  requirements:
30
51
  - - ~>
31
52
  - !ruby/object:Gem::Version
32
- version: 2.1.0
53
+ version: '2.1'
33
54
  type: :development
34
55
  prerelease: false
35
- version_requirements: *70345958427960
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.1'
36
62
  - !ruby/object:Gem::Dependency
37
63
  name: bundler
38
- requirement: &70345958424920 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
39
65
  none: false
40
66
  requirements:
41
- - - ! '>='
67
+ - - ~>
42
68
  - !ruby/object:Gem::Version
43
- version: 1.0.2
69
+ version: '1.0'
44
70
  type: :development
45
71
  prerelease: false
46
- version_requirements: *70345958424920
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.0'
47
78
  - !ruby/object:Gem::Dependency
48
79
  name: mocha
49
- requirement: &70345958423720 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
50
81
  none: false
51
82
  requirements:
52
- - - ! '>='
83
+ - - ~>
53
84
  - !ruby/object:Gem::Version
54
- version: 0.9.8
85
+ version: '0.10'
55
86
  type: :development
56
87
  prerelease: false
57
- version_requirements: *70345958423720
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '0.10'
58
94
  description: Guard::Minitest automatically run your tests with MiniTest framework
59
95
  (much like autotest)
60
96
  email:
@@ -73,7 +109,8 @@ files:
73
109
  - lib/guard/minitest/version.rb
74
110
  - lib/guard/minitest.rb
75
111
  - LICENSE
76
- - README.rdoc
112
+ - README.md
113
+ - CHANGELOG.md
77
114
  homepage: http://rubygems.org/gems/guard-minitest
78
115
  licenses: []
79
116
  post_install_message:
@@ -91,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
128
  version: '0'
92
129
  segments:
93
130
  - 0
94
- hash: -1925224894391097587
131
+ hash: 97313028328538676
95
132
  required_rubygems_version: !ruby/object:Gem::Requirement
96
133
  none: false
97
134
  requirements:
@@ -100,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
137
  version: 1.3.6
101
138
  requirements: []
102
139
  rubyforge_project: guard-minitest
103
- rubygems_version: 1.8.10
140
+ rubygems_version: 1.8.24
104
141
  signing_key:
105
142
  specification_version: 3
106
143
  summary: Guard gem for MiniTest framework
@@ -1,106 +0,0 @@
1
- = Guard::Minitest
2
-
3
- {<img src="https://secure.travis-ci.org/guard/guard-minitest.png" />}[http://travis-ci.org/guard/guard-minitest]
4
-
5
- Minitest guard allows to automatically & intelligently launch tests with
6
- {minitest framework}[http://github.com/seattlerb/minitest] when files are modified.
7
-
8
- - Compatible with MiniTest 1.7.x & 2.x
9
- - Tested on Ruby 1.8.6, 1.8.7 & 1.9.2.
10
-
11
- == Install
12
-
13
- Please be sure to have {guard}[http://github.com/guard/guard] installed before continue.
14
-
15
- Install the gem:
16
-
17
- gem install guard-minitest
18
-
19
- Add it to your Gemfile (inside test group):
20
-
21
- gem 'guard-minitest'
22
-
23
- Add guard definition to your Guardfile by running this command:
24
-
25
- guard init minitest
26
-
27
- == Usage
28
-
29
- Please read {guard usage doc}[http://github.com/guard/guard#readme]
30
-
31
- == Guardfile
32
-
33
- Minitest guard can be really be adapated to all kind of projects.
34
- Please read {guard doc}[http://github.com/guard/guard#readme] for more info about Guardfile DSL.
35
-
36
- === Standard ruby gems with Minitest::Unit
37
-
38
- guard 'minitest' do
39
- watch(%r|^test/test_(.*)\.rb|)
40
- watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
41
- watch(%r|^test/test_helper\.rb|) { "test" }
42
- end
43
-
44
- === Standard ruby gems with Minitest::Spec
45
-
46
- guard 'minitest' do
47
- watch(%r|^spec/(.*)_spec\.rb|)
48
- watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
49
- watch(%r|^spec/spec_helper\.rb|) { "spec" }
50
- end
51
-
52
- == Options
53
-
54
- You can force minitest seed with:
55
-
56
- guard 'minitest', :seed => 12345 do
57
- ...
58
- end
59
-
60
- You can set minitest verbose mode with:
61
-
62
- guard 'minitest', :verbose => true do
63
- ...
64
- end
65
-
66
- You can change the default location and pattern of minitest files:
67
-
68
- guard 'minitest', test_folders: 'test/unit', test_file_patterns: '*_test.rb' do
69
- ...
70
- end
71
-
72
- You can disable desktop notification with:
73
-
74
- guard 'minitest', :notify => false do
75
- ...
76
- end
77
-
78
- You can disable bundler usage to run minitest with:
79
-
80
- guard 'minitest', :bundler => false do
81
- ...
82
- end
83
-
84
- You can enable rubygems usage to run minitest (only if bundler is not present or disabale) with:
85
-
86
- guard 'minitest', :rubygems => true do
87
- ...
88
- end
89
-
90
- If you use {spork-testunit}[https://github.com/timcharper/spork-testunit] you can enable it with (you'll have to load it before):
91
-
92
- guard 'minitest', :drb => true do
93
- ...
94
- end
95
-
96
- == Development
97
-
98
- - Source hosted at {GitHub}[http://github.com/guard/guard-minitest]
99
- - Report issues/Questions/Feature requests on {GitHub Issues}[http://github.com/guard/guard-minitest/issues]
100
-
101
- Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
102
- you make.
103
-
104
- == Authors
105
-
106
- {Yann Lugrin}[http://github.com/yannlugrin]