Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions etc/project
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

"initiator": {
"callback": {

"flows": {
"test-basic": {
"tasks": [{
Expand All @@ -22,12 +22,6 @@
"{$uppercase}"
],
"$set": "result"
// }, {
// "$function":"console.print",
// "$args":[
// "Running equal...",
// "STRING against {$uppercase}"
// ]
}]
},
"test-every-000": {
Expand Down
10 changes: 7 additions & 3 deletions script/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module.exports = {
launchContext: function () {
return {
token: process.argv[3],
param: process.argv[4]
param: process.argv[4],
params: process.argv.slice(4)
};
},
launch: function (conf) {
Expand All @@ -21,7 +22,7 @@ module.exports = {
*/

var callbackIConf = conf.initiator['callback'];

var callbackIClass = dataflows.initiator('callback');

if ('function' == typeof callbackIClass) {
Expand All @@ -32,7 +33,10 @@ module.exports = {

var flow = processor.process (this.launchContext().token, {
templates: {},
request: {param: this.launchContext().param},
request: {
param: this.launchContext().param,
params: this.launchContext().params
},
autoRun: false
});

Expand Down
27 changes: 27 additions & 0 deletions task/exec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var task = require ('dataflo.ws/task/base'),
util = require ('util'),
exec = require ('child_process').exec;

var execTask = module.exports = function (config) {
this.init (config);
};

util.inherits (execTask, task);
util.extend (execTask.prototype, {
run: function () {
var self = this;
var args = self.args || self.$args || [];
var options = self.options || [];

var cmd = self.command + ' ' + args.join(' ');

exec(cmd, options, function(error, stdout, stderr) {
if (error) {
self.failed(stderr);
} else {
self.completed(stdout || self.returnAnything);
}
});
}
});

49 changes: 49 additions & 0 deletions task/vars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
var task = require ('dataflo.ws/task/base'),
util = require ('util');

var varsTask = module.exports = function (config) {
this.init (config);
};

util.inherits (varsTask, task);
util.extend (varsTask.prototype, {
run: function () {
var self = this;
var args = self.args || self.$args;

var item = args.shift();
var funcName = args.shift();
var func = item[funcName];

if (typeof func == "function") {
self.completed( func.apply(item, args) );
} else {
self.failed(funcName + " is not a function");
}

},

concat: function() {
var self = this;
var args = self.args || self.$args;

self.completed(args.join(''));
},

join: function() {
var self = this;
var args = self.args || self.$args;
var clue = self.clue || self.delimiter;

self.completed(args.join(clue));
},

set: function() {
var self = this;
var args = self.args || self.$args;
var value = self.value || self.args[0];

self.completed(value);
}
});