Sha256: 46860ebd59d3bfc83d38904ceaf43257c2a6f3ba7330c50e288bf944637ed6bc

Contents?: true

Size: 936 Bytes

Versions: 12

Compression:

Stored size: 936 Bytes

Contents

module KnapsackPro
  class TestFileFinder
    def self.call(test_file_pattern)
      new(test_file_pattern).call
    end

    def initialize(test_file_pattern)
      @test_file_pattern = test_file_pattern
    end

    def call
      test_file_hashes = []
      test_files.each do |test_file_path|
        test_file_hashes << test_file_hash_for(test_file_path)
      end
      test_file_hashes
    end

    private

    attr_reader :test_file_pattern

    def test_files
      test_file_paths = Dir.glob(test_file_pattern).uniq

      excluded_test_file_paths =
        if KnapsackPro::Config::Env.test_file_exclude_pattern
          Dir.glob(KnapsackPro::Config::Env.test_file_exclude_pattern).uniq
        else
          []
        end

      (test_file_paths - excluded_test_file_paths).sort
    end

    def test_file_hash_for(test_file_path)
      {
        'path' => TestFileCleaner.clean(test_file_path)
      }
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
knapsack_pro-1.10.1 lib/knapsack_pro/test_file_finder.rb
knapsack_pro-1.10.0 lib/knapsack_pro/test_file_finder.rb
knapsack_pro-1.9.0 lib/knapsack_pro/test_file_finder.rb
knapsack_pro-1.8.0 lib/knapsack_pro/test_file_finder.rb
knapsack_pro-1.7.0 lib/knapsack_pro/test_file_finder.rb
knapsack_pro-1.6.0 lib/knapsack_pro/test_file_finder.rb
knapsack_pro-1.5.0 lib/knapsack_pro/test_file_finder.rb
knapsack_pro-1.4.0 lib/knapsack_pro/test_file_finder.rb
knapsack_pro-1.3.0 lib/knapsack_pro/test_file_finder.rb
knapsack_pro-1.2.1 lib/knapsack_pro/test_file_finder.rb
knapsack_pro-1.2.0 lib/knapsack_pro/test_file_finder.rb
knapsack_pro-1.1.0 lib/knapsack_pro/test_file_finder.rb