Moving everything into the lib folder.

The WIP-est PR of them all.

This is the initial stage of turing the Rails app into a gem
that contains one or more Rails engines.

cc @amoose