From 35840637b805ca72a56ba30d1d4d05ebf9e6fc40 Mon Sep 17 00:00:00 2001 From: Francesco Abeni Date: Thu, 29 Oct 2015 12:58:49 +0100 Subject: [PATCH] Change local configuration to real INI format --- RoboFile.dist.ini | 6 +----- RoboFile.php | 26 ++++++++++---------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/RoboFile.dist.ini b/RoboFile.dist.ini index e75403c..2980766 100644 --- a/RoboFile.dist.ini +++ b/RoboFile.dist.ini @@ -1,5 +1 @@ - true, // default is false -); +skipClone = true \ No newline at end of file diff --git a/RoboFile.php b/RoboFile.php index 96ea812..a104e85 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -164,7 +164,7 @@ class RoboFile extends \Robo\Tasks */ 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'); return; } @@ -182,30 +182,24 @@ class RoboFile extends \Robo\Tasks /** * Get (optional) configuration from an external file * - * @return array + * @return \stdClass|null */ public function getConfiguration() { $configurationFile = __DIR__ . '/RoboFile.ini'; + if (!file_exists($configurationFile)) { $this->say("No local configuration file"); - return array(); + return null; } - try { - require_once $configurationFile; - if (!is_array($configuration)) { - $this->say('Local configuration file is empty or wrong (it must contain a $configuration array'); - return array(); - } + $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 $configuration; - } - catch (Exception $ex) - { - $this->say('Exception reading local configuration file: ' . $ex->getMessage()); - return array(); - } + return json_decode(json_encode($configuration)); } /**