mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-06-07 00:40:48 +00:00
Merge pull request #107 from therunnergit/master
Add config param for local cms folder
This commit is contained in:
commit
f944819f3e
|
@ -1 +1,6 @@
|
||||||
skipClone = true
|
; If set to true, the repo will not be cloned from GitHub and the local copy will be reused.
|
||||||
|
; This setting will be obsolete once we have local Git cache enabled
|
||||||
|
skipClone = false
|
||||||
|
; 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
|
||||||
|
cmsPath = tests/joomla-cms3
|
46
RoboFile.php
46
RoboFile.php
|
@ -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();
|
||||||
|
@ -164,6 +168,12 @@ class RoboFile extends \Robo\Tasks
|
||||||
*/
|
*/
|
||||||
public function createTestingSite()
|
public function createTestingSite()
|
||||||
{
|
{
|
||||||
|
if (!empty($this->configuration->skipClone))
|
||||||
|
{
|
||||||
|
$this->say('Reusing Joomla CMS site already present at ' . $this->cmsPath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 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))
|
||||||
{
|
{
|
||||||
|
@ -171,15 +181,14 @@ class RoboFile extends \Robo\Tasks
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy cache to the testing folder
|
// Copy cache to the testing folder
|
||||||
$this->_copyDir('tests/cache', 'tests/joomla-cms3');
|
$this->_copyDir('tests/cache', $this->cmsPath);
|
||||||
|
$this->say('Joomla CMS site created at ' . $this->cmsPath);
|
||||||
$this->say('Joomla CMS site created at tests/joomla-cms3');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -191,13 +200,15 @@ class RoboFile extends \Robo\Tasks
|
||||||
{
|
{
|
||||||
$configurationFile = __DIR__ . '/RoboFile.ini';
|
$configurationFile = __DIR__ . '/RoboFile.ini';
|
||||||
|
|
||||||
if (!file_exists($configurationFile)) {
|
if (!file_exists($configurationFile))
|
||||||
|
{
|
||||||
$this->say("No local configuration file");
|
$this->say("No local configuration file");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$configuration = parse_ini_file($configurationFile);
|
$configuration = parse_ini_file($configurationFile);
|
||||||
if ($configuration === false) {
|
if ($configuration === false)
|
||||||
|
{
|
||||||
$this->say('Local configuration file is empty or wrong (check is it in correct .ini format');
|
$this->say('Local configuration file is empty or wrong (check is it in correct .ini format');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -205,6 +216,27 @@ 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.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user