Class: CLI

Inherits:
UserChoices::Command
  • Object
show all
Includes:
Singleton, UserChoices
Defined in:
lib/drbman/cli.rb

Overview

Synopsis

The Command Line Interface for Drbman

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.executeObject

The CLI class uses the command design pattern. This is a class accessor helper

Examples:

CLI.execute


13
14
15
# File 'lib/drbman/cli.rb', line 13

def self.execute
  instance.execute
end

Instance Method Details

#executeObject

The CLI class uses the command design pattern This is the main entry point



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/drbman/cli.rb', line 19

def execute
  if @user_choices[:version]
    puts IO.read(File.join(File.dirname(__FILE__), '../../VERSION')).strip
  else
    logger = setup_logger
    begin
      app = Drbman.new(logger, @user_choices)
      app.execute
    rescue Exception => e
      logger.error { e.to_s }
      logger.debug { e.backtrace.join("\n") }
    end
  end
end