From 541539cd68544fef3806f4914d342a4310553077 Mon Sep 17 00:00:00 2001 From: Sam Hiatt Date: Thu, 11 Sep 2014 19:58:43 -0700 Subject: [PATCH] Added support for new-style (directory-based) couchapps. --- tasks/couchapp.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tasks/couchapp.js b/tasks/couchapp.js index 94db5b5..ebbc3d9 100755 --- a/tasks/couchapp.js +++ b/tasks/couchapp.js @@ -32,8 +32,11 @@ module.exports = function(grunt) { grunt.registerMultiTask("couchapp", "Install Couchapp", function() { var appobj, done; done = this.async(); - - appobj = require(path.join(process.cwd(), path.normalize(this.data.app))); + if (require("fs").lstatSync(this.data.app).isDirectory()) { // if new-style (directory-based) couchapp app + appobj = couchapp.loadFiles(this.data.app); + } else { // otherwise, fall back to old style. + appobj = require(path.join(process.cwd(), path.normalize(this.data.app))) + } return couchapp.createApp(appobj, this.data.db, function(app) { return app.push(done);