summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author☈king <rking@sharpsaw.org>2012-12-11 09:05:03 -0600
committerrking@sharpsaw.org <>2012-12-11 09:05:03 -0600
commit74498216571527626c589a074ad8b46eea4e4fb1 (patch)
tree12f5d829bf77f43d80804a565a1030243ef5b2e7
parente59cd57ebf7ed15b60dfd1bed5c5de2d69e334d2 (diff)
downloadpry-74498216571527626c589a074ad8b46eea4e4fb1.tar.gz
Factoring sorted run into 'rake recspec'
-rw-r--r--Guardfile7
-rw-r--r--Rakefile26
2 files changed, 23 insertions, 10 deletions
diff --git a/Guardfile b/Guardfile
index 4de30b0a..02a709af 100644
--- a/Guardfile
+++ b/Guardfile
@@ -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
diff --git a/Rakefile b/Rakefile
index f1c7a39b..1cb89aa6 100644
--- a/Rakefile
+++ b/Rakefile
@@ -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']