Class: Lolcommits::Installation

Inherits:
Object
  • Object
show all
Defined in:
lib/lolcommits/installation.rb

Overview

Methods to handle enabling and disabling of lolcommits

Class Method Summary collapse

Class Method Details

.backendObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/lolcommits/installation.rb', line 7

def self.backend
  if GitInfo.repo_root?
    InstallationGit
  elsif MercurialInfo.repo_root?
    InstallationMercurial
  else
    fatal "You don't appear to be in the base directory of a supported vcs project."
    exit 1
  end
end

.do_disableObject

IF –DISABLE, DO DISABLE



34
35
36
# File 'lib/lolcommits/installation.rb', line 34

def self.do_disable
  backend.do_disable
end

.do_enableObject

IF –ENABLE, DO ENABLE



21
22
23
24
25
26
27
28
29
# File 'lib/lolcommits/installation.rb', line 21

def self.do_enable
  path = backend.do_enable

  info 'installed lolcommit hook to:'
  info "  -> #{File.expand_path(path)}"
  info '(to remove later, you can use: lolcommits --disable)'
  # we dont symlink, but rather install a small stub that calls the one from path
  # that way, as gem version changes, script updates even if new file thus breaking symlink
end