Class: KnapsackPro::Runners::BaseRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/knapsack_pro/runners/base_runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter_class) ⇒ BaseRunner

Returns a new instance of BaseRunner.



8
9
10
11
# File 'lib/knapsack_pro/runners/base_runner.rb', line 8

def initialize(adapter_class)
  @allocator_builder = KnapsackPro::AllocatorBuilder.new(adapter_class)
  @allocator = allocator_builder.allocator
end

Class Method Details

.run(args) ⇒ Object

Raises:

  • (NotImplementedError)


4
5
6
# File 'lib/knapsack_pro/runners/base_runner.rb', line 4

def self.run(args)
  raise NotImplementedError
end

Instance Method Details

#stringify_test_file_pathsObject



17
18
19
# File 'lib/knapsack_pro/runners/base_runner.rb', line 17

def stringify_test_file_paths
  KnapsackPro::TestFilePresenter.stringify_paths(test_file_paths)
end

#test_dirObject



21
22
23
# File 'lib/knapsack_pro/runners/base_runner.rb', line 21

def test_dir
  allocator_builder.test_dir
end

#test_file_pathsObject



13
14
15
# File 'lib/knapsack_pro/runners/base_runner.rb', line 13

def test_file_paths
  @test_file_paths ||= allocator.test_file_paths
end

#test_files_to_execute_exist?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
# File 'lib/knapsack_pro/runners/base_runner.rb', line 25

def test_files_to_execute_exist?
  if test_file_paths.empty?
    KnapsackPro.logger.info("Knapsack Pro API returned no test files to execute for the node this time. The reason might be that you changed recently a number of total nodes or you removed some test files. Please create a new commit to get a better test suite split next time.")
    false
  else
    true
  end
end