Skip to content

Commit

Permalink
chore: cleaning and better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
yoannmoinet committed Feb 9, 2016
1 parent 8817c9a commit 3d27677
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ program._name = pkg.name;
program
.version(pkg.version)
.command('run <files...>')
.description('Run the list of JSON tasks files. Accept glob.')
.description('Run the list of JSON tasks files. Accepts glob.')
.action(function (files) {
agent.start(files);
});
Expand Down
4 changes: 2 additions & 2 deletions src/bots/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var actions = {
returnValue = taskGet.getAttribute(casper, params);
if (returnValue !== undefined) {
log('got', params.attribute + ' of ' + params.selector,
'SUCCESS');
returnValue, 'SUCCESS');
return returnValue;
}
return log('no attribute "' + params.attribute +
Expand Down Expand Up @@ -136,8 +136,8 @@ var config = function (casper, pid) {
execute: function (task) {
if (task.type && actions[task.type]) {
var response;
log('starting task', task, 'INFO_BAR');
task = template.parse(task);
log('starting task', task, 'INFO_BAR');
response = actions[task.type](task.params);
if (task.type === 'get') {
template.store(task.params.key, response);
Expand Down
6 changes: 2 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ env.PHANTOMJS_EXECUTABLE = phantomjsPath + '/phantomjs_2.0' +
(isWin ? '.exe' : '');
env.PATH += ';' + phantomjsPath;

var mgrUuid = uuid();
var children = [];
var files = [];
var client;
var started = false;
var cookieFile = 'cookies.txt';

console.log('spawned mgr ' + process.pid);
Expand Down Expand Up @@ -77,7 +74,7 @@ function addFiles (taskFilename) {
name: path.basename(taskFilename),
tasks: taskFilename
});
};
}

function runTask () {
var file = files.shift();
Expand Down Expand Up @@ -140,6 +137,7 @@ function bindChild(child) {
}

process.on('SIGINT', function (code, error) {
console.log('END', code, error);
end(0);
});

Expand Down

0 comments on commit 3d27677

Please sign in to comment.