doit is all about automating the execution of tasks. Tasks can execute external shell commands/scripts or python functions (actually any callable). So a task can be anything you can code :)
Tasks are defined using python, in a plain python file with some conventions. A function that starts with the name task_ defines a task recognized by doit. These functions must return (or yield) dictionaries representing a task. A python module/file that defines tasks for doit is called dodo file (that is something like a Makefile for make).
Note
You should be comfortable with python basics. If you don’t know python yet check Python tutorial and Dive Into Python.
Take a look at this example (file dodo.py):
def task_hello():
"""hello from shell & python! """
def python_hello():
output = open("hello.txt", "a")
output.write("Python says Hello World!!!\n")
output.close()
return True
return {'actions': ['echo Hello World!!! > hello.txt',
(python_hello,)]
}
When doit is executed without any parameters it will look for tasks in a file named dodo.py in the current folder and execute its tasks.
eduardo@eduardo~$ doit
hello => Cmd: echo Hello World!!! > hello.txt
Python: function python_hello
On the output it displays which tasks were executed and a description of its actions.