lib/pork/mode/parallel.rb in pork-1.0.4 vs lib/pork/mode/parallel.rb in pork-1.1.0
- old
+ new
@@ -2,14 +2,18 @@
require 'pork'
require 'pork/isolate'
module Pork
module Parallel
- def parallel cores=8, stat=Stat.new
- all_tests.keys.shuffle.each_slice(cores).map do |names|
+ def cores
+ 8
+ end
+
+ def parallel stat=Stat.new, paths=all_tests.values.flatten(1)
+ paths.shuffle.each_slice(cores).map do |paths_slice|
Thread.new do
s = Stat.new
- names.each{ |n| isolate(n, s) }
+ paths_slice.each{ |p| isolate(p, s) }
s
end
end.map(&:value).inject(stat, &:merge)
end
end