0.2.9 • Published 9 years ago

task-registry-series v0.2.9

Weekly downloads
15
License
MIT
Repository
github
Last release
9 years ago

task-registry-series npm

Build Status Code Climate Test Coverage downloads license

The SeriesTask run a task collection(array) one by one.

Usage

Task    = require 'task-registry'
tasks   = require 'task-registry-series'
register= Task.register

class OneTask
  register OneTask
  executeSync: (aOptions)->
    # the aOptions is the default options object of the task if no arguments passed.
    aOptions = 0 unless isNumber aOptions
    aOptions+1

class TwoTask
  register TwoTask
  executeSync: (aOptions)->
    aOptions = 0 unless isNumber aOptions
    aOptions+2

result = tasks.execSync
  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.
    • force (Boolean): whether force to continue executing even though a task occur error. default to false, ignore the raiseError if true.
    • raiseError (Boolean): whether throw the error. default to true.
    • logger (Logger Object): default to null.

TODO

License

MIT

0.2.9

9 years ago

0.2.8

9 years ago

0.2.7

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago