Class: Overcommit::HookRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/overcommit/hook_runner.rb

Overview

Responsible for loading the hooks the repository has configured and running them, collecting and displaying the results.

Instance Method Summary collapse

Constructor Details

#initialize(config, logger, context, input) ⇒ HookRunner

Returns a new instance of HookRunner.



11
12
13
14
15
16
17
# File 'lib/overcommit/hook_runner.rb', line 11

def initialize(config, logger, context, input)
  @config = config
  @log = logger
  @context = context
  @input = input
  @hooks = []
end

Instance Method Details

#runObject

Loads and runs the hooks registered for this Overcommit::HookRunner.



20
21
22
23
24
25
26
# File 'lib/overcommit/hook_runner.rb', line 20

def run
  @context.setup_environment
  load_hooks
  run_hooks
ensure
  @context.cleanup_environment
end