Class: Prb::CommandRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/prb/command_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ CommandRunner

Returns a new instance of CommandRunner.



3
4
5
# File 'lib/prb/command_runner.rb', line 3

def initialize(opts)
  @opts = Opts.new(opts)
end

Instance Method Details

#resumeObject



22
23
24
# File 'lib/prb/command_runner.rb', line 22

def resume
  send_request('resume')
end

#startObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/prb/command_runner.rb', line 7

def start
  if running?(@opts.port)
    puts "A prb server is already running."
    exit(1)
  end

  Process.daemon() if @opts.daemonize?

  app = Prb::Server.new(@opts)
  Rack::Server.start(
    app: app,
    Port: @opts.port
  )
end

#stopObject



26
27
28
# File 'lib/prb/command_runner.rb', line 26

def stop
  send_request('stop')
end