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

def load_hooks
  directory = File.join(@config.plugin_directory, @context.hook_type_name)
  plugin_paths = Dir[File.join(directory, '*.rb')].sort

  check_for_modified_plugins(plugin_paths) 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