Sha256: cb0f375951df3adabe02efb02eb73f92136025a719303781d7ac03523c96b248

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require 'uri'
require 'cgi'

require 'ci/queue/version'
require 'ci/queue/output_helpers'
require 'ci/queue/circuit_breaker'
require 'ci/queue/configuration'
require 'ci/queue/common'
require 'ci/queue/build_record'
require 'ci/queue/static'
require 'ci/queue/file'
require 'ci/queue/grind'
require 'ci/queue/bisect'

module CI
  module Queue
    extend self

    attr_accessor :shuffler, :requeueable

    module Warnings
      RESERVED_LOST_TEST = :RESERVED_LOST_TEST
    end

    def requeueable?(test_result)
      requeueable.nil? || requeueable.call(test_result)
    end

    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', 'rediss'
        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

7 entries across 7 versions & 1 rubygems

Version Path
ci-queue-0.41.0 lib/ci/queue.rb
ci-queue-0.40.0 lib/ci/queue.rb
ci-queue-0.39.0 lib/ci/queue.rb
ci-queue-0.38.0 lib/ci/queue.rb
ci-queue-0.37.0 lib/ci/queue.rb
ci-queue-0.36.0 lib/ci/queue.rb
ci-queue-0.35.0 lib/ci/queue.rb