Przeglądaj źródła

refactored install

digitalkaoz 13 lat temu
rodzic
commit
3d43bdce45

+ 2 - 1
src/Composer/Command/InstallCommand.php

@@ -24,6 +24,7 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 use Composer\DependencyResolver\Operation\InstallOperation;
+use Composer\DependencyResolver\Solver;
 
 /**
  * @author Jordi Boggiano <j.boggiano@seld.be>
@@ -135,7 +136,7 @@ EOT
             if ('install' === $job['cmd']) {
                 foreach ($installedRepo->getPackages() as $package ) {
                     if ($installedRepo->hasPackage($package) && !$package->isPlatform() && !$installationManager->isPackageInstalled($package)) {
-                        $operations[$job['packageName']] = new InstallOperation($package, \Composer\DependencyResolver\Solver::RULE_PACKAGE_NOT_EXIST);
+                        $operations[$job['packageName']] = new InstallOperation($package, Solver::RULE_PACKAGE_NOT_EXIST);
                     }
                     if (in_array($job['packageName'], $package->getNames())) {
                         continue 2;

+ 0 - 1
src/Composer/Installer/InstallationManager.php

@@ -17,7 +17,6 @@ use Composer\DependencyResolver\Operation\OperationInterface;
 use Composer\DependencyResolver\Operation\InstallOperation;
 use Composer\DependencyResolver\Operation\UpdateOperation;
 use Composer\DependencyResolver\Operation\UninstallOperation;
-use Composer\DependencyResolver\Operation\ReplaceOperation;
 
 /**
  * Package operation manager.

+ 2 - 4
src/Composer/Installer/LibraryInstaller.php

@@ -80,10 +80,8 @@ class LibraryInstaller implements InstallerInterface
      */
     public function install(PackageInterface $package)
     {
-        $broken = !is_readable($this->getInstallPath($package));
-
         //remove the binaries first if its missing on filesystem
-        if ($broken) {
+        if (!is_readable($this->getInstallPath($package)) && $this->repository->hasPackage($package)) {
             $this->removeBinaries($package);
         }
 
@@ -91,7 +89,7 @@ class LibraryInstaller implements InstallerInterface
         $this->downloadManager->download($package, $downloadPath);
         $this->installBinaries($package);
 
-        if($broken) {
+        if(!$this->repository->hasPackage($package)) {
             $this->repository->addPackage(clone $package);
         }
     }