lib/pork/mode/parallel.rb in pork-1.5.0 vs lib/pork/mode/parallel.rb in pork-2.0.0
- old
+ new
@@ -1,23 +1,22 @@
require 'pork/mode/shuffled'
module Pork
- module Parallel
+ class Parallel < Struct.new(:isolator)
def cores
8
end
- def parallel stat=Stat.new, paths=all_paths
+ def execute stat=Stat.new, paths=isolator.all_paths
+ executor = Shuffled.new(isolator)
stat.prepare(paths)
paths.shuffle.each_slice(cores).map do |paths_slice|
Thread.new do
- execute(:shuffled,
- Stat.new(stat.reporter, stat.protected_exceptions),
- paths_slice)
+ executor.execute(
+ Stat.new(stat.reporter, stat.protected_exceptions),
+ paths_slice)
end
end.map(&:value).inject(stat, &:merge)
end
end
-
- Executor.extend(Parallel)
end