Rhiz

A deliberately minimal task runner.

This is an in-progress-pre-alpha project.

Rhiz executes tasks defined in a "Rhizfile" which contains task descriptions with a Lisp-like syntax.

```scheme (task "hello" (log "Rhiz says hello"))

;; Comments start with a semicolon (task "fizzbuzz" "Tasks can have an optional description" ;; Strings are double-quoted. (exec fizzbuzz.exe) (log "The fizz was buzzed"))

(task "clean" (delete "./output")) ```

Task execution

Tasks are executed relative to the root directory, not the directory where rhiz is invoked. When rhiz is invoked.

The commands in a task are executed serially, and if a command returns a non-zero exit code the the task immediately exits.

Rhizfile syntax

Rhiz has two primitives:

They can be used interchangeably in some places, but not everywhere.

Tasks and commands are built of s-expressions, which are a list followed by one or more arguments (which can be strings, atoms, or other s-expressions).

For example, the expression

(task "foo" (exec foo)) has the command task with the arguments "foo" and (exec foo), which are a string and an s-expression, respectively.

Commands

pre

Prints a message to the standard output. Takes a single argument, which should be a string.

exec

Executes an external command (cargo, npm, etc.) in the Rhizfile's directory (usually the project root).

Takes one or more strings and/or atoms as argument(s). The arguments are converted to strings; the first should be the name of an external program; the remainder should be it's arguments. They're executed using std::process:Command (effectively: Command::new(firstarg).args(restof_args))

.

empty-dir

Ensure a directory exists and is empty. Takes a single argument, which should be the path to a directory (relative to the Rhizfile).

If the directory exists, it's contents are deleted. Otherwise, it's created.

delete

Delete a file. It takes a single argument, which should be a string containing a file name or path (relative to the Rhizfile).

If the file indicated by the path exists it's delete with fs::remove_file If the file doesn't exist, this command is ignored.

copy

Copy a file. Takes two arguments (both strings) representing the source and destination paths for the copy.

The source should be the path to a file (relative to the Rhizfile). The destination can be a path to a directory (in which case the source file is copied there with the same name) or to a new file (in which case it's copied with the new name). If the destination file already exists, this command exits with an error.

The copy is performed using fs::copy

rec-copy

Recursively copies a directory. Takes to arguments (both strings) representing the source and destination paths for the copy.

Both the source and target directories should exist. The files and directories in the source are copied into the target.

par

Execute commands in parallel. Takes any number of tasks (written as s-expressions) as arguments.