midas/servitude — pull request #5 by njonsson (2014-10-03 17:32:45+00:00)
Title: Factor out the Servitude::NS hack

This puts all the constants ([_APP_ID_](https://github.com/midas/servitude/blob/b114fff5a70293482940f4c2e427d49254376a00/lib/servitude/base.rb#L63), etc) and [configuration](https://github.com/midas/servitude/blob/b114fff5a70293482940f4c2e427d49254376a00/lib/servitude/base.rb#L78-88) and [logging](https://github.com/midas/servitude/blob/b114fff5a70293482940f4c2e427d49254376a00/lib/servitude/base.rb#L12) APIs into the [_Servitude_](https://github.com/midas/servitude/blob/6438eaa1f8c230a24d3debeba9075d11578edf52/lib/servitude.rb#L4-28) namespace instead of injecting them into the application’s namespace. This simplifies the code and makes it possible to use logging statements while running unit tests (regardless of whether _Servitude_ has been [boot](https://github.com/midas/servitude/blob/b114fff5a70293482940f4c2e427d49254376a00/lib/servitude/base.rb#L19-90)ed or a _Servitude_ server is running).

We introduce a new `server_class` optional keyword to _Servitude.boot_. Its value is a [_Class_](http://ruby-doc.org/core-2.1.0/Class.html) object, and it must be supplied if a _Server_ class in the host namespace is not defined.

The changes to examples entail booting after the _Server_ class is defined rather than before, for reasons just mentioned.