Sha256: fc010568ea618dd951ccd2d0cd4426db248603fbb1e86d4d9a8a8e7d43c5c055

Contents?: true

Size: 1.29 KB

Versions: 21

Compression:

Stored size: 1.29 KB

Contents

require 'parallel'
require 'parallel_tests/version'
require 'parallel_tests/grouper'
require 'parallel_tests/railtie' if defined? Rails::Railtie

module ParallelTests
  def self.determine_number_of_processes(count)
    [
      count,
      ENV['PARALLEL_TEST_PROCESSORS'],
      Parallel.processor_count
    ].detect{|c| not c.to_s.strip.empty? }.to_i
  end

  # parallel:spec[:count, :pattern, :options]
  def self.parse_rake_args(args)
    # order as given by user
    args = [args[:count], args[:pattern], args[:options]]

    # count given or empty ?
    # parallel:spec[2,models,options]
    # parallel:spec[,models,options]
    count = args.shift if args.first.to_s =~ /^\d*$/
    num_processes = count.to_i unless count.to_s.empty?
    pattern = args.shift
    options = args.shift

    [num_processes, pattern.to_s, options.to_s]
  end

  # copied from http://github.com/carlhuda/bundler Bundler::SharedHelpers#find_gemfile
  def self.bundler_enabled?
    return true if Object.const_defined?(:Bundler)

    previous = nil
    current = File.expand_path(Dir.pwd)

    until !File.directory?(current) || current == previous
      filename = File.join(current, "Gemfile")
      return true if File.exists?(filename)
      current, previous = File.expand_path("..", current), current
    end

    false
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
parallel_tests-0.8.12 lib/parallel_tests.rb
parallel_tests-0.8.11 lib/parallel_tests.rb
parallel_tests-0.8.10 lib/parallel_tests.rb
parallel_tests-0.8.9 lib/parallel_tests.rb
parallel_tests-0.8.8 lib/parallel_tests.rb
parallel_tests-0.8.7 lib/parallel_tests.rb
parallel_tests-0.8.6 lib/parallel_tests.rb
parallel_tests-0.8.5 lib/parallel_tests.rb
parallel_tests-0.8.4 lib/parallel_tests.rb
parallel_tests-0.8.3 lib/parallel_tests.rb
parallel_tests-0.8.2 lib/parallel_tests.rb
parallel_tests-0.8.1 lib/parallel_tests.rb
parallel_tests-0.8.0 lib/parallel_tests.rb
parallel_tests-0.7.4 lib/parallel_tests.rb
parallel_tests-0.7.3 lib/parallel_tests.rb
parallel_tests-0.7.2 lib/parallel_tests.rb
parallel_tests-0.7.1 lib/parallel_tests.rb
parallel_tests-0.7.0 lib/parallel_tests.rb
parallel_tests-0.7.0.rc3 lib/parallel_tests.rb
parallel_tests-0.7.0.rc2 lib/parallel_tests.rb