Let the computers do the boring stuff.
"I have made this longer than usual because I have not had time to make it shorter." - Blaise Pascal
Dullard is a simple NodeJS-powered task runner. It exists because doing the same thing repeatedly is boring. Much better to let the computer do it instead.
Table of Contents
>dullard --helpdullard v0.4.3Let the computers do the boring stuff.Usage: dullard -d <dir>,...,<dirN> <step1> ... <stepN>Options:--help, -? Show usage--dirs, -d directories to load task files from--list, -l List available tasks--quiet, -q Minimal output--verbose, -v Verbose logging--loglevel Chattiness, one of: silly, verbose, info, warn, error, & silent [default: "info"]--silent No output until something goes awry
Dullard will look for a file named
.dullfile in the current directory or any parent directories & merge it with the CLI options. It will merge all found results in the current branch of the directory tree with precedence being:
CLI > Local > Parent > ... > Root.
"dirs" :"../../../tasks-a""steps" :"fooga"
/*jshint node:true */"use strict";moduleexports ="dirs" :"../../tasks-a""steps" :main :"fooga"finish :"wooga"default :"main""finish";
dirs is an array of directories to load tasks from.
steps is one of two options: 1) an array of strings/functions or 2) an object containing named step collections that are each an array of strings/functions. Strings should match either the names of files in the task directories stripped of their extension or the name of a step collection.
The config object will be passed as the first argument (
config by convention) to tasks.
Dullard tries hard to accept whatever & turn it into something useful. To this end the results of parsing the CLI with
optimist are merged into the config object after all the
.dullfiles. This allows you to run builds with environment-specific settings easily, as you can override any settings via CLI args.
For example, given the following
.dullfile and CLI args
"env" : "dev"
invoking dullard using the command
dullard --env=live will set the
env value to
"live" instead of
optimist's ability to handle dot-notation for arguments you can also set nested object arguments.
dullard --env=live --cdn.static=http://www.cdn.com with the same
.dullfile as above gives you a
config object like this
"env" : "dev""cdn" :"static" : ""
This only works for values that are not one of Dullard's CLI options.
Tasks are simple modules that should export a single function. Each task function gets passed two arguments, a shared config object for state in the task chain & an optional callback for async tasks. The callback takes two possible arguments, an error object and an optional object to replace the shared config object. If the task is synchronous any return value will be considered an error.
// Passing tasksprocessnextTickdone;// Failing tasksreturn "Task failed";done"Task Failed";
Dullard makes a
log function available to tasks via
config.log, this is a reference to
npmlog.log() and you may use it accordingly. It respects loglevel values passed via the CLI, either via
--loglevel=<level> or the shorthand
npm i -g dullard
git clone git://github.com/tivac/dullard.git
- Make changes
A: Nothing built-in yet, still trying to figure out if I'm comfortable with cluttering up the
.dullfile(s) with watcher config stuff. For now check out this gist.