Add fix for ./do install failing when packages from 'autoload.files' are missing

[MAILPOET-2580]
This commit is contained in:
Jan Jakeš
2020-04-28 17:44:02 +02:00
committed by Veljko V
parent d08f1e5add
commit ab032c5740

11
do
View File

@ -4,8 +4,17 @@ DIR=$(dirname $0)
ROBO_BIN=$DIR/vendor/bin/robo
COMPOSER_BIN=$DIR/tools/vendor/composer.phar
# when some files from 'autoload.files' array in 'composer.json' are missing (i.e. package not installed),
# we need to run 'composer install' before 'RoboFile.php' (it uses 'autoload.php' - chicken & egg problem)
php -r "
foreach (json_decode(file_get_contents('$DIR' . '/composer.json'), true)['autoload']['files'] as \$file) {
if (!file_exists(\$file)) exit(1);
}
"
MISSING_AUTOLOAD_FILES=$?
# executables not found, install dev tools (including Composer) and PHP packages (including Robo)
if [ ! -f $ROBO_BIN ] || [ ! -f $COMPOSER_BIN ]; then
if [ ! -f $ROBO_BIN ] || [ ! -f $COMPOSER_BIN ] || [ "$MISSING_AUTOLOAD_FILES" -ne "0" ]; then
COMPOSER_DEV_MODE=1 php tools/install.php
$COMPOSER_BIN install
fi