-
Notifications
You must be signed in to change notification settings - Fork 8
Home
The following functions are accessible from your Nakefile.
Register a task for the given name. When typing nake -- taskName the function fn will be executed. Use nake to list all registered tasks and descriptions.
Run the registered task with the given name from within another task.
The following properties are accessible from your Nakefile.
The name of the currently executed task.
The description of the currently executed task.
The absolute path of the project directory (aka the location of the Nakefile).
The absolute path of the directory where nake has been called. This might be projectDir or any sub-directory.
The Shell API contains a set of convenient methods for working with cli-based native commands. You create a new shell context via the global function shell(). All shell methods (except get) are intermediate and return the shell context itself so you can chain multiple methods in a row.
shell()
.dir('../some/dir')
.exec('ls -al')
.print();The shell context is aware of the result from the last executed native command, further named as the current value. Furthermore the shell context automatically checks the exit code during execution of commands and keeps track of the current directory. Per default the shell context points to your project directory (the path of your nakefile).
Many operations support string interpolation: {{}} will be replaced with the current value; {{mykey}} will be replaced with the stashed value of mykey.
Creates a new shell context for chaining cli-based operations from Nake. Per default the current directory points to projectDir (the directory of the Nakefile).
Creates a new shell context and changes directory to dir.
Execute the native cli command cmd specified as a string. The result of the command will be saved for further processing. Throws an exception when the commands exit code is > 0. Supports string interpolation for cmd.
Execute the native cli command cmd and pipe the input string as standard input to the command. Supports string interpolation for cmd.
Execute the native cli command cmd and pipe the current value as input to the command. Supports string interpolation for cmd.
Execute the native cli command cmd and pipe the stashed value of key as input to the command. Supports string interpolation for cmd.
Save the current value for future use under the given key.
Use the saved value under the given key as the current value.
Change the current directory to the given folder. This method is capable of handling relative paths, e.g. use .. to navigate to the parent directory. Example:
shell()
dir('any/subpath') // :projectDir/any/subpath
dir('../another') // :projectDir/any/another
dir('/my/absolute/path'); // /my/absolute/pathCall the function fn for every line of the current value. The function will be called with two arguments: line and zero-based index.
Transform the current value with the given function fn. The function will be called with the current value as first argument. The new current value will be the result of the function call.
Works like apply(fn) but for the stashed value of the given key instead of the current value.
Prints the current value.
Print the msg. Supports string interpolation for msg.
Prompts the message msg to the user, waiting for user input. The user input replaces the current value.
Supports string interpolation for msg.
Automatically prints everything from stderr to the console for all further executed commands.
Save the content of stderr from the last command as the current value.
Save the content of stderr from the last command under the given key.
Return the current value.
Return the value for the given key.
Set the current value to val.
Set the value for the given key to val.