jc00ke/guard-puma — pull request #10 by mjc (2013-09-19 22:54:03+00:00)
Title: Make ```Guard::PumaRunner``` inherit from ```Puma::ControlCLI```.

This is a rewrite of ```Guard::PumaRunner``` utilizing (mostly) the same
code that pumactl uses to manage puma directly, instead of using
```Net::HTTP``` .

One immediate benefit of this is the ability to control ```puma``` with
signals or unix sockets if available.

Currently the code is a bit ugly. It could be much more elegant if
```Puma::ControlCLI``` were a little less smelly (for example, run
should return meaningful values and take a command instead of using
```@options[:command]```.) I intend to submit patches to Puma to reduce
said smell.

The options are now using the same options that puma uses internally,
while still respecting ```:host``` and ```:port```. Additinally one can
specify additional arguments to the ```puma``` command via
```puma_args``` in either string or array form.

Array form looks something like this: ```:puma_args => ["-
t","16:32","--help","config.ru"]``` where each of the arguments that
would be separated by spaces are separate items in the array.

The use of puma_args is discouraged, though, as ```puma_arg_list```
should correctly build the command line arguments for every option that
puma can currently use.

For the full list of options, peruse ```@options``` in
lib/puma/cli.rb[1].

```pumactl``` normally spawns ```puma``` inside itself when you issue
start, if it's not currently running. While this is possible inside
guard, I'm unsure how to do it gracefully, so I've overridden the start
mechanism.

There may be some other improvements/additions that I neglected to
mention.

Sponsored-by: CentroNet Marketing

[1]: https://github.com/puma/puma/blob/master/lib/puma/cli.rb