Class: ConsoleIpc::CLI

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

Constant Summary collapse

COMMANDS =
%w[reload reset run start stop].freeze
START_WAIT_TIMEOUT_SECONDS =
120

Instance Method Summary collapse

Constructor Details

#initialize(argv, output: $stdout, error: $stderr) ⇒ CLI

Returns a new instance of CLI.



14
15
16
17
18
19
# File 'lib/console_ipc/cli.rb', line 14

def initialize(argv, output: $stdout, error: $stderr)
  @argv = argv.dup
  @output = output
  @error = error
  @socket_path = Connection.socket_path
end

Instance Method Details

#callObject



21
22
23
24
25
26
27
# File 'lib/console_ipc/cli.rb', line 21

def call
  command = @argv.shift

  return usage(1) unless COMMANDS.include?(command)

  call_command(command)
end