Sha256: 7cf2ef52b8da0ab35e8745b23b46364ea6d3b32d985609c9b27b696457d8cb35

Contents?: true

Size: 1.15 KB

Versions: 23

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module KnapsackPro
  module Runners
    class BaseRunner
      def self.run(args)
        raise NotImplementedError
      end

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

      def test_file_paths
        @test_file_paths ||= allocator.test_file_paths
      end

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

      def test_dir
        allocator_builder.test_dir
      end

      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

      private

      attr_reader :allocator_builder,
        :allocator

      def self.child_status
        $?
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
knapsack_pro-7.13.0 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.12.1 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.12.0 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.11.0 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.10.0 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.9.0 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.8.2 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.8.1 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.8.0 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.7.0 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.6.2 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.6.1 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.6.0 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.1.0 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.0.1 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-7.0.0 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-6.0.4 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-6.0.3 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-6.0.2 lib/knapsack_pro/runners/base_runner.rb
knapsack_pro-6.0.1 lib/knapsack_pro/runners/base_runner.rb