Swap lines around

I think setting GEM_HOME before calling Bundler.bundle_path is what's
causing the trouble on ruby 1.9.3.
Make application process wait for its children on TERM

We already do this when the watcher becomes stale.

Cleaned up some of the code in the process.
Only call on_stale listeners once
Don't allow state transitions when exiting

For example if we do terminating -> exiting, then get another SIGTERM,
we don't want to go back to the terminating state.
improve log output
Handle recursively executing spring commands better

A spring command should be able to change the Gemfile and then call back
into spring, with the Gemfile changes reflected.

See https://github.com/rails/rails/issues/13381
Make application restarts self-healing

If you introduce an initialization error, spring will watch all the
files that were loaded up to that point, and will try to start the
application again if anything changes.
Boot application using Process.spawn rather than fork

Forking is faster since we don't have to load all the code again, but if
the bundle changes we have no choice but to kill spring entirely. This
will make it possible to load new bundles in (while the spring server
still runs from the old bundle).
Open pidfile in 'r+' mode on all platforms for compatibility with illumos/solaris.
Gracefully handle Gemfile changes

Closes #216
Merge pull request #239 from potatosalad/illumos-flock

Open pidfile in 'r+' mode on illumos or solaris based platforms.
Remove documentation about preloading test helper [ci skip]

Most people shouldn't need this
Fix support for rails engines/plugins

See here for a description of the problem:

https://github.com/rails/spring/issues/144#issuecomment-31994648

The solution is to make the application_id depend on the *project* root
rather than the *application* root, since only the server can know the
correct application root.
Fix Spring::Env so it works in tests
Add a timeout
Make sure that the watcher gets started

If loading spring/commands (which loads the gemfile / spring.rb / etc)
fails, we still need a watcher. It might end up being the polling watcher
when the user has configured the listen watcher, but that's acceptable.
Improve debugging
Bump version to 1.1.0.beta2
Don't use spring if it's not in the lockfile

This only applies to binstubs - it's still possible to use spring via
"spring ..." when not using binstubs.
more test helper fixes