Adding slash in path

Fix / for DIRECTORY_SEPARATOR

Closed #1109
This commit is contained in:
Andreus Timm 2015-10-23 01:18:22 -02:00 committed by Tobias van Beek
parent 943c8124ac
commit 1d9c610a25
27 changed files with 111 additions and 96 deletions

View file

@ -258,7 +258,7 @@ class Build extends BuildBase
if (empty($this->currentBuildPath)) { if (empty($this->currentBuildPath)) {
$buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5); $buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5);
$this->currentBuildPath = PHPCI_BUILD_ROOT_DIR . $buildDirectory . '/'; $this->currentBuildPath = PHPCI_BUILD_ROOT_DIR . $buildDirectory . DIRECTORY_SEPARATOR;
} }
return $this->currentBuildPath; return $this->currentBuildPath;

View file

@ -38,19 +38,19 @@ class Campfire implements \PHPCI\Plugin
*/ */
public function __construct(Builder $phpci, Build $build, array $options = array()) public function __construct(Builder $phpci, Build $build, array $options = array())
{ {
$this->phpci = $phpci; $this->phpci = $phpci;
$this->build = $build; $this->build = $build;
$this->message = $options['message'];
$this->message = $options['message'];
$this->userAgent = "PHPCI/1.0 (+http://www.phptesting.org/)"; $this->userAgent = "PHPCI/1.0 (+http://www.phptesting.org/)";
$this->cookie = "phpcicookie"; $this->cookie = "phpcicookie";
$buildSettings = $phpci->getConfig('build_settings'); $buildSettings = $phpci->getConfig('build_settings');
if (isset($buildSettings['campfire'])) { if (isset($buildSettings['campfire'])) {
$campfire = $buildSettings['campfire']; $campfire = $buildSettings['campfire'];
$this->url = $campfire['url']; $this->url = $campfire['url'];
$this->authToken = $campfire['authToken']; $this->authToken = $campfire['authToken'];
$this->roomId = $campfire['roomId']; $this->roomId = $campfire['roomId'];
} else { } else {
throw new \Exception(Lang::get('no_campfire_settings')); throw new \Exception(Lang::get('no_campfire_settings'));
} }
@ -63,7 +63,7 @@ class Campfire implements \PHPCI\Plugin
*/ */
public function execute() public function execute()
{ {
$url = PHPCI_URL."build/view/".$this->build->getId(); $url = PHPCI_URL . "build/view/" . $this->build->getId();
$message = str_replace("%buildurl%", $url, $this->message); $message = str_replace("%buildurl%", $url, $this->message);
$this->joinRoom($this->roomId); $this->joinRoom($this->roomId);
$status = $this->speak($message, $this->roomId); $status = $this->speak($message, $this->roomId);
@ -101,6 +101,7 @@ class Campfire implements \PHPCI\Plugin
public function speak($message, $roomId, $isPaste = false) public function speak($message, $roomId, $isPaste = false)
{ {
$page = '/room/'.$roomId.'/speak.json'; $page = '/room/'.$roomId.'/speak.json';
if ($isPaste) { if ($isPaste) {
$type = 'PasteMessage'; $type = 'PasteMessage';
} else { } else {
@ -143,10 +144,12 @@ class Campfire implements \PHPCI\Plugin
// We tend to get one space with an otherwise blank response // We tend to get one space with an otherwise blank response
$output = trim($output); $output = trim($output);
if (strlen($output)) { if (strlen($output)) {
/* Responses are JSON. Decode it to a data structure */ /* Responses are JSON. Decode it to a data structure */
return json_decode($output); return json_decode($output);
} }
// Simple 200 OK response (such as for joining a room) // Simple 200 OK response (such as for joining a room)
return true; return true;
} }

View file

@ -39,9 +39,9 @@ class CleanBuild implements \PHPCI\Plugin
*/ */
public function __construct(Builder $phpci, Build $build, array $options = array()) public function __construct(Builder $phpci, Build $build, array $options = array())
{ {
$this->phpci = $phpci; $this->phpci = $phpci;
$this->build = $build; $this->build = $build;
$this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : array(); $this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : array();
} }
/** /**
@ -57,7 +57,7 @@ class CleanBuild implements \PHPCI\Plugin
$this->phpci->executeCommand($cmd, $this->phpci->buildPath . 'composer.lock'); $this->phpci->executeCommand($cmd, $this->phpci->buildPath . 'composer.lock');
$success = true; $success = true;
foreach ($this->remove as $file) { foreach ($this->remove as $file) {
$ok = $this->phpci->executeCommand($cmd, $this->phpci->buildPath . $file); $ok = $this->phpci->executeCommand($cmd, $this->phpci->buildPath . $file);

View file

@ -83,7 +83,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
{ {
$this->phpci = $phpci; $this->phpci = $phpci;
$this->build = $build; $this->build = $build;
$this->path = 'tests/_output/'; $this->path = 'tests' . DIRECTORY_SEPARATOR . '_output' . DIRECTORY_SEPARATOR;
if (empty($options['config'])) { if (empty($options['config'])) {
$this->ymlConfigFile = self::findConfigFile($this->phpci->buildPath); $this->ymlConfigFile = self::findConfigFile($this->phpci->buildPath);
@ -148,9 +148,9 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
$output = $parser->parse(); $output = $parser->parse();
$meta = array( $meta = array(
'tests' => $parser->getTotalTests(), 'tests' => $parser->getTotalTests(),
'timetaken' => $parser->getTotalTimeTaken(), 'timetaken' => $parser->getTotalTimeTaken(),
'failures' => $parser->getTotalFailures() 'failures' => $parser->getTotalFailures()
); );
$this->build->storeMeta('codeception-meta', $meta); $this->build->storeMeta('codeception-meta', $meta);

View file

@ -38,7 +38,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
*/ */
public static function canExecute($stage, Builder $builder, Build $build) public static function canExecute($stage, Builder $builder, Build $build)
{ {
$path = $builder->buildPath . '/composer.json'; $path = $builder->buildPath . DIRECTORY_SEPARATOR . 'composer.json';
if (file_exists($path) && $stage == 'setup') { if (file_exists($path) && $stage == 'setup') {
return true; return true;
@ -55,16 +55,16 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
*/ */
public function __construct(Builder $phpci, Build $build, array $options = array()) public function __construct(Builder $phpci, Build $build, array $options = array())
{ {
$path = $phpci->buildPath; $path = $phpci->buildPath;
$this->phpci = $phpci; $this->phpci = $phpci;
$this->build = $build; $this->build = $build;
$this->directory = $path; $this->directory = $path;
$this->action = 'install'; $this->action = 'install';
$this->preferDist = false; $this->preferDist = false;
$this->nodev = false; $this->nodev = false;
if (array_key_exists('directory', $options)) { if (array_key_exists('directory', $options)) {
$this->directory = $path . '/' . $options['directory']; $this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
} }
if (array_key_exists('action', $options)) { if (array_key_exists('action', $options)) {

View file

@ -35,12 +35,12 @@ class CopyBuild implements \PHPCI\Plugin
*/ */
public function __construct(Builder $phpci, Build $build, array $options = array()) public function __construct(Builder $phpci, Build $build, array $options = array())
{ {
$path = $phpci->buildPath; $path = $phpci->buildPath;
$this->phpci = $phpci; $this->phpci = $phpci;
$this->build = $build; $this->build = $build;
$this->directory = isset($options['directory']) ? $options['directory'] : $path; $this->directory = isset($options['directory']) ? $options['directory'] : $path;
$this->wipe = isset($options['wipe']) ? (bool)$options['wipe'] : false; $this->wipe = isset($options['wipe']) ? (bool)$options['wipe'] : false;
$this->ignore = isset($options['respect_ignore']) ? (bool)$options['respect_ignore'] : false; $this->ignore = isset($options['respect_ignore']) ? (bool)$options['respect_ignore'] : false;
} }
/** /**

View file

@ -52,9 +52,9 @@ class Email implements \PHPCI\Plugin
Build $build, Build $build,
array $options = array() array $options = array()
) { ) {
$this->phpci = $phpci; $this->phpci = $phpci;
$this->build = $build; $this->build = $build;
$this->options = $options; $this->options = $options;
} }
/** /**

View file

@ -52,7 +52,7 @@ class Env implements \PHPCI\Plugin
// This allows the standard syntax: "FOO: bar" // This allows the standard syntax: "FOO: bar"
$env_var = "$key=$value"; $env_var = "$key=$value";
} }
if (!putenv($this->phpci->interpolate($env_var))) { if (!putenv($this->phpci->interpolate($env_var))) {
$success = false; $success = false;
$this->phpci->logFailure(Lang::get('unable_to_set_env')); $this->phpci->logFailure(Lang::get('unable_to_set_env'));

View file

@ -52,7 +52,7 @@ class Grunt implements \PHPCI\Plugin
// Handle options: // Handle options:
if (isset($options['directory'])) { if (isset($options['directory'])) {
$this->directory = $path . '/' . $options['directory']; $this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
} }
if (isset($options['task'])) { if (isset($options['task'])) {

View file

@ -52,7 +52,7 @@ class Gulp implements \PHPCI\Plugin
// Handle options: // Handle options:
if (isset($options['directory'])) { if (isset($options['directory'])) {
$this->directory = $path . '/' . $options['directory']; $this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
} }
if (isset($options['task'])) { if (isset($options['task'])) {

View file

@ -41,9 +41,9 @@ class Lint implements PHPCI\Plugin
*/ */
public function __construct(Builder $phpci, Build $build, array $options = array()) public function __construct(Builder $phpci, Build $build, array $options = array())
{ {
$this->phpci = $phpci; $this->phpci = $phpci;
$this->build = $build; $this->build = $build;
$this->directories = array(''); $this->directories = array('');
$this->ignore = $phpci->ignore; $this->ignore = $phpci->ignore;
if (!empty($options['directory'])) { if (!empty($options['directory'])) {
@ -93,7 +93,7 @@ class Lint implements PHPCI\Plugin
if ($item->isFile() && $item->getExtension() == 'php' && !$this->lintFile($php, $itemPath)) { if ($item->isFile() && $item->getExtension() == 'php' && !$this->lintFile($php, $itemPath)) {
$success = false; $success = false;
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($php, $itemPath . '/')) { } elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($php, $itemPath . DIRECTORY_SEPARATOR)) {
$success = false; $success = false;
} }
@ -116,7 +116,8 @@ class Lint implements PHPCI\Plugin
continue; continue;
} }
$itemPath = $path . $item->getFilename(); $itemPath = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$itemPath .= ltrim($item->getFilename(), DIRECTORY_SEPARATOR);
if (in_array($itemPath, $this->ignore)) { if (in_array($itemPath, $this->ignore)) {
continue; continue;

View file

@ -33,12 +33,12 @@ class PackageBuild implements \PHPCI\Plugin
*/ */
public function __construct(Builder $phpci, Build $build, array $options = array()) public function __construct(Builder $phpci, Build $build, array $options = array())
{ {
$path = $phpci->buildPath; $path = $phpci->buildPath;
$this->build = $build; $this->build = $build;
$this->phpci = $phpci; $this->phpci = $phpci;
$this->directory = isset($options['directory']) ? $options['directory'] : $path; $this->directory = isset($options['directory']) ? $options['directory'] : $path;
$this->filename = isset($options['filename']) ? $options['filename'] : 'build'; $this->filename = isset($options['filename']) ? $options['filename'] : 'build';
$this->format = isset($options['format']) ? $options['format'] : 'zip'; $this->format = isset($options['format']) ? $options['format'] : 'zip';
} }
/** /**
@ -46,7 +46,7 @@ class PackageBuild implements \PHPCI\Plugin
*/ */
public function execute() public function execute()
{ {
$path = $this->phpci->buildPath; $path = $this->phpci->buildPath;
$build = $this->build; $build = $this->build;
if ($this->directory == $path) { if ($this->directory == $path) {

View file

@ -73,9 +73,9 @@ class Pgsql implements \PHPCI\Plugin
} }
/** /**
* Connects to PgSQL and runs a specified set of queries. * Connects to PgSQL and runs a specified set of queries.
* @return boolean * @return boolean
*/ */
public function execute() public function execute()
{ {
try { try {

View file

@ -213,7 +213,7 @@ class Phar implements \PHPCI\Plugin
$content = ''; $content = '';
$filename = $this->getStub(); $filename = $this->getStub();
if ($filename) { if ($filename) {
$content = file_get_contents($this->getPHPCI()->buildPath . '/' . $this->getStub()); $content = file_get_contents($this->getPHPCI()->buildPath . DIRECTORY_SEPARATOR . $this->getStub());
} }
return $content; return $content;
} }
@ -227,7 +227,8 @@ class Phar implements \PHPCI\Plugin
$success = false; $success = false;
try { try {
$phar = new PHPPhar($this->getDirectory() . '/' . $this->getFilename(), 0, $this->getFilename()); $file = $this->getDirectory() . DIRECTORY_SEPARATOR . $this->getFilename();
$phar = new PHPPhar($file, 0, $this->getFilename());
$phar->buildFromDirectory($this->getPHPCI()->buildPath, $this->getRegExp()); $phar->buildFromDirectory($this->getPHPCI()->buildPath, $this->getRegExp());
$stub = $this->getStubContent(); $stub = $this->getStubContent();
@ -236,7 +237,6 @@ class Phar implements \PHPCI\Plugin
} }
$success = true; $success = true;
} catch (Exception $e) { } catch (Exception $e) {
$this->getPHPCI()->log(Lang::get('phar_internal_error')); $this->getPHPCI()->log(Lang::get('phar_internal_error'));
$this->getPHPCI()->log($e->getMessage()); $this->getPHPCI()->log($e->getMessage());

View file

@ -47,7 +47,7 @@ class Phing implements \PHPCI\Plugin
* Set working directory * Set working directory
*/ */
if (isset($options['directory'])) { if (isset($options['directory'])) {
$directory = $phpci->buildPath . '/' . $options['directory']; $directory = $phpci->buildPath . DIRECTORY_SEPARATOR . $options['directory'];
} else { } else {
$directory = $phpci->buildPath; $directory = $phpci->buildPath;
} }
@ -255,7 +255,7 @@ class Phing implements \PHPCI\Plugin
*/ */
public function setPropertyFile($propertyFile) public function setPropertyFile($propertyFile)
{ {
if (!file_exists($this->getDirectory() . '/' . $propertyFile)) { if (!file_exists($this->getDirectory() . DIRECTORY_SEPARATOR . $propertyFile)) {
throw new \Exception(Lang::get('property_file_missing')); throw new \Exception(Lang::get('property_file_missing'));
} }

View file

@ -75,9 +75,9 @@ class PhpCpd implements \PHPCI\Plugin
if (count($this->ignore)) { if (count($this->ignore)) {
$map = function ($item) { $map = function ($item) {
// remove the trailing slash // remove the trailing slash
$item = rtrim($item, '/'); $item = rtrim($item, DIRECTORY_SEPARATOR);
if (is_file($this->path . '/' . $item)) { if (is_file(rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $item)) {
return ' --names-exclude ' . $item; return ' --names-exclude ' . $item;
} else { } else {
return ' --exclude ' . $item; return ' --exclude ' . $item;

View file

@ -32,10 +32,10 @@ class PhpCsFixer implements \PHPCI\Plugin
protected $build; protected $build;
protected $workingDir = ''; protected $workingDir = '';
protected $level = ' --level=psr2'; protected $level = ' --level=psr2';
protected $verbose = ''; protected $verbose = '';
protected $diff = ''; protected $diff = '';
protected $levels = array('psr0', 'psr1', 'psr2', 'symfony'); protected $levels = array('psr0', 'psr1', 'psr2', 'symfony');
/** /**
* Standard Constructor * Standard Constructor

View file

@ -69,19 +69,20 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
public function execute() public function execute()
{ {
$ignore = ''; $ignore = '';
if (count($this->phpci->ignore)) {
$map = function ($item) {
return ' --exclude ' . rtrim($item, '/');
};
$ignore = array_map($map, $this->phpci->ignore);
if (count($this->phpci->ignore)) {
$map = function ($item) {
return ' --exclude ' . rtrim($item, DIRECTORY_SEPARATOR);
};
$ignore = array_map($map, $this->phpci->ignore);
$ignore = implode('', $ignore); $ignore = implode('', $ignore);
} }
$phploc = $this->phpci->findBinary('phploc'); $phploc = $this->phpci->findBinary('phploc');
$success = $this->phpci->executeCommand($phploc . ' %s "%s"', $ignore, $this->directory); $success = $this->phpci->executeCommand($phploc . ' %s "%s"', $ignore, $this->directory);
$output = $this->phpci->getLastOutput(); $output = $this->phpci->getLastOutput();
if (preg_match_all('/\((LOC|CLOC|NCLOC|LLOC)\)\s+([0-9]+)/', $output, $matches)) { if (preg_match_all('/\((LOC|CLOC|NCLOC|LLOC)\)\s+([0-9]+)/', $output, $matches)) {
$data = array(); $data = array();

View file

@ -55,10 +55,10 @@ class PhpParallelLint implements \PHPCI\Plugin
*/ */
public function __construct(Builder $phpci, Build $build, array $options = array()) public function __construct(Builder $phpci, Build $build, array $options = array())
{ {
$this->phpci = $phpci; $this->phpci = $phpci;
$this->build = $build; $this->build = $build;
$this->directory = $phpci->buildPath; $this->directory = $phpci->buildPath;
$this->ignore = $this->phpci->ignore; $this->ignore = $this->phpci->ignore;
if (isset($options['directory'])) { if (isset($options['directory'])) {
$this->directory = $phpci->buildPath.$options['directory']; $this->directory = $phpci->buildPath.$options['directory'];

View file

@ -155,7 +155,7 @@ class PhpTalLint implements PHPCI\Plugin
if (!$this->lintFile($itemPath)) { if (!$this->lintFile($itemPath)) {
$success = false; $success = false;
} }
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($itemPath . '/')) { } elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($itemPath . DIRECTORY_SEPARATOR)) {
$success = false; $success = false;
} }
@ -202,7 +202,9 @@ class PhpTalLint implements PHPCI\Plugin
list($suffixes, $tales) = $this->getFlags(); list($suffixes, $tales) = $this->getFlags();
$lint = dirname(__FILE__) . '/../../vendor/phptal/phptal/tools/phptal_lint.php'; $lint = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
$lint .= 'vendor' . DIRECTORY_SEPARATOR . 'phptal' . DIRECTORY_SEPARATOR . 'phptal' . DIRECTORY_SEPARATOR;
$lint .= 'tools' . DIRECTORY_SEPARATOR . 'phptal_lint.php';
$cmd = '/usr/bin/env php ' . $lint . ' %s %s "%s"'; $cmd = '/usr/bin/env php ' . $lint . ' %s %s "%s"';
$this->phpci->executeCommand($cmd, $suffixes, $tales, $this->phpci->buildPath . $path); $this->phpci->executeCommand($cmd, $suffixes, $tales, $this->phpci->buildPath . $path);
@ -222,7 +224,7 @@ class PhpTalLint implements PHPCI\Plugin
$row = str_replace('(use -i to include your custom modifier functions)', '', $row); $row = str_replace('(use -i to include your custom modifier functions)', '', $row);
$message = str_replace($name . ': ', '', $row); $message = str_replace($name . ': ', '', $row);
$parts = explode(' (line ', $message); $parts = explode(' (line ', $message);
$message = trim($parts[0]); $message = trim($parts[0]);

View file

@ -76,8 +76,8 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
return 'phpunit.xml'; return 'phpunit.xml';
} }
if (file_exists($buildPath . 'tests/phpunit.xml')) { if (file_exists($buildPath . 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml')) {
return 'tests/phpunit.xml'; return 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml';
} }
if (file_exists($buildPath . 'phpunit.xml.dist')) { if (file_exists($buildPath . 'phpunit.xml.dist')) {
@ -85,7 +85,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
} }
if (file_exists($buildPath . 'tests/phpunit.xml.dist')) { if (file_exists($buildPath . 'tests/phpunit.xml.dist')) {
return 'tests/phpunit.xml.dist'; return 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml.dist';
} }
return null; return null;
@ -194,7 +194,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
} else { } else {
if ($this->runFrom) { if ($this->runFrom) {
$curdir = getcwd(); $curdir = getcwd();
chdir($this->phpci->buildPath.'/'.$this->runFrom); chdir($this->phpci->buildPath . DIRECTORY_SEPARATOR . $this->runFrom);
} }
$phpunit = $this->phpci->findBinary('phpunit'); $phpunit = $this->phpci->findBinary('phpunit');

View file

@ -163,7 +163,7 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
} }
// Ignore hidden files, else .git, .sass_cache, etc. all get looped over // Ignore hidden files, else .git, .sass_cache, etc. all get looped over
if (stripos($filePath, '/.') !== false) { if (stripos($filePath, DIRECTORY_SEPARATOR . '.') !== false) {
$skipFile = true; $skipFile = true;
} }

View file

@ -8,8 +8,8 @@ namespace PHPCI\Plugin\Util;
*/ */
class Factory class Factory
{ {
const TYPE_ARRAY = "array"; const TYPE_ARRAY = "array";
const TYPE_CALLABLE = "callable"; const TYPE_CALLABLE = "callable";
const INTERFACE_PHPCI_PLUGIN = '\PHPCI\Plugin'; const INTERFACE_PHPCI_PLUGIN = '\PHPCI\Plugin';
private $currentPluginOptions; private $currentPluginOptions;

View file

@ -56,6 +56,7 @@ class FilesPluginInformation implements InstalledPluginInformation
if ($this->pluginInfo === null) { if ($this->pluginInfo === null) {
$this->loadPluginInfo(); $this->loadPluginInfo();
} }
return $this->pluginInfo; return $this->pluginInfo;
} }
@ -83,7 +84,7 @@ class FilesPluginInformation implements InstalledPluginInformation
$this->pluginInfo = array(); $this->pluginInfo = array();
foreach ($this->files as $fileInfo) { foreach ($this->files as $fileInfo) {
if ($fileInfo instanceof \SplFileInfo) { if ($fileInfo instanceof \SplFileInfo) {
if ($fileInfo->isFile() && $fileInfo->getExtension()=='php') { if ($fileInfo->isFile() && $fileInfo->getExtension() == 'php') {
$this->addPluginFromFile($fileInfo); $this->addPluginFromFile($fileInfo);
} }
} }
@ -99,11 +100,11 @@ class FilesPluginInformation implements InstalledPluginInformation
$class = $this->getFullClassFromFile($fileInfo); $class = $this->getFullClassFromFile($fileInfo);
if (!is_null($class)) { if (!is_null($class)) {
$newPlugin = new \stdClass(); $newPlugin = new \stdClass();
$newPlugin->class = $class; $newPlugin->class = $class;
$newPlugin->source = "core"; $newPlugin->source = "core";
$parts = explode('\\', $newPlugin->class); $parts = explode('\\', $newPlugin->class);
$newPlugin->name = end($parts); $newPlugin->name = end($parts);
$this->pluginInfo[] = $newPlugin; $this->pluginInfo[] = $newPlugin;
} }
@ -123,11 +124,11 @@ class FilesPluginInformation implements InstalledPluginInformation
if (isset($matches[1])) { if (isset($matches[1])) {
$className = $matches[1]; $className = $matches[1];
$matches = array(); $matches = array();
preg_match('#namespace +([A-Za-z\\\\]+);#i', $contents, $matches); preg_match('#namespace +([A-Za-z\\\\]+);#i', $contents, $matches);
$namespace = $matches[1]; $namespace = $matches[1];
return $namespace . '\\' . $className; return $namespace . '\\' . $className;
} else { } else {
return null; return null;

View file

@ -32,9 +32,11 @@ class PluginInformationCollection implements InstalledPluginInformation
public function getInstalledPlugins() public function getInstalledPlugins()
{ {
$arr = array(); $arr = array();
foreach ($this->pluginInformations as $single) { foreach ($this->pluginInformations as $single) {
$arr = array_merge($arr, $single->getInstalledPlugins()); $arr = array_merge($arr, $single->getInstalledPlugins());
} }
return $arr; return $arr;
} }
@ -47,9 +49,11 @@ class PluginInformationCollection implements InstalledPluginInformation
public function getPluginClasses() public function getPluginClasses()
{ {
$arr = array(); $arr = array();
foreach ($this->pluginInformations as $single) { foreach ($this->pluginInformations as $single) {
$arr = array_merge($arr, $single->getPluginClasses()); $arr = array_merge($arr, $single->getPluginClasses());
} }
return $arr; return $arr;
} }
} }

View file

@ -235,18 +235,20 @@ class TapParser
*/ */
protected function processYamlBlock($indent) protected function processYamlBlock($indent)
{ {
$startLine = $this->lineNumber+1; $startLine = $this->lineNumber + 1;
$endLine = $indent.'...'; $endLine = $indent . '...';
$yamlLines = array(); $yamlLines = array();
do { do {
$line = $this->nextLine(); $line = $this->nextLine();
if ($line === false) { if ($line === false) {
throw new Exception(Lang::get('tap_error_endless_yaml', $startLine)); throw new Exception(Lang::get('tap_error_endless_yaml', $startLine));
} elseif ($line === $endLine) { } elseif ($line === $endLine) {
break; break;
} }
$yamlLines[] = substr($line, strlen($indent));
$yamlLines[] = substr($line, strlen($indent));
} while (true); } while (true);
return Yaml::parse(join("\n", $yamlLines)); return Yaml::parse(join("\n", $yamlLines));

View file

@ -132,8 +132,9 @@ class XMPP implements \PHPCI\Plugin
*/ */
public function findConfigFile() public function findConfigFile()
{ {
if (file_exists($this->phpci->buildPath . '/.sendxmpprc')) { if (file_exists($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc')) {
if (md5(file_get_contents($this->phpci->buildPath . '/.sendxmpprc')) !== md5($this->getConfigFormat())) { if (md5(file_get_contents($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc'))
!== md5($this->getConfigFormat())) {
return null; return null;
} }
@ -160,7 +161,7 @@ class XMPP implements \PHPCI\Plugin
/* /*
* Try to build conf file * Try to build conf file
*/ */
$config_file = $this->phpci->buildPath . '/.sendxmpprc'; $config_file = $this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc';
if (is_null($this->findConfigFile())) { if (is_null($this->findConfigFile())) {
file_put_contents($config_file, $this->getConfigFormat()); file_put_contents($config_file, $this->getConfigFormat());
chmod($config_file, 0600); chmod($config_file, 0600);
@ -174,7 +175,7 @@ class XMPP implements \PHPCI\Plugin
$tls = ' -t'; $tls = ' -t';
} }
$message_file = $this->phpci->buildPath . '/' . uniqid('xmppmessage'); $message_file = $this->phpci->buildPath . DIRECTORY_SEPARATOR . uniqid('xmppmessage');
if ($this->buildMessage($message_file) === false) { if ($this->buildMessage($message_file) === false) {
return false; return false;
} }