Sha256: e4c914cb0135f482e1df37f62776164845fb087da77d61863ae1b390cf5b7778

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

require 'uri'
require 'cgi'

require 'ci/queue/version'
require 'ci/queue/output_helpers'
require 'ci/queue/configuration'
require 'ci/queue/static'
require 'ci/queue/file'
require 'ci/queue/bisect'

module CI
  module Queue
    extend self

    attr_accessor :shuffler

    def shuffle(tests, random)
      if shuffler
        shuffler.call(tests, random)
      else
        tests.sort.shuffle(random: random)
      end
    end

    def from_uri(url, config)
      uri = URI(url)
      implementation = case uri.scheme
      when 'list'
        Static
      when 'file', nil
        File
      when 'redis'
        require 'ci/queue/redis'
        Redis
      else
        raise ArgumentError, "Don't know how to handle #{uri.scheme} URLs"
      end
      implementation.from_uri(uri, config)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ci-queue-0.10.1 lib/ci/queue.rb
ci-queue-0.10.0 lib/ci/queue.rb
ci-queue-0.9.2 lib/ci/queue.rb