1
0
Fork 0

Merge remote-tracking branch 'KingCrunch/issue/1225'

pull/1020/merge
Jordi Boggiano 2012-10-24 17:31:09 +02:00
commit f15d86111d
3 changed files with 19 additions and 1 deletions

View File

@ -37,6 +37,7 @@ class InstallCommand extends Command
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'Disables all custom installers.'), new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'Disables all custom installers.'),
new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'), new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
new InputOption('verbose', 'v', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'), new InputOption('verbose', 'v', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
new InputOption('optimize-autoloaders', 'o', InputOption::VALUE_NONE, 'Optimize autoloaders during autoloader dump')
)) ))
->setHelp(<<<EOT ->setHelp(<<<EOT
The <info>install</info> command reads the composer.lock file from The <info>install</info> command reads the composer.lock file from
@ -64,6 +65,7 @@ EOT
->setPreferDist($input->getOption('prefer-dist')) ->setPreferDist($input->getOption('prefer-dist'))
->setDevMode($input->getOption('dev')) ->setDevMode($input->getOption('dev'))
->setRunScripts(!$input->getOption('no-scripts')) ->setRunScripts(!$input->getOption('no-scripts'))
->setOptimizeAutoloaders($input->getOption('optimize-autoloaders'))
; ;
if ($input->getOption('no-custom-installers')) { if ($input->getOption('no-custom-installers')) {

View File

@ -37,6 +37,7 @@ class UpdateCommand extends Command
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'Disables all custom installers.'), new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'Disables all custom installers.'),
new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'), new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
new InputOption('verbose', 'v', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'), new InputOption('verbose', 'v', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
new InputOption('optimize-autoloaders', 'o', InputOption::VALUE_NONE, 'Optimize autoloaders during autoloader dump')
)) ))
->setHelp(<<<EOT ->setHelp(<<<EOT
The <info>update</info> command reads the composer.json file from the The <info>update</info> command reads the composer.json file from the
@ -67,6 +68,7 @@ EOT
->setPreferDist($input->getOption('prefer-dist')) ->setPreferDist($input->getOption('prefer-dist'))
->setDevMode($input->getOption('dev')) ->setDevMode($input->getOption('dev'))
->setRunScripts(!$input->getOption('no-scripts')) ->setRunScripts(!$input->getOption('no-scripts'))
->setOptimizeAutoloaders($input->getOption('optimize-autoloaders'))
->setUpdate(true) ->setUpdate(true)
->setUpdateWhitelist($input->getArgument('packages')) ->setUpdateWhitelist($input->getArgument('packages'))
; ;

View File

@ -92,6 +92,7 @@ class Installer
protected $preferSource = false; protected $preferSource = false;
protected $preferDist = false; protected $preferDist = false;
protected $optimizeAutoloaders = false;
protected $devMode = false; protected $devMode = false;
protected $dryRun = false; protected $dryRun = false;
protected $verbose = false; protected $verbose = false;
@ -221,7 +222,7 @@ class Installer
// write autoloader // write autoloader
$this->io->write('<info>Generating autoload files</info>'); $this->io->write('<info>Generating autoload files</info>');
$localRepos = new CompositeRepository($this->repositoryManager->getLocalRepositories()); $localRepos = new CompositeRepository($this->repositoryManager->getLocalRepositories());
$this->autoloadGenerator->dump($this->config, $localRepos, $this->package, $this->installationManager, 'composer'); $this->autoloadGenerator->dump($this->config, $localRepos, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloaders);
if ($this->runScripts) { if ($this->runScripts) {
// dispatch post event // dispatch post event
@ -745,6 +746,19 @@ class Installer
return $this; return $this;
} }
/**
* Wether or not generated autoloaders are optimized
*
* @param bool $optimizeAutoloaders
* @return Installer
*/
public function setOptimizeAutoloaders($optimizeAutoloaders = false)
{
$this->optimizeAutoloaders = (boolean) $optimizeAutoloaders;
return $this;
}
/** /**
* update packages * update packages
* *