Class: Vines::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/vines/cli.rb

Overview

The command line application that’s invoked by the ‘vines` binary included in the gem. Parses the command line arguments to create a new server directory, and starts and stops the server.

Constant Summary collapse

COMMANDS =
%w[start stop restart init bcrypt cert ldap schema]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startObject



8
9
10
# File 'lib/vines/cli.rb', line 8

def self.start
  self.new.start
end

Instance Method Details

#startObject

Run the command line application to parse arguments and run sub-commands. Exits the process with a non-zero return code to indicate failure.

Returns nothing.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/vines/cli.rb', line 16

def start
  register_storage
  opts = parse(ARGV)
  check_config(opts)
  command = Command.const_get(opts[:command].capitalize).new
  begin
    command.run(opts)
  rescue SystemExit
    # do nothing
  rescue Exception => e
    puts e.message
    exit(1)
  end
end