Getting rid of code duplication, migrating to COMPOSER_RUN env.variable
This commit is contained in:
parent
23174277ac
commit
58b958f088
|
@ -192,35 +192,16 @@ function composer_try_update_lock_entry($package, $rev, $new_tag)
|
||||||
function composer_run(array $args)
|
function composer_run(array $args)
|
||||||
{
|
{
|
||||||
global $GAME_ROOT;
|
global $GAME_ROOT;
|
||||||
|
putenv('COMPOSER_RUN='.implode(' ', $args));
|
||||||
$composer_dir = $GAME_ROOT . '/composer/';
|
include("$GAME_ROOT/composer/update.php");
|
||||||
|
|
||||||
$files = glob($composer_dir . '/composer-*.phar');
|
|
||||||
$PHAR = basename($files[0]);
|
|
||||||
|
|
||||||
$cmd = "cd $composer_dir && ";
|
|
||||||
if(PHP_OS_FAMILY === 'Darwin')
|
|
||||||
{
|
|
||||||
$cmd .= "DYLD_LIBRARY_PATH='" . getenv("DYLD_LIBRARY_PATH") . "' " .
|
|
||||||
"PHP_INI_SCAN_DIR='" . getenv("PHP_INI_SCAN_DIR") . "' ";
|
|
||||||
$cmd .= PHP_BINARY . " -c '". getenv("PHP_INI") . "' ";
|
|
||||||
$ext_dir = realpath(ini_get('extension_dir'));
|
|
||||||
$cmd .= " -d extension_dir='$ext_dir' ";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$cmd .= PHP_BINARY . ' ';
|
|
||||||
|
|
||||||
$cmd .= "$PHAR " . implode(' ', $args);
|
|
||||||
|
|
||||||
shell($cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//NOTE: keeping this function for BC
|
//NOTE: keeping this function for BC
|
||||||
function composer_update($update = false)
|
function composer_update($update = false)
|
||||||
{
|
{
|
||||||
if($update)
|
if($update)
|
||||||
composer_run(['update --no-dev']);
|
composer_run(['update']);
|
||||||
else
|
else
|
||||||
composer_run(['install --no-dev']);
|
composer_run(['install']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue