The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Canolla::DSL - DSL For Canolla File

SYNOPSIS

    use Canolla::DSL;

PROVIDED FUNCTIONS

call $task_name [, $task_name ...]

Executes the given task name

current_task()

Returns the current task object.

current_remote()

Returns the current remote object, if available

get $name

Return the variable of the parameter pointed by $name. Parameters can be set by calling set(), or by specifying them from the canella command line.

on_finish \&code

Executes the given \&code at the end of the task.

TODO: Currently this does not run the commands remotely even when you set on_finish() inside remote().

TODO: Order of execution is not guaranteed. Need to either fix it or document it

role $name, @spec;

    role 'www' => (
        hosts => [ qw(host1 host2 host3) ]
    );

    role 'www' => (
        hosts => sub { ... dynamically load hosts },
    );

    role 'www' => (
        hosts => ...,
        params => { ... local parameters ... }
    );

remote \&code, $host

Specifies that within the given block \&code, run() commands are run on the host specified by $host

run @cmd

Executes @cmd. If called inside a remote() block, the command will be executed on the remote host. Otherwise it will be executed locally

run_local @cmd

Executes @cmd, but always do so on the local machine, regardless of context.

scp_get @args

Calls Net::OpenSSH::scp_get on the currently connected host. Must be called inside a remote() block

scp_put @args

Calls Net::OpenSSH::scp_put on the currently connected host. Must be called inside a remote() block

set $name, $value

Sets the parameter $name to point to $value

task $name, \&code

Declare a new task. There's no notion of hierarchical tasks, but you can always declare them by hand:

    task "setup:perl" => sub { ... };
    task "setup:nginx" => sub { ... };