forked from github/licensed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomposer
executable file
·38 lines (30 loc) · 929 Bytes
/
composer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -e
if [ -z "$(which php)" ]; then
echo "A local php installation is required for php development." >&2
exit 127
fi
# setup test fixtures
BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd $BASE_PATH/test/fixtures/composer
if [ "$1" == "-f" ]; then
git clean -ffX .
fi
if [ ! -f "composer.phar" ]; then
EXPECTED_SIGNATURE="$(curl -s https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
php composer-setup.php
RESULT=$?
rm composer-setup.php
if [ $RESULT -ne 0 ]; then
>&2 echo 'ERROR: composer.phar installation failed'
exit $RESULT
fi
fi
php composer.phar install