32
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-12-27 02:12:50 +00:00

Extend clone options

This commit is contained in:
Francesco Abeni 2015-10-30 10:38:10 +01:00
parent 0513bdd03f
commit 7a2aca3b9a
2 changed files with 28 additions and 3 deletions

View File

@ -4,3 +4,5 @@ skipClone = false
; If you want to setup your test website in a different folder, you can do that here. ; If you want to setup your test website in a different folder, you can do that here.
; You can also set an absolute path, i.e. /path/to/my/cms/folder ; You can also set an absolute path, i.e. /path/to/my/cms/folder
cmsPath = tests/joomla-cms3 cmsPath = tests/joomla-cms3
; If you want to clone a different branch, you can set it here
branch = staging

View File

@ -28,7 +28,7 @@ class RoboFile extends \Robo\Tasks
*/ */
private function setExecExtension() private function setExecExtension()
{ {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') if ($this->isWindows())
{ {
$this->extension = '.exe'; $this->extension = '.exe';
} }
@ -177,7 +177,7 @@ class RoboFile extends \Robo\Tasks
// Caching cloned installations locally // Caching cloned installations locally
if (!is_dir('tests/cache') || (time() - filemtime('tests/cache') > 60 * 60 * 24)) if (!is_dir('tests/cache') || (time() - filemtime('tests/cache') > 60 * 60 * 24))
{ {
$this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/cache'); $this->_exec($this->buildGitCloneCommand());
} }
// Get Joomla Clean Testing sites // Get Joomla Clean Testing sites
@ -216,6 +216,29 @@ class RoboFile extends \Robo\Tasks
return json_decode(json_encode($configuration)); return json_decode(json_encode($configuration));
} }
/**
* Build correct git clone command according to local configuration and OS
*
* @return string
*/
private function buildGitCloneCommand()
{
$branch = empty($this->configuration->branch) ? 'staging' : $this->configuration->branch;
$insecure = $this->isWindows() ? ' --insecure' : '';
return "git" . $this->extension . " clone -b $branch $insecure --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/cache";
}
/**
* Check if local OS is Windows
*
* @return bool
*/
private function isWindows()
{
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
}
/** /**
* Get the correct CMS root path * Get the correct CMS root path
* *