Sha256: 9eb506f15f04de66512720f46a3cf319e74c07eefc79e5af74dd240d456386f4

Contents?: true

Size: 435 Bytes

Versions: 4

Compression:

Stored size: 435 Bytes

Contents

require 'pork'
require 'pork/isolate'

module Pork
  module Parallel
    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
          paths_slice.each{ |p| isolate(p, s) }
          s
        end
      end.map(&:value).inject(stat, &:merge)
    end
  end

  Executor.extend(Parallel)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pork-1.1.3 lib/pork/mode/parallel.rb
pork-1.1.2 lib/pork/mode/parallel.rb
pork-1.1.1 lib/pork/mode/parallel.rb
pork-1.1.0 lib/pork/mode/parallel.rb