Initial Drupal 11 with DDEV setup
This commit is contained in:
179
vendor/consolidation/robo/src/Task/Vcs/GitStack.php
vendored
Normal file
179
vendor/consolidation/robo/src/Task/Vcs/GitStack.php
vendored
Normal file
@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
namespace Robo\Task\Vcs;
|
||||
|
||||
use Robo\Task\CommandStack;
|
||||
use Robo\Common\ProcessUtils;
|
||||
|
||||
/**
|
||||
* Runs Git commands in stack. You can use `stopOnFail()` to point that stack should be terminated on first fail.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $this->taskGitStack()
|
||||
* ->stopOnFail()
|
||||
* ->add('-A')
|
||||
* ->commit('adding everything')
|
||||
* ->push('origin','master')
|
||||
* ->tag('0.6.0')
|
||||
* ->push('origin','0.6.0')
|
||||
* ->run()
|
||||
*
|
||||
* $this->taskGitStack()
|
||||
* ->stopOnFail()
|
||||
* ->add('doc/*')
|
||||
* ->commit('doc updated')
|
||||
* ->push()
|
||||
* ->run();
|
||||
* ?>
|
||||
* ```
|
||||
*/
|
||||
class GitStack extends CommandStack
|
||||
{
|
||||
/**
|
||||
* @param string $pathToGit
|
||||
*/
|
||||
public function __construct($pathToGit = 'git')
|
||||
{
|
||||
$this->executable = $pathToGit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `git clone`
|
||||
*
|
||||
* @param string $repo
|
||||
* @param string $to
|
||||
* @param string $branch
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function cloneRepo($repo, $to = "", $branch = "")
|
||||
{
|
||||
$cmd = ['clone', $repo, $to];
|
||||
if (!empty($branch)) {
|
||||
$cmd[] = "--branch $branch";
|
||||
}
|
||||
return $this->exec($cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `git clone` with depth 1 as default
|
||||
*
|
||||
* @param string $repo
|
||||
* @param string $to
|
||||
* @param string $branch
|
||||
* @param int $depth
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function cloneShallow($repo, $to = '', $branch = "", $depth = 1)
|
||||
{
|
||||
$cmd = ["clone --depth $depth", $repo, $to];
|
||||
if (!empty($branch)) {
|
||||
$cmd[] = "--branch $branch";
|
||||
}
|
||||
|
||||
return $this->exec($cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `git add` command with files to add pattern
|
||||
*
|
||||
* @param string $pattern
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function add($pattern)
|
||||
{
|
||||
return $this->exec([__FUNCTION__, $pattern]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `git commit` command with a message
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $options
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function commit($message, $options = "")
|
||||
{
|
||||
$message = ProcessUtils::escapeArgument($message);
|
||||
return $this->exec([__FUNCTION__, "-m $message", $options]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `git pull` command.
|
||||
*
|
||||
* @param string $origin
|
||||
* @param string $branch
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function pull($origin = '', $branch = '')
|
||||
{
|
||||
return $this->exec([__FUNCTION__, $origin, $branch]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `git push` command
|
||||
*
|
||||
* @param string $origin
|
||||
* @param string $branch
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function push($origin = '', $branch = '')
|
||||
{
|
||||
return $this->exec([__FUNCTION__, $origin, $branch]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs git merge
|
||||
*
|
||||
* @param string $branch
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function merge($branch)
|
||||
{
|
||||
return $this->exec([__FUNCTION__, $branch]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `git checkout` command
|
||||
*
|
||||
* @param string $branch
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function checkout($branch)
|
||||
{
|
||||
return $this->exec([__FUNCTION__, $branch]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `git tag` command
|
||||
*
|
||||
* @param string $tag_name
|
||||
* @param string $message
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function tag($tag_name, $message = "")
|
||||
{
|
||||
if ($message != "") {
|
||||
$message = "-m '$message'";
|
||||
}
|
||||
return $this->exec([__FUNCTION__, $message, $tag_name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->printTaskInfo("Running git commands...");
|
||||
return parent::run();
|
||||
}
|
||||
}
|
||||
154
vendor/consolidation/robo/src/Task/Vcs/HgStack.php
vendored
Normal file
154
vendor/consolidation/robo/src/Task/Vcs/HgStack.php
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace Robo\Task\Vcs;
|
||||
|
||||
use Robo\Task\CommandStack;
|
||||
|
||||
/**
|
||||
* Runs hg commands in stack. You can use `stopOnFail()` to point that stack should be terminated on first fail.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $this->hgStack
|
||||
* ->cloneRepo('https://bitbucket.org/durin42/hgsubversion')
|
||||
* ->pull()
|
||||
* ->add()
|
||||
* ->commit('changed')
|
||||
* ->push()
|
||||
* ->tag('0.6.0')
|
||||
* ->push('0.6.0')
|
||||
* ->run();
|
||||
* ?>
|
||||
* ```
|
||||
*/
|
||||
class HgStack extends CommandStack
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $pathToHg
|
||||
*/
|
||||
public function __construct($pathToHg = 'hg')
|
||||
{
|
||||
$this->executable = $pathToHg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `hg clone`
|
||||
*
|
||||
* @param string $repo
|
||||
* @param string $to
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function cloneRepo($repo, $to = '')
|
||||
{
|
||||
return $this->exec(['clone', $repo, $to]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `hg add` command with files to add by pattern
|
||||
*
|
||||
* @param string $include
|
||||
* @param string $exclude
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function add($include = '', $exclude = '')
|
||||
{
|
||||
if (strlen($include) > 0) {
|
||||
$include = "-I {$include}";
|
||||
}
|
||||
|
||||
if (strlen($exclude) > 0) {
|
||||
$exclude = "-X {$exclude}";
|
||||
}
|
||||
|
||||
return $this->exec([__FUNCTION__, $include, $exclude]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `hg commit` command with a message
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $options
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function commit($message, $options = '')
|
||||
{
|
||||
return $this->exec([__FUNCTION__, "-m '{$message}'", $options]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `hg pull` command.
|
||||
*
|
||||
* @param string $branch
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function pull($branch = '')
|
||||
{
|
||||
if (strlen($branch) > 0) {
|
||||
$branch = "-b '{$branch}''";
|
||||
}
|
||||
|
||||
return $this->exec([__FUNCTION__, $branch]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `hg push` command
|
||||
*
|
||||
* @param string $branch
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function push($branch = '')
|
||||
{
|
||||
if (strlen($branch) > 0) {
|
||||
$branch = "-b '{$branch}'";
|
||||
}
|
||||
|
||||
return $this->exec([__FUNCTION__, $branch]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs hg merge
|
||||
*
|
||||
* @param string $revision
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function merge($revision = '')
|
||||
{
|
||||
if (strlen($revision) > 0) {
|
||||
$revision = "-r {$revision}";
|
||||
}
|
||||
|
||||
return $this->exec([__FUNCTION__, $revision]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `hg tag` command
|
||||
*
|
||||
* @param string $tag_name
|
||||
* @param string $message
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function tag($tag_name, $message = '')
|
||||
{
|
||||
if ($message !== '') {
|
||||
$message = "-m '{$message}'";
|
||||
}
|
||||
return $this->exec([__FUNCTION__, $message, $tag_name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->printTaskInfo('Running hg commands...');
|
||||
return parent::run();
|
||||
}
|
||||
}
|
||||
36
vendor/consolidation/robo/src/Task/Vcs/Shortcuts.php
vendored
Normal file
36
vendor/consolidation/robo/src/Task/Vcs/Shortcuts.php
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Robo\Task\Vcs;
|
||||
|
||||
trait Shortcuts
|
||||
{
|
||||
/**
|
||||
* @param string $url
|
||||
*
|
||||
* @return \Robo\Result
|
||||
*/
|
||||
protected function _svnCheckout($url)
|
||||
{
|
||||
return $this->taskSvnStack()->checkout($url)->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
*
|
||||
* @return \Robo\Result
|
||||
*/
|
||||
protected function _gitClone($url)
|
||||
{
|
||||
return $this->taskGitStack()->cloneRepo($url)->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
*
|
||||
* @return \Robo\Result
|
||||
*/
|
||||
protected function _hgClone($url)
|
||||
{
|
||||
return $this->taskHgStack()->cloneRepo($url)->run();
|
||||
}
|
||||
}
|
||||
107
vendor/consolidation/robo/src/Task/Vcs/SvnStack.php
vendored
Normal file
107
vendor/consolidation/robo/src/Task/Vcs/SvnStack.php
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace Robo\Task\Vcs;
|
||||
|
||||
use Robo\Contract\CommandInterface;
|
||||
use Robo\Result;
|
||||
use Robo\Task\CommandStack;
|
||||
|
||||
/**
|
||||
* Runs Svn commands in stack. You can use `stopOnFail()` to point that stack should be terminated on first fail.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $this->taskSvnStack()
|
||||
* ->checkout('http://svn.collab.net/repos/svn/trunk')
|
||||
* ->run()
|
||||
*
|
||||
* // alternatively
|
||||
* $this->_svnCheckout('http://svn.collab.net/repos/svn/trunk');
|
||||
*
|
||||
* $this->taskSvnStack('username', 'password')
|
||||
* ->stopOnFail()
|
||||
* ->update()
|
||||
* ->add('doc/*')
|
||||
* ->commit('doc updated')
|
||||
* ->run();
|
||||
* ?>
|
||||
* ```
|
||||
*/
|
||||
class SvnStack extends CommandStack implements CommandInterface
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $stopOnFail = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $result;
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param string $pathToSvn
|
||||
*/
|
||||
public function __construct($username = '', $password = '', $pathToSvn = 'svn')
|
||||
{
|
||||
$this->executable = $pathToSvn;
|
||||
if (!empty($username)) {
|
||||
$this->executable .= " --username $username";
|
||||
}
|
||||
if (!empty($password)) {
|
||||
$this->executable .= " --password $password";
|
||||
}
|
||||
$this->result = Result::success($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates `svn update` command
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function update($path = '')
|
||||
{
|
||||
return $this->exec("update $path");
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `svn add` command with files to add pattern
|
||||
*
|
||||
* @param string $pattern
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function add($pattern = '')
|
||||
{
|
||||
return $this->exec("add $pattern");
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `svn commit` command with a message
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $options
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function commit($message, $options = "")
|
||||
{
|
||||
return $this->exec("commit -m '$message' $options");
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes `svn checkout` command
|
||||
*
|
||||
* @param string $branch
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function checkout($branch)
|
||||
{
|
||||
return $this->exec("checkout $branch");
|
||||
}
|
||||
}
|
||||
38
vendor/consolidation/robo/src/Task/Vcs/Tasks.php
vendored
Normal file
38
vendor/consolidation/robo/src/Task/Vcs/Tasks.php
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Robo\Task\Vcs;
|
||||
|
||||
trait Tasks
|
||||
{
|
||||
/**
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param string $pathToSvn
|
||||
*
|
||||
* @return \Robo\Task\Vcs\SvnStack|\Robo\Collection\CollectionBuilder
|
||||
*/
|
||||
protected function taskSvnStack($username = '', $password = '', $pathToSvn = 'svn')
|
||||
{
|
||||
return $this->task(SvnStack::class, $username, $password, $pathToSvn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pathToGit
|
||||
*
|
||||
* @return \Robo\Task\Vcs\GitStack|\Robo\Collection\CollectionBuilder
|
||||
*/
|
||||
protected function taskGitStack($pathToGit = 'git')
|
||||
{
|
||||
return $this->task(GitStack::class, $pathToGit);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pathToHg
|
||||
*
|
||||
* @return \Robo\Task\Vcs\HgStack|\Robo\Collection\CollectionBuilder
|
||||
*/
|
||||
protected function taskHgStack($pathToHg = 'hg')
|
||||
{
|
||||
return $this->task(HgStack::class, $pathToHg);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user