Documentation

GitBranch extends Base
in package

Components_Release_Task_GitBranch:: Check or enforce a branch checkout

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
category

Horde

author

Ralf Lang lang@b1-systems.de

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

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, mixed>
Ask for the Qc\Tasks dependency
getDependency()  : object|null
Retrieve a dependency
getName()  : string
Get the name of this task.
postValidate()  : array<string|int, mixed>
Validate if the checkout succeeded (or was not necessary)
pretend()  : bool
preValidate()  : array<string|int, mixed>
Validate if the desired branch actually exists
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
_branchExists()  : bool
Check if a given local branch exists
_checkout()  : mixed
Check out a branch
_currentBranch()  : string
Get the current branch
_getBranches()  : array<string|int, string>
Get the list of branch
_update()  : mixed
Update branch from source branch
_whichGit()  : string|void
Look for the git binary
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

$_name

The task name.

protected string $_name

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 the Qc\Tasks dependency

public askDependencies() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of dependencies requested

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 if the checkout succeeded (or was not necessary)

public postValidate(array<string|int, mixed> $options) : array<string|int, mixed>

A git checkout may fail for multiple reasons, including uncommitted changes in the current checkout. We don't want to continue release if this happens as all sorts of weird accidents may happen

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 if the desired branch actually exists

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

Checkout the wanted branch Supports pretend mode

Parameters
$options : array<string|int, mixed>

Additional options by reference.

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([array<string|int, mixed> $options = [] ]) : bool
Parameters
$options : array<string|int, mixed> = []

Not used, signature only

Return values
bool

Always false, this task may not be skipped

_branchExists()

Check if a given local branch exists

protected _branchExists(string $branch) : bool
Parameters
$branch : string

The branch to check

Return values
bool

True if the branch exists

_checkout()

Check out a branch

protected _checkout(string $branch, string $source) : mixed
Parameters
$branch : string

The branch to check out

$source : string

The source branch to create from if missing

Return values
mixed

_currentBranch()

Get the current branch

protected _currentBranch() : string
Return values
string

current branch

_getBranches()

Get the list of branch

protected _getBranches() : array<string|int, string>
Return values
array<string|int, string>

The list of local branches

_update()

Update branch from source branch

protected _update(string $branch, string $source) : mixed
Parameters
$branch : string

The branch to check out

$source : string

The source branch to create from if missing

Return values
mixed

_whichGit()

Look for the git binary

protected _whichGit() : string|void
Return values
string|void

Might make sense to factor out into a git helper for reuse?

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.

Search results