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
# File 'lib/overcommit/hook_loader/plugin_hook_loader.rb', line 7

def load_hooks
  check_for_modified_plugins if @config.verify_plugin_signatures?

  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
end

#update_signaturesObject



18
19
20
21
22
23
24
25
# File 'lib/overcommit/hook_loader/plugin_hook_loader.rb', line 18

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