1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Add ability to use pumactl to start a server

This commit is contained in:
Evan Phoenix 2012-09-25 09:40:00 -07:00
parent 4d77ce8347
commit 559f32905c

View file

@ -11,9 +11,12 @@ require 'socket'
module Puma
class ControlCLI
def initialize(argv, stdout=STDOUT)
def initialize(argv, stdout=STDOUT, stderr=STDERR)
@argv = argv
@stdout = stdout
@stderr = stderr
@path = nil
@config = nil
end
def setup_options
@ -44,10 +47,12 @@ module Puma
def run
setup_options
@parser.parse! @argv
@parser.order!(@argv) { |a| @parser.terminate a }
@state = YAML.load File.read(@path)
@config = @state['config']
if @path
@state = YAML.load File.read(@path)
@config = @state['config']
end
cmd = @argv.shift
@ -84,6 +89,13 @@ module Puma
@stdout.puts "#{@state['pid']}"
end
def command_start
require 'puma/cli'
cli = Puma::CLI.new @argv, @stdout, @stderr
cli.run
end
def command_stop
sock = connect
body = request sock, "/stop"