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

Returns a new instance of 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
21
22
23
24
# File 'lib/pronto/runners.rb', line 8

def run(patches)
  patches = reject_excluded(@config.excluded_files('all'), patches)
  return [] if patches.none?

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