Module: CI::Queue

Extended by:
Queue
Included in:
Queue
Defined in:
lib/ci/queue.rb,
lib/ci/queue/file.rb,
lib/ci/queue/redis.rb,
lib/ci/queue/bisect.rb,
lib/ci/queue/static.rb,
lib/ci/queue/version.rb,
lib/ci/queue/redis/base.rb,
lib/ci/queue/redis/retry.rb,
lib/ci/queue/build_record.rb,
lib/ci/queue/redis/worker.rb,
lib/ci/queue/configuration.rb,
lib/ci/queue/output_helpers.rb,
lib/ci/queue/redis/supervisor.rb,
lib/ci/queue/redis/build_record.rb

Defined Under Namespace

Modules: OutputHelpers, Redis Classes: Bisect, BuildRecord, Configuration, File, Static

Constant Summary collapse

VERSION =
'0.12.1'
DEV_SCRIPTS_ROOT =
::File.expand_path('../../../../../redis', __FILE__)
RELEASE_SCRIPTS_ROOT =
::File.expand_path('../redis', __FILE__)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#shufflerObject

Returns the value of attribute shuffler.



16
17
18
# File 'lib/ci/queue.rb', line 16

def shuffler
  @shuffler
end

Instance Method Details

#from_uri(url, config) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ci/queue.rb', line 26

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

#shuffle(tests, random) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/ci/queue.rb', line 18

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