Documentation for the nake module. These are the procs and macros you can use to define and run tasks in your nakefiles.
Procs
proc runTask*(name: string) {.inline.}
-
Runs the specified task.
You can call this proc to chain other tasks for the current task and avoid repeating code. Example:
import nake, os ... task "docs", "generates docs for module": echo "Generating " & moduleHtml direShell "nimrod", "doc", moduleNim task "install_docs", "copies docs to " & docInstallDir: runTask("docs") echo "Copying documentation to " & docInstallDir copyFile(moduleHtml, docInstallDir / moduleHtml)
proc shell*(cmd: varargs[string, `$`]): bool {.discardable.}
-
Invokes an external command.
The proc will return false if the command exits with a non zero code.
proc cd*(dir: string) {.inline.}
-
Changes the current directory.
The change is permanent for the rest of the execution. Use the withDir template if you want to perform a temporary change only.
proc shell*(cmd: varargs[string, `$`]): bool
proc direShell*(cmd: varargs[string, `$`]): bool {.discardable.}
- Like shell() but quits if the process does not return 0
proc cd*(dir: string)
Templates
template task*(name: string; description: string; body: stmt): stmt {.immediate.}
-
Defines a task for nake.
Pass the name of the task, the description that will be displayed to the user when nake is invoked, and the body of the task. Example:
import nake task "bin", "compiles all binaries": for binName in binaries: echo "Generating " & binName direShell "nimrod", "c", binName
template withDir*(dir: string; body: stmt): stmt
-
Changes the current directory temporarily.
withDir "foo": # inside foo #back to last dir