redding/sanford — pull request #54 by jcredding (2013-02-14 19:43:27+00:00)
Title: Restart using `exec` and file descriptors (hot restart)

**WIP**

This implements a hot restart using `Kernel.exec` and file descriptors. The hot restart works perfectly, but there are some edge (error) cases that I haven't fully implemented. To do this properly, I had to make some "manager" changes:

##### Broke up `Manager`

* I broke up the `Manager` logic into 3 pieces: `Config`, `ServerHandler` and `SignalHandler`.
* `ServerHandler` handles building and running a server and making sure enough information was provided to do this (start and run actions).
* `SignalHandler` handles sending signals to a Sanford process and makes sure it has enough information to do it (stop and restart actions).
* `Config` is responsible for handling ENV vars, options and host configuration.
* This cleaned up some conditionals and focused each classes purpose.

##### Removed building a PID File automatically

* A PID file will not be build for you by default (by default it uses `/dev/null`, which is like not having a PID file)
* An option or ENV var can be set to have it manage a PID file.
* (not done yet) I've changed the `Host` `pid_dir` option to instead be `pid_file`. This will allow you to provide a default `pid_file` but overwrite it with options or ENV vars (basically the same way port works)
* This removed some dependencies on needing the servers ip and port. I also think its more standard to not by default build a PID file and only manage one if provided.

##### Added a `RestartCmd` utility class

* This handles the logic of building a the command for `Kernel.exec`.
* Most of this is borrowed from puma, and needs better explanation (`pwd` stuff particularly).