Sha256: 73eb7a47d92dc4a064ec1dad51ea0c6dab5a6ac10af6e463cfe6fc82f3573c74

Contents?: true

Size: 705 Bytes

Versions: 5

Compression:

Stored size: 705 Bytes

Contents

# Utility module which manages the creation of {HookContext}s.
module Overcommit::HookContext
  def self.create(hook_type, config, args)
    hook_type_class = Overcommit::Utils.camel_case(hook_type)
    underscored_hook_type = Overcommit::Utils.snake_case(hook_type)

    require "overcommit/hook_context/#{underscored_hook_type}"

    Overcommit::HookContext.const_get(hook_type_class).new(config, args)
  rescue LoadError, NameError => error
    # Could happen when a symlink was created for a hook type Overcommit does
    # not yet support.
    raise Overcommit::Exceptions::HookContextLoadError,
          "Unable to load '#{hook_type}' hook context: '#{error}'",
          error.backtrace
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
overcommit-0.23.0 lib/overcommit/hook_context.rb
overcommit-0.22.0 lib/overcommit/hook_context.rb
jawshooah-overcommit-0.22.0 lib/overcommit/hook_context.rb
overcommit-0.21.0 lib/overcommit/hook_context.rb
overcommit-0.20.0 lib/overcommit/hook_context.rb