App::Sqitch::Role::TargetConfigCommand3pm
A command that handles target-related configuration
Usage
package App::Sqitch::Command::init;extends 'App::Sqitch::Command';with 'App::Sqitch::Role::TargetConfigCommand';
Overview
This role encapsulates the common attributes and methods required by commands that deal with change script configuration, including script directories and extensions.
Interface
Class Methods
"options"
my @opts = App::Sqitch::Command::checkout->options;
Adds options common to the commands that manage script configuration.
"configure"
Configures the options common to commands manage script configuration.
Attributes
"properties"
A hash reference of target configurations. The keys may be as follows:
- "deploy"
- "revert"
- "verify"
- "reworked"
- "reworked_deploy"
- "reworked_revert"
- "reworked_verify"
- "extension"
Instance Methods
"config_target"
my $target = $cmd->config_target;my $target = $cmd->config_target(%params);
Constructs a target based on the contents of "properties". The supported parameters are:
"name"
|
A target name. |
|---|---|
"uri"
|
A target URI. |
"engine"
|
An engine name. |
The passed target and engine names take highest precedence, falling back on the properties and the "default_target". All other properties are applied to the target before returning it.
"write_plan"
$cmd->write_plan(%params);
Writes out the plan file. Supported parameters are:
- "target"
-
The target for which the plan will be written. Defaults to the target returned by
config_target().
- "project"
-
The project name. If not passed, the project name will be read from the default target's plan, if it exists. Otherwise an error will be thrown.
- "uri"
-
The project URI. Optional. If not passed, the URI will be read from the default target's plan, if it exists. Optional.
"directories_for"
my @dirs = $cmd->directories_for(@targets);
Returns a set of script directories for a list of targets. Options passed to the command are preferred. Paths are pulled from the command only when they have not been passed as options.
"make_directories_for"
$cmd->directories_for(@targets);
Creates script directories for one or more targets. Options passed to the command are preferred. Paths are pulled from the command only when they have not been passed as options.
"mkdirs"
$cmd->directories_for(@dirs);
Creates the list of directories on the file system. Directories that already exist are skipped. Messages are sent to info() for each directory, and an error is thrown on the first to fail.
"config_params"
my @params = $cmd->config_params($key);
Returns a list of parameters to pass to the App::Sqitch::Config "set" method, built up from the "properties".
Releases
5 releases since Debian 9 (Stretch); the text changed 4 times.