Sha256: 43d7fd42ddb344002840a158aa1afec1ca5b1326ddbc47d71ac644b6f0b0ad97

Contents?: true

Size: 646 Bytes

Versions: 4

Compression:

Stored size: 646 Bytes

Contents

module Pronto
  class Runners
    def initialize(runners = Runner.runners, config = Config.new)
      @runners = runners
      @config = config
    end

    def run(patches)
      patches = reject_excluded(patches)
      return [] unless patches.any?

      @runners.map { |runner| runner.new.run(patches, patches.commit) }
        .flatten.compact
    end

    private

    def reject_excluded(patches)
      return patches unless @config.excluded_files.any?
      patches.reject! { |patch| excluded?(patch) }
      patches
    end

    def excluded?(patch)
      @config.excluded_files.include?(patch.new_file_full_path.to_s)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pronto-0.5.3 lib/pronto/runners.rb
pronto-0.5.2 lib/pronto/runners.rb
pronto-0.5.1 lib/pronto/runners.rb
pronto-0.5.0 lib/pronto/runners.rb