Class: Pronto::Runners

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

Instance Method Summary collapse

Constructor Details

#initialize(runners = Runner.runners, config = Config.new) ⇒ Runners



3
4
5
6
# File 'lib/pronto/runners.rb', line 3

def initialize(runners = Runner.runners, config = Config.new)
  @runners = runners
  @config = config
end

Instance Method Details

#run(patches) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pronto/runners.rb', line 8

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

  result = []
  @runners.each do |runner|
    next if exceeds_max?(result)
    @config.logger.log("Running #{runner}")
    result += runner.new(patches, patches.commit).run.flatten.compact
  end
  result = result.take(@config.max_warnings) if @config.max_warnings
  result
end