소스 검색

Merge pull request #1962 from schmunk42/master

event cleanup
Jordi Boggiano 12 년 전
부모
커밋
7b72ce1b51
1개의 변경된 파일5개의 추가작업 그리고 6개의 파일을 삭제
  1. 5 6
      src/Composer/Command/CreateProjectCommand.php

+ 5 - 6
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;