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
(recommended) string - Directory of the codebase for the instruction file. Used as the base directory for commands and file operations. If this path is relative, the Library's base is used as the base for this path. If omitted or blank, defaults to the Library's base if part of the Library of the current default directory. Recommended for files in the Library.
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: string map - 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 or directory.
from
string - The old file path.to
string - The new file path.
copy
Copy a file. To copy a directory, use scp
.
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 or directory 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 - Clear the contents ofto
before copying files fromfrom
. Files infrom
are copied to the sever beforehand so the copy intoto
is a local copy. Can only be used with directories.