Class: Knapsack::Allocator

Inherits:
Object
  • Object
show all
Defined in:
lib/knapsack/allocator.rb

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Allocator

Returns a new instance of Allocator.



3
4
5
6
# File 'lib/knapsack/allocator.rb', line 3

def initialize(args={})
  @report_distributor = Knapsack::Distributors::ReportDistributor.new(args)
  @leftover_distributor = Knapsack::Distributors::LeftoverDistributor.new(args)
end

Instance Method Details

#leftover_node_testsObject



12
13
14
# File 'lib/knapsack/allocator.rb', line 12

def leftover_node_tests
  @leftover_node_tests ||= @leftover_distributor.tests_for_current_node
end

#node_testsObject



16
17
18
# File 'lib/knapsack/allocator.rb', line 16

def node_tests
  @node_tests ||= report_node_tests + leftover_node_tests
end

#report_node_testsObject



8
9
10
# File 'lib/knapsack/allocator.rb', line 8

def report_node_tests
  @report_node_tests ||= @report_distributor.tests_for_current_node
end

#stringify_node_testsObject



20
21
22
23
24
25
# File 'lib/knapsack/allocator.rb', line 20

def stringify_node_tests
  node_tests
  .map do |test_file|
    %{"#{test_file}"}
  end.join(' ')
end

#test_dirObject



27
28
29
# File 'lib/knapsack/allocator.rb', line 27

def test_dir
  Knapsack::Config::Env.test_dir || @report_distributor.test_file_pattern.split('/').first
end