taskist
Glues your project configuration and tasks together
Last updated 6 years ago by bebraw .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install taskist 
SYNC missed versions from official npm registry.

build status

taskist - Glues your project configuration and tasks together

taskist provides a simple and safe way to glue your project configuration and tasks together. It uses node-schedule internally. The basic idea is simple. Consider the example below (see also demo/):

  • index.js - Project main
  • config.js - Project configuration
  • tasks/ - Project tasks
  • tasks/index.js - Task aggregator (use require-dir) or similar if you like
  • tasks/demo.js - Just a demo task

File contents:

index.js:

var taskist = require('taskist');

var tasks = require('./tasks');
var config = require('./config');


main();

function main() {
    // initialize and start tasks here
    taskist(config.tasks, tasks);
}

config.js:

module.exports = {
    tasks: {
        demo: {second: 30} // trigger twice per minute
    }
};

tasks/index.js:

module.exports = require('require-dir')('.');

tasks/demo.js:

module.exports = function(cb) {
    console.log('demo');

    cb();
};

taskist simply glues your tasks and configuration together and begins to run your tasks. That's it! In case you misspell a task at your configuration or forget to invoke some task, taskist will kindly remind you about it. This way you can be sure the right tasks get run.

In case you wish to trigger the tasks immediately pass {instant: true} as third parameter to taskist. Besides a boolean you may also pass a function to instant. In this case the function will be invoked once the functions have completed. It is possible to override this behavior per task by setting instant as false at configuration. Ie. task: {hour: 10, instant: false} would work.

If you want to execute instant tasks in series, set {series: true}.

License

taskist is available under MIT. See LICENSE for more details.

Current Tags

  • 0.4.0                                ...           latest (6 years ago)

6 Versions

  • 0.4.0                                ...           6 years ago
  • 0.3.2                                ...           7 years ago
  • 0.3.1                                ...           7 years ago
  • 0.3.0                                ...           7 years ago
  • 0.2.1                                ...           7 years ago
  • 0.2.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 2
Dependencies (3)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |