1
0
Fork 0

use optimize-autoloader config param in update and install commands

pull/2605/head
Robert Boloc 2014-01-17 15:04:10 +01:00
parent 8a221854b1
commit 5e5311a224
3 changed files with 20 additions and 5 deletions

View File

@ -76,7 +76,10 @@ EOT
$preferSource = false; $preferSource = false;
$preferDist = false; $preferDist = false;
switch ($composer->getConfig()->get('preferred-install')) {
$config = $composer->getConfig();
switch ($config->get('preferred-install')) {
case 'source': case 'source':
$preferSource = true; $preferSource = true;
break; break;
@ -93,6 +96,8 @@ EOT
$preferDist = $input->getOption('prefer-dist'); $preferDist = $input->getOption('prefer-dist');
} }
$optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
$install $install
->setDryRun($input->getOption('dry-run')) ->setDryRun($input->getOption('dry-run'))
->setVerbose($input->getOption('verbose')) ->setVerbose($input->getOption('verbose'))
@ -100,7 +105,7 @@ EOT
->setPreferDist($preferDist) ->setPreferDist($preferDist)
->setDevMode(!$input->getOption('no-dev')) ->setDevMode(!$input->getOption('no-dev'))
->setRunScripts(!$input->getOption('no-scripts')) ->setRunScripts(!$input->getOption('no-scripts'))
->setOptimizeAutoloader($input->getOption('optimize-autoloader')) ->setOptimizeAutoloader($optimize)
; ;
if ($input->getOption('no-plugins')) { if ($input->getOption('no-plugins')) {

View File

@ -81,7 +81,10 @@ EOT
$preferSource = false; $preferSource = false;
$preferDist = false; $preferDist = false;
switch ($composer->getConfig()->get('preferred-install')) {
$config = $composer->getConfig();
switch ($config->get('preferred-install')) {
case 'source': case 'source':
$preferSource = true; $preferSource = true;
break; break;
@ -98,6 +101,8 @@ EOT
$preferDist = $input->getOption('prefer-dist'); $preferDist = $input->getOption('prefer-dist');
} }
$optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
$install $install
->setDryRun($input->getOption('dry-run')) ->setDryRun($input->getOption('dry-run'))
->setVerbose($input->getOption('verbose')) ->setVerbose($input->getOption('verbose'))
@ -105,7 +110,7 @@ EOT
->setPreferDist($preferDist) ->setPreferDist($preferDist)
->setDevMode(!$input->getOption('no-dev')) ->setDevMode(!$input->getOption('no-dev'))
->setRunScripts(!$input->getOption('no-scripts')) ->setRunScripts(!$input->getOption('no-scripts'))
->setOptimizeAutoloader($input->getOption('optimize-autoloader')) ->setOptimizeAutoloader($optimize)
->setUpdate(true) ->setUpdate(true)
->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $input->getArgument('packages')) ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $input->getArgument('packages'))
->setWhitelistDependencies($input->getOption('with-dependencies')) ->setWhitelistDependencies($input->getOption('with-dependencies'))

View File

@ -279,7 +279,12 @@ class Installer
} }
// write autoloader // write autoloader
$this->io->write('<info>Generating autoload files</info>'); if ($this->optimizeAutoloader) {
$this->io->write('<info>Generating optimized autoload files</info>');
} else {
$this->io->write('<info>Generating autoload files</info>');
}
$this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader); $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
if ($this->runScripts) { if ($this->runScripts) {