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) ⇒ HookRunner

Returns a new instance of HookRunner.



7
8
9
10
11
12
# File 'lib/overcommit/hook_runner.rb', line 7

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

Instance Method Details

#runObject

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



15
16
17
18
19
20
21
# File 'lib/overcommit/hook_runner.rb', line 15

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