amco / dolly

Not an ORM for CouchDB in rails.
8 stars 3 forks source link

rake task imports .lib files #105

Closed norcal82 closed 8 years ago

norcal82 commented 8 years ago

Completes: #104

adding .lib files to the db/design folders will import modules into couch.

here is an example of how this works.

module_name.lib.coffee

exports.str = 'hello world'
exports.arr = [1,2,3,4,5]
....

couch views

(d) ->
  if d._id.indexOf("example/") is 0
    emit d._id, { module_array: require('views/lib/module_name').arr }