Class: Overcommit::HookLoader::PluginHookLoader

Inherits:
Base
  • Object
show all
Defined in:
lib/overcommit/hook_loader/plugin_hook_loader.rb

Overview

Responsible for loading hooks that are specific to the repository Overcommit is running in.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Overcommit::HookLoader::Base

Instance Method Details

#load_hooksObject


7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/overcommit/hook_loader/plugin_hook_loader.rb', line 7

def load_hooks
  check_for_modified_plugins if @config.verify_signatures?

  hooks = plugin_paths.map do |plugin_path|
    require plugin_path

    hook_name = Overcommit::Utils.camel_case(File.basename(plugin_path, '.rb'))
    create_hook(hook_name)
  end

  hooks + ad_hoc_hook_names.map do |hook_name|
    create_ad_hoc_hook(hook_name)
  end
end

#update_signaturesObject


22
23
24
25
26
27
28
29
# File 'lib/overcommit/hook_loader/plugin_hook_loader.rb', line 22

def update_signatures
  log.success('No plugin signatures have changed') if modified_plugins.empty?

  modified_plugins.each do |plugin|
    plugin.update_signature!
    log.warning "Updated signature of plugin #{plugin.hook_name}"
  end
end