Class: Overcommit::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/overcommit/installer.rb

Overview

Manages the installation of Overcommit hooks in a git repository.

Constant Summary collapse

TEMPLATE_DIRECTORY =

rubocop:disable Metrics/ClassLength

File.join(Overcommit::HOME, 'template-dir')
MASTER_HOOK =
File.join(TEMPLATE_DIRECTORY, 'hooks', 'overcommit-hook')

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ Installer

Returns a new instance of Installer.



11
12
13
# File 'lib/overcommit/installer.rb', line 11

def initialize(logger)
  @log = logger
end

Instance Method Details

#run(target, options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/overcommit/installer.rb', line 15

def run(target, options)
  @target = target
  @options = options
  validate_target

  case @options[:action]
  when :uninstall then uninstall
  when :update then update
  else
    install
  end
end