Add fix for ./do install failing when packages from 'autoload.files' are missing
[MAILPOET-2580]
This commit is contained in:
11
do
11
do
@ -4,8 +4,17 @@ DIR=$(dirname $0)
|
|||||||
ROBO_BIN=$DIR/vendor/bin/robo
|
ROBO_BIN=$DIR/vendor/bin/robo
|
||||||
COMPOSER_BIN=$DIR/tools/vendor/composer.phar
|
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)
|
# 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_DEV_MODE=1 php tools/install.php
|
||||||
$COMPOSER_BIN install
|
$COMPOSER_BIN install
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user