Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

Commit

Permalink
allow multiple targets
Browse files Browse the repository at this point in the history
  • Loading branch information
basz committed Jan 30, 2015
1 parent 3c4b270 commit ddb38fb
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/Service/Phing.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public function setPhingOptions(PhingOptions $phingOptions)

/**
*
* @param type $target
* @param string $target
* @param null|array|Traversable $options
* @return type
* @return array
*/
public function build($target = null, $options = null)
public function build($target = "", $options = null)
{
$phingOptions = clone $this->phingOptions;

Expand All @@ -70,7 +70,12 @@ public function build($target = null, $options = null)
return $this->doBuild($target, $phingOptions);
}

protected function doBuild($target, PhingOptions $options)
/**
* @param string $targets space separated list of targets
* @param PhingOptions $options
* @return array
*/
protected function doBuild($targets, PhingOptions $options)
{
if (!self::hasExec()) {
throw new \RuntimeException("Not able to use PHP's exec method");
Expand All @@ -85,7 +90,11 @@ protected function doBuild($target, PhingOptions $options)
$builder->setEnv($key, $value);
}

$builder->add($target);
foreach(explode(' ', $targets) as $target) {
if (strlen(trim($target))) {
$builder->add(trim($target));
}
}

$process = $builder->getProcess();

Expand Down

0 comments on commit ddb38fb

Please sign in to comment.