Added support for new-style (directory-based) couchapps.

This commit is contained in:
Sam Hiatt 2014-09-11 19:58:43 -07:00
parent 6a8ce0718d
commit 541539cd68
1 changed files with 5 additions and 2 deletions

View File

@ -32,8 +32,11 @@ module.exports = function(grunt) {
grunt.registerMultiTask("couchapp", "Install Couchapp", function() { grunt.registerMultiTask("couchapp", "Install Couchapp", function() {
var appobj, done; var appobj, done;
done = this.async(); done = this.async();
if (require("fs").lstatSync(this.data.app).isDirectory()) { // if new-style (directory-based) couchapp app
appobj = require(path.join(process.cwd(), path.normalize(this.data.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 couchapp.createApp(appobj, this.data.db, function(app) {
return app.push(done); return app.push(done);