32
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-12-26 10:07:30 +00:00

Merge pull request #104 from therunnergit/master

Add local configuration file for RoboFile.php
This commit is contained in:
Robert Deutz 2015-10-29 14:30:59 +01:00
commit f7966408b5
3 changed files with 34 additions and 0 deletions

1
.gitignore vendored
View File

@ -45,6 +45,7 @@ vendor/*
# Robo # Robo
robo.phar robo.phar
RoboFile.ini
# Test related files # Test related files
tests/acceptance.suite.yml tests/acceptance.suite.yml

1
RoboFile.dist.ini Normal file
View File

@ -0,0 +1 @@
skipClone = true

View File

@ -17,6 +17,8 @@ class RoboFile extends \Robo\Tasks
private $extension = ''; private $extension = '';
private $configuration = array();
/** /**
* Set the Execute extension for Windows Operating System * Set the Execute extension for Windows Operating System
* *
@ -40,6 +42,8 @@ class RoboFile extends \Robo\Tasks
*/ */
public function runTests($seleniumPath = null, $suite = 'acceptance') public function runTests($seleniumPath = null, $suite = 'acceptance')
{ {
$this->configuration = $this->getConfiguration();
$this->setExecExtension(); $this->setExecExtension();
$this->createTestingSite(); $this->createTestingSite();
@ -160,6 +164,11 @@ 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 tests/joomla-cms3');
return;
}
// Get Joomla Clean Testing sites // Get Joomla Clean Testing sites
if (is_dir('tests/joomla-cms3')) if (is_dir('tests/joomla-cms3'))
{ {
@ -170,6 +179,29 @@ class RoboFile extends \Robo\Tasks
$this->say('Joomla CMS site created at tests/joomla-cms3'); $this->say('Joomla CMS site created at tests/joomla-cms3');
} }
/**
* Get (optional) configuration from an external file
*
* @return \stdClass|null
*/
public function getConfiguration()
{
$configurationFile = __DIR__ . '/RoboFile.ini';
if (!file_exists($configurationFile)) {
$this->say("No local configuration file");
return null;
}
$configuration = parse_ini_file($configurationFile);
if ($configuration === false) {
$this->say('Local configuration file is empty or wrong (check is it in correct .ini format');
return null;
}
return json_decode(json_encode($configuration));
}
/** /**
* Runs Selenium Standalone Server. * Runs Selenium Standalone Server.
* *