I'm trying to get make my Ant script retrieve Composer for me. Composer is a dependancy manager for PHP. According to the doc one needs to run this command: "curl -s https://getcomposer.org/installer | php" which will download Composer.phar into the directory I'm in. This works as intended when running from a terminal.
How do I setup the Ant build file for this? So far I've got this segment for the "composerget" target, but it's doesn't save the file, only output it in my command shell:
....
<target name="composerget" description="Composer update dependencies">
<exec executable="curl">
<arg line="-s" />
<arg line="https://getcomposer.org/installer"/>
<arg line="| php" />
</exec>
</target>
....
Any help is greatly appeciated.
It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things. Now run php composer.phar in order to run Composer. Now run php bin/composer in order to run Composer.
The downloaded composer. phar file will be saved under the project root folder. Then, choose one of the configured local PHP interpreters from the PHP interpreter list.
<target name="composerget" description="Composer update dependencies">
<exec executable="/bin/bash">
<arg value="-c" />
<arg value="curl -s https://getcomposer.org/installer | php" />
</exec>
</target>
Should do the trick.
The pipe (|) can only be used in a shell script. You're passing it as an argument to curl. So you need to execute a shell script - which you can do with bash -c and passing the command as a shell statement.
Attribution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With