Removed localization from logs (Because it doesn't work)

This commit is contained in:
Dmitry Khomutov 2017-02-07 19:05:44 +07:00
commit 6cff08f073
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
32 changed files with 48 additions and 477 deletions

View file

@ -89,7 +89,7 @@ class Atoum extends Plugin
}
if (count($output) == 0) {
$status = false;
$this->builder->log(Lang::get('no_tests_performed'));
$this->builder->log('No tests have been performed.');
}
return $status;

View file

@ -66,7 +66,7 @@ class Behat extends Plugin
$behat = $this->executable;
if (!$behat) {
$this->builder->logFailure(Lang::get('could_not_find', 'behat'));
$this->builder->logFailure(sprintf('Could not find %s', 'behat'));
return false;
}

View file

@ -59,7 +59,7 @@ class Campfire extends Plugin
$this->authToken = $campfire['authToken'];
$this->roomId = $campfire['roomId'];
} else {
throw new \Exception(Lang::get('no_campfire_settings'));
throw new \Exception('No connection parameters given for Campfire plugin');
}
}

View file

@ -127,7 +127,7 @@ class Codeception extends Plugin implements ZeroConfigPluginInterface
$codeception = $this->builder->findBinary('codecept');
if (!$codeception) {
$this->builder->logFailure(Lang::get('could_not_find', 'codecept'));
$this->builder->logFailure(sprintf('Could not find %s', 'codecept'));
return false;
}

View file

@ -81,7 +81,7 @@ class CopyBuild extends Plugin
$success = $this->builder->executeCommand($cmd, $this->directory);
if (!$success) {
throw new \Exception(Lang::get('failed_to_wipe', $this->directory));
throw new \Exception(sprintf('Failed to wipe existing directory %s before copy', $this->directory));
}
}
}

View file

@ -76,8 +76,8 @@ class Email extends Plugin
);
// This is a success if we've not failed to send anything.
$this->builder->log(Lang::get('n_emails_sent', (count($addresses) - $sendFailures)));
$this->builder->log(Lang::get('n_emails_failed', $sendFailures));
$this->builder->log(sprintf('%d emails sent.', (count($addresses) - $sendFailures)));
$this->builder->log(sprintf('%d emails failed to send.', $sendFailures));
return ($sendFailures === 0);
}

View file

@ -48,7 +48,7 @@ class Env extends Plugin
if (!putenv($this->builder->interpolate($env_var))) {
$success = false;
$this->builder->logFailure(Lang::get('unable_to_set_env'));
$this->builder->logFailure('Unable to set environment variable');
}
}
return $success;

View file

@ -109,7 +109,7 @@ class Git extends Plugin
protected function runTagAction($options)
{
$tagName = date('Ymd-His');
$message = Lang::get('tag_created', date('Y-m-d H:i:s'));
$message = sprintf('Tag created by PHP Censor: %s', date('Y-m-d H:i:s'));
if (array_key_exists('name', $options)) {
$tagName = $this->builder->interpolate($options['name']);

View file

@ -57,7 +57,7 @@ class HipchatNotify extends Plugin
if (isset($options['message'])) {
$this->message = $options['message'];
} else {
$this->message = Lang::get('x_built_at_x');
$this->message = '%PROJECT_TITLE% built at %BUILD_URI%';
}
if (isset($options['color'])) {
@ -72,7 +72,7 @@ class HipchatNotify extends Plugin
$this->notify = false;
}
} else {
throw new \Exception(Lang::get('hipchat_settings'));
throw new \Exception('Please define room and authToken for hipchat_notify plugin.');
}
}

View file

