Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic path for composer task #701

Merged
merged 29 commits into from Feb 14, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions classes/phing/tasks/ext/ComposerTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,24 +156,28 @@ private function prepareCommandLine()
return $commandLine;
}

/**
* executes the Composer task
*/
public function main()
{
$commandLine = $this->prepareCommandLine();
$this->log("executing " . $commandLine);
/**
* Executes the Composer task.
*/
public function main() {
$composerFile = new SplFileInfo($this->getComposer());
if (FALSE === $composerFile->isFile()) {
exec('which composer', $composerLocation, $return);
if ($return === 0) {
$this->setComposer($composerLocation[0]);
}
else {
throw new BuildException(sprintf('Composer binary not found, path is "%s"', $composerFile));
}
}

$composerFile = new SplFileInfo($this->getComposer());
if (false === $composerFile->isFile()) {
throw new BuildException(sprintf('Composer binary not found, path is "%s"', $composerFile));
}
$commandLine = $this->prepareCommandLine();
$this->log("executing " . $commandLine);

$return = 0;
passthru($commandLine, $return);
passthru($commandLine, $return);

if ($return > 0) {
throw new BuildException("Composer execution failed");
}
if ($return > 0) {
throw new BuildException("Composer execution failed");
}
}
}