Permalink
Browse files

Clean code, update README and CHANGELOG

  • Loading branch information...
1 parent 3065d05 commit e76803aa1729a83ed6a9e74ad785e73aa8d02a23 @rymai rymai committed Dec 10, 2012
Showing with 52 additions and 44 deletions.
  1. +25 −16 CHANGELOG.md
  2. +2 −3 Guardfile
  3. +4 −1 README.md
  4. +3 −3 guard-minitest.gemspec
  5. +6 −6 lib/guard/minitest/inspector.rb
  6. +11 −14 lib/guard/minitest/runner.rb
  7. +1 −1 spec/spec_helper.rb
View
@@ -2,44 +2,42 @@
Upgrade to match Guard 1.1 API:
- * Deprecate `:notify` option, use guard notification configuration (Yann
- Lugrin)
- * Use `guard_on_change` method (Jason Staten)
+ * 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][])
+ * [#45][]: Use `run_on_changes` method. ([@statianzo][])
Features:
- * Add `:cli` option and deprecate `:seed` and `:verbose` options (Yann
- Lugrin)
+ * Add `:cli` option and deprecate `:seed` and `:verbose` options ([@yannlugrin][])
Documentation:
- * Update Guardfile template for Rails 4 (itzki)
- * Fix README links (Mike Manewitz & Sebastian Boehm)
+ * [#49][]: Update Guardfile template for Rails 4. ([@itzki][])
+ * [#43][] & [#46][]: Fix README links. ([@manewitz][] & [@sometimesfood][])
## 0.5.0 (Feb 24, 2012)
Bug Fixes:
- * Hard coded tests folders path (Nathan Youngman)
- * Watch subfolder in Guardfile template (Wilker Lúcio, Mark Kremer)
- * Notification work with DRB (Brian Morearty)
- * Initialized constant with ruby 1.9 (Jonas Grimfelt)
+ * Hard coded tests folders path. (Nathan Youngman)
+ * Watch subfolder in Guardfile template. (Wilker Lúcio, Mark Kremer)
+ * Notifications work with DRb. (Brian Morearty)
+ * Initialized constant with Ruby 1.9. (Jonas Grimfelt)
Features:
- * Option to overwrite test folders and test files pattern (japgolly)
+ * Option to overwrite test folders and test files pattern. ([@japgolly][])
## 0.4.0 (Jun 15, 2011)
Features:
- * Support of MiniTest 2 (Yann Lugrin)
- * DRB support (Oriol Gual)
- * Use regexp in Guardfile Template (Emmanuel Gomez)
+ * Support of MiniTest 2. ([@yannlugrin][])
+ * DRB support. (Oriol Gual)
+ * Use regexp in Guardfile Template. (Emmanuel Gomez)
Dependencies:
- * Need guard 0.4 (Yann Lugrin)
+ * Need guard 0.4 ([@yannlugrin][])
## 0.3.0 (Oct 27, 2010)
@@ -75,3 +73,14 @@ Documentation:
First stable release
+<!--- The following link definition list is generated by PimpMyChangelog --->
+[#43]: https://github.com/guard/guard/issues/43
+[#45]: https://github.com/guard/guard/issues/45
+[#46]: https://github.com/guard/guard/issues/46
+[#49]: https://github.com/guard/guard/issues/49
+[@itzki]: https://github.com/itzki
+[@japgolly]: https://github.com/japgolly
+[@manewitz]: https://github.com/manewitz
+[@sometimesfood]: https://github.com/sometimesfood
+[@statianzo]: https://github.com/statianzo
+[@yannlugrin]: https://github.com/yannlugrin
View
@@ -1,7 +1,6 @@
-
guard 'minitest' do
watch(%r|^spec/(.*)_spec\.rb|)
- watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
- watch(%r|^spec/spec_helper\.rb|) { 'spec' }
+ watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
+ watch(%r|^spec/spec_helper\.rb|) { 'spec' }
end
View
@@ -91,9 +91,12 @@ end
### List of available options:
```ruby
-:notify => false # disable desktop notifications
+:cli => '--test' # pass arbitrary Minitest CLI arguments, default: ''
:bundler => false # don't use "bundle exec" to run the minitest command, default: true
:rubygems => true # require rubygems when run the minitest command (only if bundler is disabled), default: false
+:drb => true # enable DRb support, default: false
+:test_folders => ['tests'] # specify an array of paths that contain test files, default: %w[test spec]
+: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]
```
Development
View
@@ -18,9 +18,9 @@ Gem::Specification.new do |s|
s.add_dependency 'guard', '~> 1.1'
s.add_development_dependency 'rake'
- s.add_development_dependency 'minitest', '~> 2.1'
- s.add_development_dependency 'bundler', '~> 1.0'
- s.add_development_dependency 'mocha', '~> 0.10'
+ s.add_development_dependency 'minitest', '~> 2.1'
+ s.add_development_dependency 'bundler', '~> 1.0'
+ s.add_development_dependency 'mocha', '~> 0.10'
s.files = Dir.glob('{lib}/**/*') + %w[LICENSE README.md CHANGELOG.md]
s.require_path = 'lib'
@@ -21,7 +21,7 @@ def clean(paths)
paths.dup.each do |path|
if File.directory?(path)
paths.delete(path)
- paths += test_files_for_pathes([path])
+ paths += test_files_for_paths([path])
end
end
@@ -48,17 +48,17 @@ def test_file?(path)
end
def test_files
- @test_files ||= test_files_for_pathes(self.test_folders)
+ @test_files ||= test_files_for_paths(self.test_folders)
end
def join_for_glob(fragments)
"{#{fragments.join ','}}"
end
- def test_files_for_pathes(pathes)
- pathes= join_for_glob(pathes)
- files= join_for_glob(self.test_file_patterns)
- Dir.glob(pathes + '/**/' + files)
+ def test_files_for_paths(paths)
+ paths = join_for_glob(paths)
+ files = join_for_glob(self.test_file_patterns)
+ Dir.glob(paths + '/**/' + files)
end
def clear_test_files_list
@@ -15,15 +15,17 @@ def initialize(options = {})
parse_deprecated_options(options)
@options = {
- :bundler => File.exist?("#{Dir.pwd}/Gemfile"),
- :rubygems => false,
- :drb => false,
+ :bundler => File.exist?("#{Dir.pwd}/Gemfile"),
+ :rubygems => false,
+ :drb => false,
:test_folders => %w[test spec],
:test_file_patterns => %w[*_test.rb test_*.rb *_spec.rb],
- :cli => ''
+ :cli => ''
}.merge(options)
- [:test_folders,:test_file_patterns].each {|k| (@options[k]= [@options[k]].flatten.uniq.compact).freeze}
- options= options.freeze
+
+ [:test_folders, :test_file_patterns].each do |k|
+ @options[k] = Array(@options[k]).uniq.compact
+ end
end
def run(paths, options = {})
@@ -36,10 +38,6 @@ def cli_options
@options[:cli] ||= ''
end
- def verbose?
- @options[:cli].include?('--verbose')
- end
-
def notify?
!!@options[:notification]
end
@@ -78,13 +76,13 @@ def minitest_command(paths)
cmd_parts << "#{f}/test_helper.rb" if File.exist?("#{f}/test_helper.rb")
cmd_parts << "#{f}/spec_helper.rb" if File.exist?("#{f}/spec_helper.rb")
end
- cmd_parts += paths.map{|path| "./#{path}" }
+ cmd_parts += paths.map{ |path| "./#{path}" }
else
cmd_parts << 'ruby'
cmd_parts += test_folders.map{|f| %[-I"#{f}"] }
cmd_parts << '-r rubygems' if rubygems?
cmd_parts << '-r bundler/setup' if bundler?
- cmd_parts += paths.map{|path| "-r ./#{path}" }
+ cmd_parts += paths.map{ |path| "-r ./#{path}" }
cmd_parts << "-r #{File.expand_path('../runners/default_runner.rb', __FILE__)}"
cmd_parts << '-e \'MiniTest::Unit.autorun\''
cmd_parts << '--' << cli_options unless cli_options.empty?
@@ -96,8 +94,7 @@ def minitest_command(paths)
def parse_deprecated_options(options)
options[:cli] ||= ''
- if value = options.delete(:notify)
- options[:notification] = value
+ if options.key?(:notify)
UI.info %{DEPRECATION WARNING: The :notify option is deprecated. Guard notification configuration is used.}
end
View
@@ -1,6 +1,6 @@
# encoding: utf-8
require 'minitest/spec'
-require 'mocha'
+require 'mocha/setup'
require 'guard/minitest'

0 comments on commit e76803a

Please sign in to comment.