class Knapsack::AllocatorBuilder

Public Class Methods

new(adapter_class) click to toggle source
# File lib/knapsack/allocator_builder.rb, line 3
def initialize(adapter_class)
  @adapter_class = adapter_class
  set_report_path
end

Public Instance Methods

allocator() click to toggle source
# File lib/knapsack/allocator_builder.rb, line 8
def allocator
  Knapsack::Allocator.new({
    report: Knapsack.report.open,
    test_file_pattern: test_file_pattern,
    ci_node_total: Knapsack::Config::Env.ci_node_total,
    ci_node_index: Knapsack::Config::Env.ci_node_index
  })
end
test_dir() click to toggle source
# File lib/knapsack/allocator_builder.rb, line 17
def test_dir
  Knapsack::Config::Env.test_dir || test_file_pattern.split('/').first
end

Private Instance Methods

report_path() click to toggle source
# File lib/knapsack/allocator_builder.rb, line 29
def report_path
  Knapsack::Config::Env.report_path || @adapter_class::REPORT_PATH
end
set_report_path() click to toggle source
# File lib/knapsack/allocator_builder.rb, line 23
def set_report_path
  Knapsack.report.config({
    report_path: report_path
  })
end
test_file_pattern() click to toggle source
# File lib/knapsack/allocator_builder.rb, line 33
def test_file_pattern
  Knapsack::Config::Env.test_file_pattern || @adapter_class::TEST_DIR_PATTERN
end