Skip to content

Custom actions

haskelt edited this page Dec 23, 2020 · 6 revisions

Salal is designed for one specific task, which is building websites. However, in the process of developing a site, you may want to perform various other utility actions. For example, you might want to deploy your site to a server. For convenience, Salal provides a way to define custom actions that will execute a set of external commands.

Custom actions are configured by the use of System variables, specifically the variable action_commands. Here is an example of a system configuration file defining an action deploy that uses the *nix tool rsync to copy the build directory to a server:

{
    "action_commands" : {
        "deploy" : [
            "rsync -e \"/usr/bin/ssh\" -av --exclude=/.well-known/ --delete {{profile_build_dir}}/ {{deploy_destination}}"
        ]
    }
}

The string specifying the command contains two variable references, indicated by text surrounded by {{ and }}. Variable references are replaced by the appropriate values at the time the command is executed. You can include references to any system variable in the command string. In this case, profile_build_dir is a built-in system variable set internally by Salal itself (see System variables for more information on built-in variables). In contrast, deploy_destination is not a built-in variable, so its value would need to be specified in the build profiles file.

Clone this wiki locally