task-registry-series
The SeriesTask run a task collection(array) one by one.
Usage
Task = require 'task-registry'tasks = require 'task-registry-series'register= Taskregister register OneTask : # the aOptions is the default options object of the task if no arguments passed. aOptions = 0 unless isNumber aOptions aOptions+1 register TwoTask : aOptions = 0 unless isNumber aOptions aOptions+2 result = tasksexecSync pipeline: true tasks: One: 1 # call OneTask with 1 argument 'Two' # call Two # the result should be 4
API
tasks.execSync(aOptions)/task.exec(aOptions, done)
- aOptions (Object|Array|String): it's a tasks if it's array.
it's a task name if it's string.
pipeline
(Boolean): whether the pass the result as a pipeline. default to false.- If true, the first task will be called with the arguments, and each subsequence task will be called with the result of the previous task.
- If false, Each task will be called with the arguments, and each may return a value.
tasks
(ArrayOf String|Object): the tasks to run.- Object:
- key: it's the task name
- value: it's the arugments object to be passed.
- Object:
force
(Boolean): whether force to continue executing even though a task occur error. default to false, ignore theraiseError
if true.raiseError
(Boolean): whether throw the error. default to true.logger
(Logger Object): default to null.
TODO
License
MIT