Simple nodejs boot tasks manager. Executes a list of tasks, sync or async. That's all.
$ npm install boot-tasks
## Usage example in CoffeeScript:
BootTasks = require 'boot-tasks'
# Set final callback
tasks = new BootTasks ->
console.log " [*] Server %s listening on %s:%d"
, server.nodename
, argv.host
, argv.port
server.listen argv.port, argv.host
# Set sync mode
tasks.sync()
# Add a task: redis
tasks.task ->
redisClient = redis.createClient config.redis.port
, config.redis.host
, config.redis.params
redisClient.on 'ready', ->
console.log " [ ] redisClient ready"
tasks.done()
# Run tasks
tasks.do()
BootTasks = require 'boot-tasks'
tasks = new BootTasks(end)
Optional end parameter as a function to call at the end.
Set the execution mode. Default: sync
Function callback to call at the end.
Add a func function as a task.
Call at the end of every task to continue execution (only sync mode).
Process all the tasks. Optional context parameter for the tasks.
- Dependency management
- done function as a parameter
- Emit events
- Tests