WhatOSS/WhatOSS — pull request #1 by th3james (2013-12-23 23:42:25+00:00)
Title: Create CouchDB with views from application source on boot

Had a bit of a play around with CouchDb, still not quite sure what I'm doing but I thought I'd try to setup the app to load design documents from coffeescript source code stored in this project. As a learning exercise, I've also ditched cradle, for now.

`Persistence.initialize` creates the DB, and loads `_design/projects`. If `_design/projects` already exists, it checks to see if the definition in our codebase is modified, and updates if so. Design documents are written in coffescript and stored in `/design_documents`
`Persistence.query` is just a temporary helper for querying the DB using request

I've setup the tests to teardown the DB between runs, but for some reason they only work when run with:

`NODE_ENV=test mocha test/helper.coffee test/**/*.coffee`

... package.json seems to ignore the test/helper.coffee file, no matter what I do.

I should warn you, the code is *exceptionally* messy, I just wanted to prove the concept. Feedback very welcome!