Comparing version 0.5.0 to 0.5.1
@@ -26,2 +26,12 @@ var async = require('async'); | ||
Session.prototype.toString = function toString() { | ||
var result = []; | ||
this.tasks.forEach(function(task) { | ||
result.push(task.toString()); | ||
}); | ||
return result.join('\n\n===\n\n') + '\n\n'; | ||
} | ||
module.exports = Session; |
@@ -137,2 +137,43 @@ var Connection = require('ssh2'); | ||
Task.prototype.toString = function toString() { | ||
var result = []; | ||
function renderCommand(command) { | ||
if (command instanceof Function) { | ||
result.push(' [Function]'); | ||
} else { | ||
result.push(' ' + command); | ||
} | ||
} | ||
function renderCommandOrList(listOrCommand) { | ||
if (listOrCommand instanceof Array) { | ||
listOrCommand.forEach(renderCommand); | ||
} else { | ||
renderCommand(listOrCommand); | ||
} | ||
} | ||
result.push('Host: this.connectionOptions.host'); | ||
if (this.connectionOptions.password) { | ||
result.push('Password: ' + this.connectionOptions.password); | ||
} | ||
if (this.connectionOptions.privateKey) { | ||
result.push('Private key: ' + this.connectionOptions.privateKey); | ||
} | ||
result.push('BEFORE'); | ||
renderCommandOrList(this.before); | ||
result.push('COMMANDS'); | ||
renderCommandOrList(this.commands); | ||
result.push('AFTER'); | ||
renderCommandOrList(this.after); | ||
result.push('ERROR'); | ||
renderCommandOrList(this.error); | ||
return result.join('\n'); | ||
} | ||
module.exports = Task; |
{ | ||
"name": "direktor", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"author": "Marco Tabini <marcot@tabini.ca>", | ||
@@ -5,0 +5,0 @@ "description": "Executes SSH commands on multiple servers in parallel", |
13171
169