refactored install
parent
4d0fae688e
commit
3d43bdce45
|
@ -24,6 +24,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Composer\DependencyResolver\Operation\InstallOperation;
|
use Composer\DependencyResolver\Operation\InstallOperation;
|
||||||
|
use Composer\DependencyResolver\Solver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
@ -135,7 +136,7 @@ EOT
|
||||||
if ('install' === $job['cmd']) {
|
if ('install' === $job['cmd']) {
|
||||||
foreach ($installedRepo->getPackages() as $package ) {
|
foreach ($installedRepo->getPackages() as $package ) {
|
||||||
if ($installedRepo->hasPackage($package) && !$package->isPlatform() && !$installationManager->isPackageInstalled($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())) {
|
if (in_array($job['packageName'], $package->getNames())) {
|
||||||
continue 2;
|
continue 2;
|
||||||
|
|
|
@ -17,7 +17,6 @@ use Composer\DependencyResolver\Operation\OperationInterface;
|
||||||
use Composer\DependencyResolver\Operation\InstallOperation;
|
use Composer\DependencyResolver\Operation\InstallOperation;
|
||||||
use Composer\DependencyResolver\Operation\UpdateOperation;
|
use Composer\DependencyResolver\Operation\UpdateOperation;
|
||||||
use Composer\DependencyResolver\Operation\UninstallOperation;
|
use Composer\DependencyResolver\Operation\UninstallOperation;
|
||||||
use Composer\DependencyResolver\Operation\ReplaceOperation;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Package operation manager.
|
* Package operation manager.
|
||||||
|
|
|
@ -80,10 +80,8 @@ class LibraryInstaller implements InstallerInterface
|
||||||
*/
|
*/
|
||||||
public function install(PackageInterface $package)
|
public function install(PackageInterface $package)
|
||||||
{
|
{
|
||||||
$broken = !is_readable($this->getInstallPath($package));
|
|
||||||
|
|
||||||
//remove the binaries first if its missing on filesystem
|
//remove the binaries first if its missing on filesystem
|
||||||
if ($broken) {
|
if (!is_readable($this->getInstallPath($package)) && $this->repository->hasPackage($package)) {
|
||||||
$this->removeBinaries($package);
|
$this->removeBinaries($package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +89,7 @@ class LibraryInstaller implements InstallerInterface
|
||||||
$this->downloadManager->download($package, $downloadPath);
|
$this->downloadManager->download($package, $downloadPath);
|
||||||
$this->installBinaries($package);
|
$this->installBinaries($package);
|
||||||
|
|
||||||
if($broken) {
|
if(!$this->repository->hasPackage($package)) {
|
||||||
$this->repository->addPackage(clone $package);
|
$this->repository->addPackage(clone $package);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue