Class: FitCommit::Installer

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

Constant Summary collapse

HOOK_TEMPLATE_PATH =
File.expand_path("../../../templates/hooks/commit-msg", __FILE__)

Instance Method Summary collapse

Instance Method Details

#installObject



7
8
9
10
11
12
# File 'lib/fit_commit/installer.rb', line 7

def install
  FileUtils.mkdir_p(File.dirname(hook_path))
  FileUtils.cp(HOOK_TEMPLATE_PATH, hook_path)
  FileUtils.chmod(0755, hook_path)
  $stdout.puts "Installed hook to #{hook_path}"
end

#uninstallObject



14
15
16
17
18
19
20
# File 'lib/fit_commit/installer.rb', line 14

def uninstall
  if delete_hook
    $stdout.puts "Deleted hook at #{hook_path}"
  else
    $stdout.puts "Hook not found at #{hook_path}"
  end
end