Always use rootPackage config
parent
9af5eaa574
commit
ab8f67e8cf
|
@ -102,12 +102,7 @@ EOT
|
||||||
|
|
||||||
$preferSource = false;
|
$preferSource = false;
|
||||||
$preferDist = false;
|
$preferDist = false;
|
||||||
$this->updatePreferredOptions($config, $preferSource, $preferDist);
|
$this->updatePreferredOptions($config, $input, $preferSource, $preferDist);
|
||||||
|
|
||||||
if ($input->getOption('prefer-source') || $input->getOption('prefer-dist')) {
|
|
||||||
$preferSource = $input->getOption('prefer-source');
|
|
||||||
$preferDist = $input->getOption('prefer-dist');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($input->getOption('no-custom-installers')) {
|
if ($input->getOption('no-custom-installers')) {
|
||||||
$output->writeln('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
|
$output->writeln('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
|
||||||
|
@ -129,11 +124,12 @@ EOT
|
||||||
$input->getOption('no-scripts'),
|
$input->getOption('no-scripts'),
|
||||||
$input->getOption('keep-vcs'),
|
$input->getOption('keep-vcs'),
|
||||||
$input->getOption('no-progress'),
|
$input->getOption('no-progress'),
|
||||||
$input->getOption('no-install')
|
$input->getOption('no-install'),
|
||||||
|
$input
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function installProject(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositoryUrl = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $noInstall = false)
|
public function installProject(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositoryUrl = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $noInstall = false, InputInterface $input)
|
||||||
{
|
{
|
||||||
$oldCwd = getcwd();
|
$oldCwd = getcwd();
|
||||||
|
|
||||||
|
@ -154,9 +150,7 @@ EOT
|
||||||
// Update preferSource / preferDist with preferred-install from the root package if both vars still
|
// Update preferSource / preferDist with preferred-install from the root package if both vars still
|
||||||
// have their default initial value (false)
|
// have their default initial value (false)
|
||||||
$rootPackageConfig = $composer->getConfig();
|
$rootPackageConfig = $composer->getConfig();
|
||||||
if ($rootPackageConfig->has('preferred-install') && $preferDist === false && $preferSource === false) {
|
$this->updatePreferredOptions($rootPackageConfig, $input, $preferSource, $preferDist);
|
||||||
$this->updatePreferredOptions($rootPackageConfig, $preferSource, $preferDist);
|
|
||||||
}
|
|
||||||
|
|
||||||
// install dependencies of the created project
|
// install dependencies of the created project
|
||||||
if ($noInstall === false) {
|
if ($noInstall === false) {
|
||||||
|
@ -345,16 +339,19 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Updated preferSource or preferDist based on the preferredInstall config option
|
* Updated preferSource or preferDist based on the preferredInstall config option
|
||||||
* @param Config $config
|
* @param Config $config
|
||||||
|
* @param InputInterface $input
|
||||||
* @param boolean $preferSource
|
* @param boolean $preferSource
|
||||||
* @param boolean $preferDist
|
* @param boolean $preferDist
|
||||||
*/
|
*/
|
||||||
protected function updatePreferredOptions(Config $config, &$preferSource, &$preferDist)
|
protected function updatePreferredOptions(Config $config, InputInterface $input, &$preferSource, &$preferDist)
|
||||||
{
|
{
|
||||||
switch ($config->get('preferred-install')) {
|
switch ($config->get('preferred-install')) {
|
||||||
case 'source':
|
case 'source':
|
||||||
$preferSource = true;
|
$preferSource = true;
|
||||||
|
$preferDist = false;
|
||||||
break;
|
break;
|
||||||
case 'dist':
|
case 'dist':
|
||||||
|
$preferSource = false;
|
||||||
$preferDist = true;
|
$preferDist = true;
|
||||||
break;
|
break;
|
||||||
case 'auto':
|
case 'auto':
|
||||||
|
@ -363,5 +360,9 @@ EOT
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($input->getOption('prefer-source') || $input->getOption('prefer-dist')) {
|
||||||
|
$preferSource = $input->getOption('prefer-source');
|
||||||
|
$preferDist = $input->getOption('prefer-dist');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue