From e21ce860dfe358dc20d3096afae748e6dc705884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=B6nthal?= Date: Mon, 25 Jun 2012 14:20:50 +0200 Subject: [PATCH] fixed issue #627 (autoload dump command) --- src/Composer/Command/DumpAutoloadCommand.php | 49 ++++++++++++++++++++ src/Composer/Console/Application.php | 1 + 2 files changed, 50 insertions(+) create mode 100755 src/Composer/Command/DumpAutoloadCommand.php mode change 100644 => 100755 src/Composer/Console/Application.php diff --git a/src/Composer/Command/DumpAutoloadCommand.php b/src/Composer/Command/DumpAutoloadCommand.php new file mode 100755 index 000000000..f1695ac2d --- /dev/null +++ b/src/Composer/Command/DumpAutoloadCommand.php @@ -0,0 +1,49 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Command; + +use Symfony\Component\Console\Input\InputInterface; +use Composer\Repository\CompositeRepository; +use Symfony\Component\Console\Output\OutputInterface; +use Composer\Autoload\AutoloadGenerator; + +/** + * @author Jordi Boggiano + */ +class DumpAutoloadCommand extends Command +{ + protected function configure() + { + $this + ->setName('dump-autoload') + ->setDescription('dumps the autoloader') + ->setHelp(<<php composer.phar dump-autoload +EOT + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $output->writeln('Generating autoload files'); + + $composer = $this->getComposer(); + $installationManager = $composer->getInstallationManager(); + $localRepos = new CompositeRepository($composer->getRepositoryManager()->getLocalRepositories()); + $package = $composer->getPackage(); + + $generator = new AutoloadGenerator(); + $generator->dump($localRepos, $package, $installationManager, $installationManager->getVendorPath().'/composer'); + } +} diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php old mode 100644 new mode 100755 index 9aada8587..b58a7ab58 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -130,6 +130,7 @@ class Application extends BaseApplication $commands[] = new Command\ValidateCommand(); $commands[] = new Command\ShowCommand(); $commands[] = new Command\RequireCommand(); + $commands[] = new Command\DumpAutoloadCommand(); if ('phar:' === substr(__FILE__, 0, 5)) { $commands[] = new Command\SelfUpdateCommand();