這將下載Composer安裝程序,驗證其簽名,並運行安裝程序:
<target name="composer" description="Install composer">
<exec executable="wget">
<arg value="-O" />
<arg value="composer-setup.sig" />
<arg value="https://composer.github.io/installer.sig" />
</exec>
<exec executable="wget">
<arg value="-O" />
<arg value="composer-setup.php" />
<arg value="https://getcomposer.org/installer" />
</exec>
<exec executable="bash">
<arg value="-c" />
<arg value="awk '{print $$0 " composer-setup.php"}' composer-setup.sig | sha384sum --check" />
</exec>
<exec executable="php">
<arg value="composer-setup.php" />
</exec>
<exec executable="rm">
<arg value="composer-setup.php" />
</exec>
<exec executable="rm">
<arg value="composer-setup.sig" />
</exec>
<exec executable="mv">
<arg value="composer.phar" />
<arg value="composer" />
</exec>
</target>
如果您正在使用GNU製作,這是等價的:
all: vendor
vendor: composer composer.json composer.lock
./composer install
composer:
wget -O composer-setup.sig https://composer.github.io/installer.sig
wget -O composer-setup.php https://getcomposer.org/installer
awk '{print $$0 " composer-setup.php"}' composer-setup.sig | sha384sum --check
php composer-setup.php --quiet
rm composer-setup.*
mv composer.phar composer
可能重複[Ant運行命令與管道](http://stackoverflow.com/questions/1187402/ant-run-command-with-pipes) – Mez