diff options
author | ☈king <rking@sharpsaw.org> | 2012-12-11 09:05:03 -0600 |
---|---|---|
committer | rking@sharpsaw.org <> | 2012-12-11 09:05:03 -0600 |
commit | 74498216571527626c589a074ad8b46eea4e4fb1 (patch) | |
tree | 12f5d829bf77f43d80804a565a1030243ef5b2e7 | |
parent | e59cd57ebf7ed15b60dfd1bed5c5de2d69e334d2 (diff) | |
download | pry-74498216571527626c589a074ad8b46eea4e4fb1.tar.gz |
Factoring sorted run into 'rake recspec'
-rw-r--r-- | Guardfile | 7 | ||||
-rw-r--r-- | Rakefile | 26 |
2 files changed, 23 insertions, 10 deletions
@@ -11,12 +11,7 @@ module ::Guard def run_on_changes(paths) paths.delete('some_lib') if paths.size.zero? - all = Dir['spec/**/*_spec.rb'].sort_by{|path| File.mtime(path)}.reverse - warn <<-EOT -No deduced mapping. -Running all, sorting by mtime: #{all[0..2].join(' ')} ...etc. - EOT - system "rake spec run=#{all.join(',')}" or return + system 'rake recspec' else paths.each do |path| system "rake spec run=#{path}" or return @@ -45,20 +45,38 @@ end desc "Set up and run tests" task :default => [:test] +unless [].respond_to? :shuffle! + class Array + def shuffle! + # TODO: fill this in if anyone cares + self + end + end +end + +def run_specs paths + exec "bacon -Ispec -rubygems -q #{paths.join ' '}" +end + desc "Run tests" task :test do check_dependencies unless ENV['SKIP_DEP_CHECK'] - all_specs = + paths = if explicit_list = ENV['run'] explicit_list.split(',') else - Dir['spec/**/*_spec.rb'] + Dir['spec/**/*_spec.rb'].shuffle! end - all_specs.shuffle! if all_specs.respond_to? :shuffle! - exec "bacon -Ispec -rubygems -q #{all_specs.join ' '}" + run_specs paths end task :spec => :test +task :recspec do + all = Dir['spec/**/*_spec.rb'].sort_by{|path| File.mtime(path)}.reverse + warn "Running all, sorting by mtime: #{all[0..2].join(' ')} ...etc." + run_specs all +end + desc "Run pry" task :pry do check_dependencies unless ENV['SKIP_DEP_CHECK'] |