mongopatch
Advanced tools
Comparing version 0.5.2 to 0.5.3
@@ -17,3 +17,2 @@ #!/usr/bin/env node | ||
.string('db') | ||
.demand('db') | ||
.describe('db', 'Connection string for application database') | ||
@@ -51,15 +50,4 @@ .string('log-db') | ||
if(err.patch) { | ||
var patch = err.patch; | ||
console.log(JSON.stringify({ | ||
modified: patch.modified, | ||
before: patch.before, | ||
after: patch.after, | ||
modifier: patch.modifier, | ||
diff: patch.diff | ||
}, null, 4)); | ||
} | ||
if(err.stack) { | ||
console.log(err.stack); | ||
console.error(err.stack); | ||
} | ||
@@ -83,6 +71,9 @@ | ||
var conf = options.config ? JSON.parse(fs.readFileSync(options.config, 'utf-8')) : {}; | ||
options = xtend(options, camelize(conf)); | ||
options = xtend(camelize(conf), options); | ||
if(!options.db) { | ||
return error('--db required to run patch'); | ||
} | ||
if(!options.dryRun && !options.logDb && !options.force) { | ||
error('--log-db required to run patch'); | ||
return error('--log-db required to run patch'); | ||
} | ||
@@ -103,3 +94,2 @@ if (options.parallel === true) { | ||
stream.on('error', error); | ||
stream.on('end', function() { | ||
@@ -106,0 +96,0 @@ process.stdout.write('\x1B[?25h'); |
{ | ||
"name": "mongopatch", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"repository": "git://github.com/e-conomic/mongopatch.git", | ||
@@ -5,0 +5,0 @@ "description": "MongoDB patching tool", |
@@ -144,2 +144,3 @@ var util = require('util'); | ||
stream = stream.pipe(log({ patch: that.id, total: count })); | ||
that.on('error', log.error); | ||
} | ||
@@ -146,0 +147,0 @@ |
@@ -12,2 +12,21 @@ var util = require('util'); | ||
var error = function(err) { | ||
console.error((err.message || err).red); | ||
if(err.patch) { | ||
var patch = err.patch; | ||
console.error(JSON.stringify({ | ||
modified: patch.modified, | ||
before: patch.before, | ||
after: patch.after, | ||
modifier: patch.modifier, | ||
diff: patch.diff | ||
}, null, 4)); | ||
} | ||
if(err.stack) { | ||
console.error(err.stack); | ||
} | ||
}; | ||
var bar = function(percent) { | ||
@@ -182,2 +201,4 @@ percent = Math.min(percent, 100); | ||
progress.error = error; | ||
module.exports = progress; |
243584
792