GitPush
extends Base
in package
Components_Release_Task_GitPush:: Push any changes to a remote server
Copyright 2011-2019 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Tags
Table of Contents
- $_component : Source
- The component that should be released
- $_deps : mixed
- $_name : string
- The task name.
- $_notes : Notes
- $_output : Output
- $_tasks : Tasks
- __construct() : mixed
- Constructor.
- askDependencies() : array<string|int, string>
- Ask for dependencies.
- getDependency() : object|null
- Retrieve a dependency
- getName() : string
- Get the name of this task.
- postValidate() : array<string|int, mixed>
- Validate the postconditions required for this release task to have succeeded.
- pretend() : bool
- preValidate() : array<string|int, mixed>
- Validate the preconditions required for this release task.
- run() : void
- Run the task.
- setComponent() : void
- Set the component this task should act upon.
- setDependencies() : void
- Receive dependencies
- setName() : void
- Set the name of this task.
- skip() : bool
- This task may not be skipped
- _push() : SystemCallResult
- Push a the current checkout to remote
- _pushTags() : SystemCallResult
- Push a the current checkout's tags to remote
- exec() : SystemCallResult
- Run a system call and capture output.
- execInDirectory() : SystemCallResult
- Run a system call in a given dir and capture output.
- getComponent() : Source
- Get the component this task should act upon.
- getNotes() : Notes
- Get the release notes.
- getOutput() : Output
- Get the output handler.
- getTasks() : Tasks
- Get the tasks handler.
- system() : string
- Run a system call.
- systemInDirectory() : string
- Run a system call.
Properties
$_component
The component that should be released
protected
Source
$_component
$_deps
protected
mixed
$_deps
= []
$_name
The task name.
protected
string
$_name
$_notes
protected
Notes
$_notes
$_output
protected
Output
$_output
$_tasks
protected
Tasks
$_tasks
Methods
__construct()
Constructor.
public
__construct(Tasks $_tasks, Notes $_notes, Output $_output) : mixed
Parameters
- $_tasks : Tasks
-
The task handler.
- $_notes : Notes
-
The release notes.
- $_output : Output
-
Accepts output.
Return values
mixed —askDependencies()
Ask for dependencies.
public
askDependencies() : array<string|int, string>
Declares which helpers or other utilities the task wants to have
The request format is an associative array. The key will be reused by the answer from outside, the value is a string identifying the base class or interface of the dependency.
As long as the injector knows how to provide the dependencies, there is no need for individual factories or annotations per task.
Dependencies unfulfilled should be returned as null values for the keys.
The task should decide itself if this is fatal or optional
Return values
array<string|int, string> —The dictionary of dependencies.
getDependency()
Retrieve a dependency
public
getDependency(string $key) : object|null
It must have been registered by askDependencies and the calling code should provide it or null
Parameters
- $key : string
-
The dependency to get.
Return values
object|null —The dependency or null
getName()
Get the name of this task.
public
getName() : string
Return values
string —The task name.
postValidate()
Validate the postconditions required for this release task to have succeeded.
public
postValidate(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
-
Additional options.
Return values
array<string|int, mixed> —An empty array if all postconditions are met and a list of error messages otherwise.
pretend()
public
pretend() : bool
Return values
bool —preValidate()
Validate the preconditions required for this release task.
public
preValidate(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
-
Additional options.
Return values
array<string|int, mixed> —An empty array if all preconditions are met and a list of error messages otherwise.
run()
Run the task.
public
run(array<string|int, mixed> &$options) : void
Push the branch to the desired remote Supports pretend mode
Parameters
- $options : array<string|int, mixed>
-
Additional options by-reference. Keys: 'remote' Defaults to origin 'branch' Default empty, use tracking branch
Return values
void —setComponent()
Set the component this task should act upon.
public
setComponent(Source $component) : void
Parameters
- $component : Source
-
The component to be released.
Return values
void —setDependencies()
Receive dependencies
public
setDependencies(array<string|int, mixed> $dependencies) : void
The format contains the same keys ad askDependencies, but the values are instances of the requested types or null if unfulfilled.
Parameters
- $dependencies : array<string|int, mixed>
-
The provided dependencies.
Return values
void —setName()
Set the name of this task.
public
setName(string $name) : void
Parameters
- $name : string
-
The task name.
Return values
void —skip()
This task may not be skipped
public
skip(mixed $options) : bool
Parameters
- $options : mixed
-
Additional options.
Return values
bool —Always false, this task may not be skipped
_push()
Push a the current checkout to remote
protected
_push(string $remote[, string $branch = '' ]) : SystemCallResult
Parameters
- $remote : string
-
The remote to push to
- $branch : string = ''
-
The remote branch. Leave empty for tracking branch
Return values
SystemCallResult —The result object Might make sense to factor out into a git helper for reuse?
_pushTags()
Push a the current checkout's tags to remote
protected
_pushTags(string $remote[, string $branch = '' ]) : SystemCallResult
Parameters
- $remote : string
-
The remote to push to
- $branch : string = ''
-
The remote branch. Leave empty for tracking branch
Return values
SystemCallResult —The result object Might make sense to factor out into a git helper for reuse?
exec()
Run a system call and capture output.
protected
exec(string $call) : SystemCallResult
Parameters
- $call : string
-
The system call to execute.
Return values
SystemCallResult —The command output.
execInDirectory()
Run a system call in a given dir and capture output.
protected
execInDirectory(string $call, string $target_dir) : SystemCallResult
Parameters
- $call : string
-
The system call to execute.
- $target_dir : string
-
Run the command in the provided target path.
Return values
SystemCallResult —The command output.
getComponent()
Get the component this task should act upon.
protected
getComponent() : Source
Return values
Source —The component to be released.
getNotes()
Get the release notes.
protected
getNotes() : Notes
Return values
Notes —The release notes.
getOutput()
Get the output handler.
protected
getOutput() : Output
Return values
Output —The output handler.
getTasks()
Get the tasks handler.
protected
getTasks() : Tasks
Return values
Tasks —The release tasks handler.
system()
Run a system call.
protected
system(string $call) : string
Parameters
- $call : string
-
The system call to execute.
Return values
string —The command output.
systemInDirectory()
Run a system call.
protected
systemInDirectory(string $call, string $target_dir) : string
Parameters
- $call : string
-
The system call to execute.
- $target_dir : string
-
Run the command in the provided target path.
Return values
string —The command output.