|
spudplate
Template scaffolding compiler for spudlang .spud files
|
Creates a directory at <path>, with mkdir -p semantics: intermediate directories are created automatically if missing.
| Clause | Effect |
|---|---|
from | Populate the new directory from <source>, recursively |
verbatim | With from, suppress {ident} substitution in copied file contents |
mode | Set directory permissions, masked to 0o0777 |
when | Skip creation if the condition is false |
as | Bind the resolved path to a name for later reuse |
The simplest form just creates a directory.
The path follows the path expression grammar. Quote any literal segment; bare identifiers are treated as variable references.
Populates the new directory from a source tree in the bundle (or, when running directly from a .spud file, on the filesystem relative to the current working directory).
Source files are read at install time and embedded in the .spp. At run time, {ident} substitution is applied to each copied file's contents (binary files are auto-detected and copied verbatim regardless).
Add verbatim to suppress all substitution:
mkdir from creates a new directory and populates it. The destination must not already exist.
copy into requires its destination to already exist; it is for merging additional content into a directory you have already created. The two are not interchangeable; using one where the other is needed produces a runtime error.
A common pattern combines them:
The as <name> clause binds the resolved path to a name. Subsequent statements can use that name as a bare path segment.
When as is on a conditional mkdir, the alias is conditional too; references must be guarded by an equivalent condition. See Scoping for the equivalence rules.
mode takes an octal literal. The value is masked to 0o0777, so setuid and setgid bits cannot be set.
<path> and <source>.