commit
dc1763de2a
|
@ -5,11 +5,12 @@
|
|||
* Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
var path, couchapp, nanolib, urls, auth;
|
||||
var path, couchapp, nanolib, urls, async;
|
||||
|
||||
path = require('path');
|
||||
couchapp = require('couchapp');
|
||||
urls = require('url');
|
||||
async = require('async');
|
||||
|
||||
var genDB = function(db) {
|
||||
var parts, dbname, auth;
|
||||
|
@ -29,12 +30,23 @@ 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)));
|
||||
return couchapp.createApp(appobj, this.data.db, function(app) {
|
||||
return app.push(done);
|
||||
var task = this;
|
||||
var done = this.async();
|
||||
|
||||
async.each(this.files, function(file, cb) {
|
||||
var appobj, apppath
|
||||
apppath = path.join(process.cwd(), path.normalize(file.src[0]))
|
||||
try {
|
||||
appobj = require(apppath)
|
||||
couchapp.createApp(appobj, task.data.db, function(app) {
|
||||
app.push(cb);
|
||||
});
|
||||
} catch(ex) {
|
||||
grunt.log.error(ex);
|
||||
grunt.log.warn('Could not load couchapp from ' + apppath + '.');
|
||||
cb();
|
||||
}
|
||||
}, done);
|
||||
});
|
||||
|
||||
grunt.registerMultiTask("rmcouchdb", "Delete a Couch Database", function() {
|
||||
|
|
Loading…
Reference in New Issue