From c1cae8d838502291ca0ed91d919a7b0adb2a7dbd Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Mon, 3 Jun 2013 16:37:45 +0200 Subject: [PATCH] updated events to use composer from Factory PSR-0 autoloading is now handled correctly --- src/Composer/Command/CreateProjectCommand.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 7849c317d..bcea44c7b 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -143,14 +143,15 @@ EOT $installedFromVcs = false; } + $composer = Factory::create($io); + if ($noScripts === false) { // dispatch event - $this->getComposer()->getEventDispatcher()->dispatchCommandEvent(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages); + $composer->getEventDispatcher()->dispatchCommandEvent(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages); } + // install dependencies of the created project - $composer = Factory::create($io); $installer = Installer::create($io, $composer); - $installer->setPreferSource($preferSource) ->setPreferDist($preferDist) ->setDevMode($installDevPackages) @@ -207,10 +208,8 @@ EOT } if ($noScripts === false) { - // TODO: improve autoloader refreshing - require($this->getComposer()->getConfig()->get('vendor-dir').'/autoload.php'); // dispatch event - $this->getComposer()->getEventDispatcher()->dispatchCommandEvent(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages); + $composer->getEventDispatcher()->dispatchCommandEvent(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages); } return 0;