Add a new plugin Phing Launcher (https://bitbucket.org/kmelia/phing-launcher) based on the Phing plugin

This commit is contained in:
Maxime 2015-10-23 14:22:25 +02:00
parent 943c8124ac
commit 719dd184b0
3 changed files with 44 additions and 4 deletions

View file

@ -162,7 +162,12 @@ abstract class BaseCommandExecutor implements CommandExecutor
$this->logger->log(Lang::get('found_in_path', $composerBin, $bin), LogLevel::DEBUG); $this->logger->log(Lang::get('found_in_path', $composerBin, $bin), LogLevel::DEBUG);
return $composerBin . '/' . $bin; return $composerBin . '/' . $bin;
} }
if (is_dir($this->buildPath) && is_file($this->buildPath.$bin)) {
$this->logger->log(Lang::get('found_in_path', $this->buildPath, $bin), LogLevel::DEBUG);
return $this->buildPath . $bin;
}
if (is_file($this->rootDir . $bin)) { if (is_file($this->rootDir . $bin)) {
$this->logger->log(Lang::get('found_in_path', 'root', $bin), LogLevel::DEBUG); $this->logger->log(Lang::get('found_in_path', 'root', $bin), LogLevel::DEBUG);
return $this->rootDir . $bin; return $this->rootDir . $bin;

View file

@ -23,9 +23,9 @@ use PHPCI\Model\Build;
class Phing implements \PHPCI\Plugin class Phing implements \PHPCI\Plugin
{ {
private $directory; protected $directory;
private $buildFile = 'build.xml'; private $buildFile = 'build.xml';
private $targets = array('build'); protected $targets = array('build');
private $properties = array(); private $properties = array();
private $propertyFile; private $propertyFile;
@ -144,7 +144,7 @@ class Phing implements \PHPCI\Plugin
* Converts an array of targets into a string. * Converts an array of targets into a string.
* @return string * @return string
*/ */
private function targetsToString() protected function targetsToString()
{ {
return implode(' ', $this->targets); return implode(' ', $this->targets);
} }

View file

@ -0,0 +1,35 @@
<?php
namespace PHPCI\Plugin;
/**
* Phing Launcher Plugin - Provides access to Phing functionality with Phing Launcher.
*
* @author kmelia
* @package PHPCI
* @subpackage Plugins
*/
class PhingLauncher extends Phing implements \PHPCI\Plugin
{
/**
* Executes Phing Launcher and runs a specified targets
*/
public function execute()
{
$phingExecutable = $this->phpci->findBinary('phing.sh');
$cmd[] = 'sh ' . $phingExecutable . ' -f ' . $this->getBuildFilePath();
if ($this->getPropertyFile()) {
$cmd[] = '-propertyfile ' . $this->getPropertyFile();
}
$cmd[] = $this->propertiesToString();
$cmd[] = '-logger phing.listener.DefaultLogger';
$cmd[] = $this->targetsToString();
$cmd[] = '2>&1';
return $this->phpci->executeCommand(implode(' ', $cmd), $this->directory, $this->targets);
}
}