-
Notifications
You must be signed in to change notification settings - Fork 4
Antfarm
Dominick Peluso edited this page Sep 30, 2016
·
9 revisions
The Antfarm object is the factory that creates all of the basic components.
var Antfarm = require('antfarm');
var af = new Antfarm();
var folder = af.createFolderNest("/var/my/folder");
var tunnel = af.createTunnel("My workflow");
When instantiating Antfarm, you may pass it an antfarm options object.
var Antfarm = require('../lib/antfarm'),
af = new Antfarm({
log_out_level: "warning"
});
You can put your workflows in separate node modules in another directory and have Antfarm load them all.
// Import Antfarm
var Antfarm = require('../lib/antfarm'),
af = new Antfarm({});
// Load your workflow directory
af.loadDir("./workflows");
Your workflow files should export a function that takes an Antfarm object in its constructor, like so:
// ./workflows/workflow_a.js
var WorkflowA = function(antfarm){
var wf = this;
wf.af = antfarm;
wf.tunnel = wf.af.createTunnel("Workflow A");
// etc...
};
module.exports = WorkflowA;