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

Add config param for local cms folder

This commit is contained in:
Francesco Abeni 2015-10-29 14:52:04 +01:00
parent 35840637b8
commit 3e268d0626
2 changed files with 30 additions and 6 deletions

View File

@ -1 +1,2 @@
skipClone = true skipClone = true
cmsPath = /path/to/my/local/website/root

View File

@ -19,6 +19,8 @@ class RoboFile extends \Robo\Tasks
private $configuration = array(); private $configuration = array();
private $cmsPath = '';
/** /**
* Set the Execute extension for Windows Operating System * Set the Execute extension for Windows Operating System
* *
@ -44,6 +46,8 @@ class RoboFile extends \Robo\Tasks
{ {
$this->configuration = $this->getConfiguration(); $this->configuration = $this->getConfiguration();
$this->cmsPath = $this->getCmsPath();
$this->setExecExtension(); $this->setExecExtension();
$this->createTestingSite(); $this->createTestingSite();
@ -165,18 +169,18 @@ class RoboFile extends \Robo\Tasks
public function createTestingSite() public function createTestingSite()
{ {
if (!empty($this->configuration->skipClone)) { if (!empty($this->configuration->skipClone)) {
$this->say('Reusing Joomla CMS site already present at tests/joomla-cms3'); $this->say('Reusing Joomla CMS site already present at ' . $this->cmsPath);
return; return;
} }
// Get Joomla Clean Testing sites // Get Joomla Clean Testing sites
if (is_dir('tests/joomla-cms3')) if (is_dir($this->cmsPath))
{ {
$this->taskDeleteDir('tests/joomla-cms3')->run(); $this->taskDeleteDir($this->cmsPath)->run();
} }
$this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/joomla-cms3'); $this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git ' . $this->cmsPath);
$this->say('Joomla CMS site created at tests/joomla-cms3'); $this->say('Joomla CMS site created at ' . $this->cmsPath);
} }
/** /**
@ -202,6 +206,25 @@ class RoboFile extends \Robo\Tasks
return json_decode(json_encode($configuration)); return json_decode(json_encode($configuration));
} }
/**
* Get the correct CMS root path
*
* @return string
*/
private function getCmsPath()
{
if (empty($this->configuration->cmsPath)) {
return 'tests/joomla-cms3';
}
if (!file_exists(dirname($this->configuration->cmsPath))) {
$this->say("Cms path written in local configuration does not exists or is not readable");
return 'tests/joomla-cms3';
}
return $this->configuration->cmsPath;
}
/** /**
* Runs Selenium Standalone Server. * Runs Selenium Standalone Server.
* *