From 4de09d3d21f98bc6e740157ce93f24ec6a3fe56a Mon Sep 17 00:00:00 2001 From: jawira Date: Wed, 23 Oct 2019 22:22:05 +0200 Subject: [PATCH 1/9] ComposerTask: update code & doc #1163 --- classes/phing/tasks/ext/ComposerTask.php | 7 +- .../en/source/appendixes/optionaltasks.xml | 69 +++++++++++-------- etc/phing-grammar.rng | 34 +++++---- 3 files changed, 66 insertions(+), 44 deletions(-) diff --git a/classes/phing/tasks/ext/ComposerTask.php b/classes/phing/tasks/ext/ComposerTask.php index 7483b07622..2c86b1a86c 100644 --- a/classes/phing/tasks/ext/ComposerTask.php +++ b/classes/phing/tasks/ext/ComposerTask.php @@ -19,6 +19,7 @@ /** * Composer Task + * * Run composer straight from phing * * @author nuno costa @@ -166,8 +167,12 @@ public function createArg() private function prepareCommandLine() { $this->commandLine->setExecutable($this->getPhp()); + $command = $this->getCommand(); + if (empty($command)) { + throw new BuildException('"command" attribute is required'); + } //We are un-shifting arguments to the beginning of the command line because arguments should be at the end - $this->commandLine->createArgument(true)->setValue($this->getCommand()); + $this->commandLine->createArgument(true)->setValue($command); $this->commandLine->createArgument(true)->setValue($this->getComposer()); $commandLine = (string) $this->commandLine; //Creating new Commandline instance. It allows to handle subsequent calls correctly diff --git a/docs/guide/en/source/appendixes/optionaltasks.xml b/docs/guide/en/source/appendixes/optionaltasks.xml index 9fad68a5a4..ce062b46e4 100644 --- a/docs/guide/en/source/appendixes/optionaltasks.xml +++ b/docs/guide/en/source/appendixes/optionaltasks.xml @@ -274,11 +274,12 @@ ComposerTask - - The ComposerTask runs the Composer tool (http://getcomposer.org) - directly from Phing. - - + + The ComposerTask runs the Composer tool + (http://getcomposer.org) + directly from Phing. + +
Attributes @@ -296,28 +297,31 @@ - - php - String - Path to the PHP interpreter - Defaults to the ${php.interpreter} property which is - the interpreter used to execute phing itself. - No - - - composer - String - Path to Composer. - composer.phar - No - - - command - String - The Composer command to execute. - n/a - No - + + command + String + The Composer command to execute. + n/a + Yes + + + composer + String + Path to Composer. + composer.phar, if not found it tries to use composer executable + from your system. + + No + + + php + String + Path to the PHP interpreter + Defaults to the ${php.interpreter} property which is the interpreter used + to execute phing itself. + + No +
@@ -383,6 +387,13 @@ + + Example + <composer command="install"> + <arg value="--no-dev"/> + <arg value="--no-interaction"/> +</composer> +
CoverageMergerTask @@ -4123,7 +4134,7 @@ Note that you can omit both startpoint and track attributes in this case html or text text No - + domain String @@ -4627,7 +4638,7 @@ Note that you can omit both startpoint and track attributes in this case IniFileTask The IniFileTask is inspired by the Ant-Contrib IniFile + xlink:href="http://ant-contrib.sourceforge.net/tasks/tasks/inifile.html" role="extern">Ant-Contrib IniFile and can be used to build and edit .ini files. Unlike the Ant equivalent, it can also read values from different sections of an .ini file and set the retrieved values to specified properties. diff --git a/etc/phing-grammar.rng b/etc/phing-grammar.rng index cb4db4c234..0772487088 100644 --- a/etc/phing-grammar.rng +++ b/etc/phing-grammar.rng @@ -2591,20 +2591,26 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +