Class: RailsGrpc::CLI

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rails_grpc/cli.rb

Constant Summary collapse

WORKER_LAUNCH_RETRY_LIMIT =
3
RAILS_LAUNCH_WAIT_TIME =

FIXME

10

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



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

def initialize
  @mutex = Mutex.new
  set_environment
end

Instance Attribute Details

#mutexObject

Returns the value of attribute mutex.



11
12
13
# File 'lib/rails_grpc/cli.rb', line 11

def mutex
  @mutex
end

#serverObject

Returns the value of attribute server.



11
12
13
# File 'lib/rails_grpc/cli.rb', line 11

def server
  @server
end

#worker_pidObject

Returns the value of attribute worker_pid.



11
12
13
# File 'lib/rails_grpc/cli.rb', line 11

def worker_pid
  @worker_pid
end

Instance Method Details

#parseObject



18
19
# File 'lib/rails_grpc/cli.rb', line 18

def parse
end

#runObject



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

def run
  @worker_pid = Process.fork
  if @worker_pid
    print_banner
    puts "Start GRPC master (pid: #{$$})"
    set_master_trap
    Process.waitall
  else
    boot_grpc_server
  end
end