Class: Gruf::Cli::Executor

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

Overview

Handles execution of the gruf binstub, along with command-line arguments

Instance Method Summary collapse

Constructor Details

#initialize(args = ARGV) ⇒ Executor

Returns a new instance of Executor.

Parameters:

  • (Hash|ARGV)


27
28
29
30
# File 'lib/gruf/cli/executor.rb', line 27

def initialize(args = ARGV)
  @args = args
  setup!
end

Instance Method Details

#runObject

Run the server



35
36
37
38
39
40
41
42
43
# File 'lib/gruf/cli/executor.rb', line 35

def run
  server = Gruf::Server.new(Gruf.server_options)
  Gruf.services.each { |s| server.add_service(s) }
  server.start!
rescue StandardError => e
  msg = "FATAL ERROR: #{e.message} #{e.backtrace.join("\n")}"
  logger = Gruf.logger ? Gruf.logger : Logger.new(STDERR)
  logger.fatal msg
end