cleanup and error catching
This commit is contained in:
parent
81f490a1f5
commit
af73a33070
|
@ -5,13 +5,12 @@
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var path, couchapp, nanolib, urls;
|
var path, couchapp, nanolib, urls, async;
|
||||||
|
|
||||||
path = require('path');
|
path = require('path');
|
||||||
couchapp = require('couchapp');
|
couchapp = require('couchapp');
|
||||||
urls = require('url');
|
urls = require('url');
|
||||||
console.log(__dirname)
|
async = require('async');
|
||||||
var async = require('async')
|
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
|
|
||||||
|
@ -20,17 +19,23 @@ module.exports = function(grunt) {
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
grunt.registerMultiTask("couchapp", "Install Couchapp", function() {
|
grunt.registerMultiTask("couchapp", "Install Couchapp", function() {
|
||||||
|
var task = this;
|
||||||
var task = this
|
var done = this.async();
|
||||||
var done = this.async()
|
|
||||||
|
|
||||||
async.each(this.files, function(file, cb) {
|
async.each(this.files, function(file, cb) {
|
||||||
var pth = path.join(process.cwd(), path.normalize(file.src[0]))
|
var appobj, apppath
|
||||||
var appobj = require(pth)
|
apppath = path.join(process.cwd(), path.normalize(file.src[0]))
|
||||||
|
try {
|
||||||
|
appobj = require(apppath)
|
||||||
couchapp.createApp(appobj, task.data.db, function(app) {
|
couchapp.createApp(appobj, task.data.db, function(app) {
|
||||||
app.push( cb )
|
app.push(cb);
|
||||||
});
|
});
|
||||||
}, done)
|
} 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() {
|
grunt.registerMultiTask("rmcouchdb", "Delete a Couch Database", function() {
|
||||||
|
|
Loading…
Reference in New Issue