@ -66,7 +66,7 @@ class Irc extends Plugin
$msg = $this->builder->interpolate($this->message);
if (empty($this->server) || empty($this->room) || empty($this->nick)) {
$this->builder->logFailure(Lang::get('irc_settings'));
$this->builder->logFailure('You must configure a server, room and nick.');
}
if (empty($this->port)) {

View file

@ -99,7 +99,7 @@ class Mysql extends Plugin
// SQL file execution
$this->executeFile($query['import']);
} else {
throw new \Exception(Lang::get('invalid_command'));
throw new \Exception('Invalid command.');
}
}
} catch (\Exception $ex) {
@ -117,19 +117,19 @@ class Mysql extends Plugin
protected function executeFile($query)
{
if (!isset($query['file'])) {
throw new \Exception(Lang::get('import_file_key'));
throw new \Exception('Import statement must contain a \'file\' key');
}
$import_file = $this->builder->buildPath . $this->builder->interpolate($query['file']);
if (!is_readable($import_file)) {
throw new \Exception(Lang::get('cannot_open_import', $import_file));
throw new \Exception(sprintf('Cannot open SQL import file: %s', $import_file));
}
$database = isset($query['database']) ? $this->builder->interpolate($query['database']) : null;
$import_command = $this->getImportCommand($import_file, $database);
if (!$this->builder->executeCommand($import_command)) {
throw new \Exception(Lang::get('unable_to_execute'));
throw new \Exception('Unable to execute SQL file');
}
return true;

View file

@ -204,7 +204,7 @@ class Phar extends Plugin
$success = true;
} catch (\Exception $e) {
$this->builder->log(Lang::get('phar_internal_error'));
$this->builder->log('Phar Plugin Internal Error');
$this->builder->log($e->getMessage());
}

View file

@ -163,7 +163,7 @@ class Phing extends Plugin
public function setBuildFile($buildFile)
{
if (!file_exists($this->getDirectory() . $buildFile)) {
throw new \Exception(Lang::get('build_file_missing'));
throw new \Exception('Specified build file does not exist.');
}
$this->buildFile = $buildFile;
@ -239,7 +239,7 @@ class Phing extends Plugin
public function setPropertyFile($propertyFile)
{
if (!file_exists($this->getDirectory() . DIRECTORY_SEPARATOR . $propertyFile)) {
throw new \Exception(Lang::get('property_file_missing'));
throw new \Exception('Specified property file does not exist.');
}
$this->propertyFile = $propertyFile;

View file

@ -211,7 +211,7 @@ class PhpCodeSniffer extends Plugin implements ZeroConfigPluginInterface
if (!is_array($data)) {
$this->builder->log($output);
throw new \Exception(PHPCensor\Helper\Lang::get('could_not_process_report'));
throw new \Exception('Could not process the report generated by PHP Code Sniffer.');
}
$errors = $data['totals']['errors'];

View file

@ -136,7 +136,7 @@ class PhpCpd extends Plugin implements ZeroConfigPluginInterface
if ($xml === false) {
$this->builder->log($xmlString);
throw new \Exception(Lang::get('could_not_process_report'));
throw new \Exception('Could not process the report generated by PHPCpd.');
}
$warnings = 0;

View file

@ -85,7 +85,7 @@ class PhpUnit extends Plugin implements ZeroConfigPluginInterface
$xmlConfigFiles = $this->options->getConfigFiles($this->build->getBuildPath());
$directories = $this->options->getDirectories();
if (empty($xmlConfigFiles) && empty($directories)) {
$this->builder->logFailure(Lang::get('phpunit_fail_init'));
$this->builder->logFailure('Neither a configuration file nor a test directory found.');
return false;
}

View file

@ -134,21 +134,25 @@ class Executor
$success = true;
foreach ($plugins as $plugin => $options) {
$this->logger->log("\n" . Lang::get('running_plugin', Lang::get($plugin)) . ' (' . Lang::get('stage') . ': ' . Lang::get('stage_' . $stage) . ')');
$this->logger->log("\n" .
sprintf('RUNNING PLUGIN: %s', Lang::get($plugin)) . ' (' .
'Stage' . ': ' .
Lang::get('stage_' . $stage) . ')'
);
$this->setPluginStatus($stage, $plugin, Build::STATUS_RUNNING);
// Try and execute it
if ($this->executePlugin($plugin, $options)) {
// Execution was successful
$this->logger->logSuccess(Lang::get('plugin_success'));
$this->logger->logSuccess('PLUGIN: SUCCESS');
$this->setPluginStatus($stage, $plugin, Build::STATUS_SUCCESS);
} else {
// Execution failed
$this->setPluginStatus($stage, $plugin, Build::STATUS_FAILED);
if ($stage === 'setup') {
$this->logger->logFailure(Lang::get('plugin_failed'));
$this->logger->logFailure('PLUGIN: FAILED');
// If we're in the "setup" stage, execution should not continue after
// a plugin has failed:
throw new Exception('Plugin failed: ' . $plugin);
@ -156,10 +160,10 @@ class Executor
// If we're in the "test" stage and the plugin is not allowed to fail,
// then mark the build as failed:
if (empty($options['allow_failures']) && $stage === 'test') {
$this->logger->logFailure(Lang::get('plugin_failed'));
$this->logger->logFailure('PLUGIN: FAILED');
$success = false;
} else {
$this->logger->logFailure(Lang::get('plugin_failed') . ' (' . Lang::get('failed_allowed') . ')');
$this->logger->logFailure('PLUGIN: FAILED (ALLOWED)');
}
}
}
@ -185,7 +189,7 @@ class Executor
}
if (!class_exists($class)) {
$this->logger->logFailure(Lang::get('plugin_missing', $plugin));
$this->logger->logFailure(sprintf('Plugin does not exist: %s', $plugin));
return false;
}
@ -196,7 +200,7 @@ class Executor
return $obj->execute();
} catch (\Exception $ex) {
$this->logger->logFailure(Lang::get('exception') . $ex->getMessage(), $ex);
$this->logger->logFailure('Exception: ' . $ex->getMessage(), $ex);
return false;
}