File Format
Instruction Files are YAML files consisting of a list of Transformations. To learn more about the YAML file format, visit yaml.org.
Transformations
Each Transformation is a YAML dictionary with a type
key corresponding to one of the options below.
meta
The first entry. Contains information about the Instruction File.
dir
string - Base directory to use for commands and file operations. All relatives paths are processed relative to this path.
run
Run a command.
cmd
string - The command to run.cwd
(optional) string - The current working directory to run the command in. Defaults to themeta
transformation'sdir
.env
(optional) string - Mapping of environment variables to set.
create
Create a file with content.
file
string - The file to create.text
string - Text to create the file with.
replace
Find and replace text in a file.
file
string - The file to replace text in.find
string - The text to find. Interpreted as normal text unlessregex
istrue
.replace
string - The text to replace. Ifregex
istrue
, substitutions (eg.$1
,$2
, etc.) are supported.regex
(optional) boolean - Interpretfind
as a regular expression. Default isfalse
.
prepend
Find and replace text in a file.
file
string - The file to prepend text to.text
string - Text to prepend the file with.
append
Append text to the end of a file.
file
string - The file to append to text.text
string - Text to append the file with.
rename
Rename a file.
from
string - The old file path.to
string - The new file path.
copy
Copy a file.
from
string - The path of the original file.to
string - The path of the copy to create.
delete
Delete a file or directory.
file
string - The file or directory to delete.recursive
(optional) boolean - Delete items recursively iffile
is a directory. Default isfalse
.
deploy
Deploy a file to a production environment via secure copy.
from
string - The local directory/file to copy from.to
string - The production directory/file to copy to as anscp
path.clear
(optional) boolean - Removeto
before replacing it withfrom
. Useful for directories. Files are transferred to the remote server beforeto
is removed. Default isfalse
.