Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benaka@piwik.pro>2015-01-13 13:44:39 +0300
committerdiosmosis <benaka@piwik.pro>2015-01-13 13:45:01 +0300
commit051722a0f986d973b90af931f51223cb7ca520ba (patch)
tree0e30bb0ba268af702ccc9ad6cc3cd21f2708e924 /plugins/TestRunner/TravisYml
parentf57171e8d638e859a28966ce1678ffb9934100c8 (diff)
Remove dependency on Piwik DI in generate:travis-yml command (for travis builds against older piwik versions).
Diffstat (limited to 'plugins/TestRunner/TravisYml')
-rw-r--r--plugins/TestRunner/TravisYml/Generator.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/TestRunner/TravisYml/Generator.php b/plugins/TestRunner/TravisYml/Generator.php
index 8243ac969e..8c8d087a0e 100644
--- a/plugins/TestRunner/TravisYml/Generator.php
+++ b/plugins/TestRunner/TravisYml/Generator.php
@@ -8,7 +8,6 @@
namespace Piwik\Plugins\TestRunner\TravisYml;
use Exception;
-use Piwik\Container\StaticContainer;
use Piwik\Plugins\TestRunner\Commands\GenerateTravisYmlFile;
use Psr\Log\LoggerInterface;
@@ -25,7 +24,7 @@ abstract class Generator
/**
* @var LoggerInterface
*/
- protected $logger;
+ private $logger;
/**
* @var TravisYmlView
@@ -40,7 +39,9 @@ abstract class Generator
public function __construct($options)
{
$this->options = $options;
- $this->logger = StaticContainer::get('Psr\Log\LoggerInterface');
+ if (class_exists('\Piwik\Container\StaticContainer')) {
+ $this->logger = \Piwik\Container\StaticContainer::get('Psr\Log\LoggerInterface');
+ }
$this->view = new TravisYmlView();
}
@@ -99,13 +100,13 @@ abstract class Generator
$outputYmlPath = $this->getTravisYmlOutputPath();
if (file_exists($outputYmlPath)) {
- $this->logger->info("Found existing YAML file at {path}.", array('path' => $outputYmlPath));
+ $this->log('info', "Found existing YAML file at {path}.", array('path' => $outputYmlPath));
$parser = new Parser();
$existingSections = $parser->processExistingTravisYml($outputYmlPath);
$this->view->setExistingSections($existingSections);
} else {
- $this->logger->info("Could not find existing YAML file at {path}, generating a new one.", array('path' => $outputYmlPath));
+ $this->log('info', "Could not find existing YAML file at {path}, generating a new one.", array('path' => $outputYmlPath));
}
$this->setExtraEnvironmentVariables();
@@ -113,7 +114,7 @@ abstract class Generator
protected function travisEncrypt($data)
{
- $this->logger->info("Encrypting \"{data}\"...", array('data' => $data));
+ $this->log('info', "Encrypting \"{data}\"...", array('data' => $data));
$command = "travis encrypt \"$data\"";
@@ -171,7 +172,7 @@ abstract class Generator
private function setExtraEnvironmentVariables()
{
if (!empty($this->view->existingEnv)) {
- $this->logger->info("Existing .yml file found, ignoring global variables specified on command line.");
+ $this->log('info', "Existing .yml file found, ignoring global variables specified on command line.");
return;
}
@@ -198,4 +199,11 @@ abstract class Generator
unset($options['dump']);
return $options;
}
+
+ protected function log($level, $message, $params = array())
+ {
+ if ($this->logger) {
+ $this->logger->$level($message, $params);
+ }
+ }
} \ No newline at end of file