2017-06-13 23:44:09 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2017-10-22 19:22:11 +00:00
|
|
|
# let composer use our GITHUB_OAUTH_TOKEN
|
|
|
|
if [ -n "$GITHUB_OAUTH_TOKEN" ]; then
|
|
|
|
composer config --global github-oauth.github.com "$GITHUB_OAUTH_TOKEN"
|
|
|
|
fi
|
|
|
|
|
2017-06-13 23:44:09 +00:00
|
|
|
# set COMPOSER_ROOT_VERSION when necessary
|
2017-06-20 15:32:09 +00:00
|
|
|
if [ -z "$COMPOSER_ROOT_VERSION" ] && [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
2017-06-13 23:44:09 +00:00
|
|
|
PICO_VERSION_PATTERN="$(php -r "
|
|
|
|
\$json = json_decode(file_get_contents('$TRAVIS_BUILD_DIR/composer.json'), true);
|
|
|
|
if (\$json !== null) {
|
|
|
|
if (isset(\$json['extra']['branch-alias']['dev-$TRAVIS_BRANCH'])) {
|
|
|
|
echo 'dev-$TRAVIS_BRANCH';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
")"
|
|
|
|
|
|
|
|
if [ -z "$PICO_VERSION_PATTERN" ]; then
|
|
|
|
PICO_VERSION_PATTERN="$(php -r "
|
|
|
|
require_once('$TRAVIS_BUILD_DIR/lib/Pico.php');
|
|
|
|
echo preg_replace('/\.[0-9]+-dev$/', '.x-dev', Pico::VERSION);
|
|
|
|
")"
|
|
|
|
fi
|
|
|
|
|
2017-06-20 15:32:09 +00:00
|
|
|
if [ -n "$PICO_VERSION_PATTERN" ]; then
|
2017-06-13 23:44:09 +00:00
|
|
|
export COMPOSER_ROOT_VERSION="$PICO_VERSION_PATTERN"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install dependencies
|
|
|
|
echo "Running \`composer install\`$([ -n "$COMPOSER_ROOT_VERSION" ] && echo -n " ($COMPOSER_ROOT_VERSION)")..."
|
2017-10-22 19:22:11 +00:00
|
|
|
composer install --no-suggest
|
2017-06-21 00:23:13 +00:00
|
|
|
|
|
|
|
exit $?
|