Support nested modules (and fix a intermittent test failure)

Builds on top of https://github.com/hsume2/browserify-rails/pull/8. Cleans things up a bit and fixes the regeneration test.