class Lanes::Command::Puma

Public Instance Methods

maybe_wait() click to toggle source
# File lib/lanes/command/puma.rb, line 31
def maybe_wait
    @proc.wait if options[:wait]
end
start() click to toggle source
# File lib/lanes/command/puma.rb, line 15
def start
    say "Starting Puma", :green
    @proc = ::ChildProcess.build('puma')
    @output, w = IO.pipe
    @proc.io.stdout = @proc.io.stderr = w
    @proc.start
    w.close
    @listener = listen_for_status_updates
    sleep 1
    unless @proc.alive?
        raise "NOT LIVING"
        puts @output.read
    end
    self
end
stop() click to toggle source
# File lib/lanes/command/puma.rb, line 35
def stop
    say "Stopping Puma", :green
    @listener.kill
    @proc.stop
    @prop = nil
end

Private Instance Methods

listen_for_status_updates() click to toggle source
# File lib/lanes/command/puma.rb, line 45
def listen_for_status_updates
    Thread.new do
        @output.each_line do | l |
            Lanes.logger.info(l.chomp)
        end
    end
end