Class: LegitGit::CommandLine

Inherits:
Object
  • Object
show all
Defined in:
lib/legit-the-git/command_line.rb

Class Method Summary collapse

Class Method Details

.execute(args) ⇒ Object

Parse command line options and execute



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/legit-the-git/command_line.rb', line 9

def self.execute(args)

  help = <<-EOS
Usage #{File.basename $0} [--version] [--help] <command>

Commands:
  install      Install the Accurev Git hook into the current directory
  uninstall    Remove legit-the-git from the current repo

Workflow:
  Once installed commit your changes like usual. When you would like to push
  those changes to accurev, just run `git push accurev`. This will sync new
  commits from the current branch to the accurev server. Just make sure you
  are logged into accurev!

EOS

  case args
  when "install"
    installation = Installation.new(Dir.pwd)
    installation.install
    puts 'Successfully installed!'
    puts "Run #{File.basename $0} --help for usage."
    exit 0
  when "uninstall"
    installation = Installation.new(Dir.pwd)
    installation.uninstall
    puts 'Successfully uninstalled!'
    exit 0
  when "--version"
    puts LegitGit::VERSION
    exit 0
  else
    puts help
  end
end