Class: Hippo::Command::Puma

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/hippo/command/puma.rb

Instance Method Summary collapse

Instance Method Details

#maybe_waitObject



31
32
33
# File 'lib/hippo/command/puma.rb', line 31

def maybe_wait
    @proc.wait if options[:wait]
end

#startObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/hippo/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

#stopObject



35
36
37
38
39
40
# File 'lib/hippo/command/puma.rb', line 35

def stop
    say "Stopping Puma", :green
    @listener.kill
    @proc.stop
    @prop = nil
end