/**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     // Debug
     $this->debug = $this->isDebug($package);
     // Composer stuff
     $this->initializeVendorDir();
     $downloadPath = $this->getInstallPath($package);
     if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
         $this->removeBinaries($package);
     }
     if (!$repo->hasPackage($package)) {
         $repo->addPackage(clone $package);
     }
     $this->downloadAndExtractFile($package);
 }
コード例 #2
0
 public function updateCode(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
 {
     if (!$repo->hasPackage($initial)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $initial);
     }
     if ($initial->getInstallationSource() == 'source' && $initial->getSourceType() == 'git' && $target->getSourceType() == 'git') {
         $this->downloadManager->update($initial, $target, $this->getInstallPath($target));
     } else {
         $this->installCode($target);
     }
     $repo->removePackage($initial);
     if (!$repo->hasPackage($target)) {
         $repo->addPackage(clone $target);
     }
 }
コード例 #3
0
 public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if ($package instanceof AliasPackage) {
         return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
     }
     return $this->getInstaller($package->getType())->isInstalled($repo, $package);
 }
コード例 #4
0
ファイル: NoopInstaller.php プロジェクト: itillawarra/cmfive
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $repo->removePackage($package);
 }
コード例 #5
0
 /**
  * {@inheritDoc}
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         return;
     }
     $this->removeBinaries($package);
     $repo->removePackage($package);
 }
コード例 #6
0
ファイル: Installer.php プロジェクト: ddrozdik/dmaps
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $repo->removePackage($package);
     $installPath = $this->getInstallPath($package);
     $this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
 }
コード例 #7
0
 /**
  * {@inheritDoc}
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         // TODO throw exception again here, when update is fixed and we don't have to remove+install (see #125)
         return;
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $repo->removePackage($package);
 }
コード例 #8
0
ファイル: LibraryInstaller.php プロジェクト: VicDeo/poc
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $this->removeCode($package);
     $this->removeBinaries($package);
     $repo->removePackage($package);
     $downloadPath = $this->getPackageBasePath($package);
     if (strpos($package->getName(), '/')) {
         $packageVendorDir = dirname($downloadPath);
         if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
             @rmdir($packageVendorDir);
         }
     }
 }
コード例 #9
0
ファイル: LibraryInstaller.php プロジェクト: nickelc/composer
 /**
  * {@inheritDoc}
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         // TODO throw exception again here, when update is fixed and we don't have to remove+install (see #125)
         return;
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $downloadPath = $this->getInstallPath($package);
     $this->removeCode($package);
     $this->removeBinaries($package);
     $repo->removePackage($package);
     if (strpos($package->getName(), '/')) {
         $packageVendorDir = dirname($downloadPath);
         if (is_dir($packageVendorDir) && !glob($packageVendorDir . '/*')) {
             @rmdir($packageVendorDir);
         }
     }
 }
コード例 #10
0
 public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     return $repo->hasPackage($package);
 }
コード例 #11
0
 /**
  * Updates a package
  *
  * @param \Composer\Repository\InstalledRepositoryInterface $repo
  * @param \Composer\Package\PackageInterface $initial
  * @param \Composer\Package\PackageInterface $target
  * @throws \InvalidArgumentException
  */
 public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
 {
     if (!$repo->hasPackage($initial)) {
         throw new CoreInstaller\PackageNotInstalledException($initial);
     }
     $this->getDriver()->update($initial, $target);
     $repo->removePackage($initial);
     if (!$repo->hasPackage($target)) {
         $repo->addPackage(clone $target);
     }
 }
 /**
  * Remove symlinks for Contao sources before uninstalling a package.
  *
  * {@inheritdoc}
  *
  * @throws \InvalidArgumentException When the requested package is not installed.
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $this->logVerbose(sprintf('Removing Contao sources for %s', $package->getName()));
     $this->removeSymlinks($package, $this->getContaoRoot(), $this->getSources($package));
     parent::uninstall($repo, $package);
     $this->logVerbose('');
 }
コード例 #13
0
 /**
  * Uninstalls specific package.
  *
  * @param \Composer\Repository\InstalledRepositoryInterface $repo repository in which to check
  * @param \Composer\Package\PackageInterface $package package instance
  */
 public function uninstall(\Composer\Repository\InstalledRepositoryInterface $repo, \Composer\Package\PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     if ($this->filesystem->someFilesExist($this->symlinks)) {
         $this->filesystem->removeSymlinks($this->symlinks);
     }
     $this->removeCode($package);
     $repo->removePackage($package);
 }
コード例 #14
0
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     if ($package->getType() === MagentoInstaller::MAGENTO_SOURCE) {
         $repo->removePackage($package);
         $this->_makeBackup($repo, $package);
     } else {
         $repo->removePackage($package);
         $installPath = $this->getInstallPath($package);
         $this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
     }
 }
 /**
  * @param InstalledRepositoryInterface $repo
  * @param PackageInterface             $package
  *
  * @return bool
  */
 public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     // Just check if the sources folder and the link exist
     return $repo->hasPackage($package) && is_readable($this->getInstallPath($package)) && is_link($this->getPackageVendorSymlink($package));
 }
 /**
  * @param InstalledRepositoryInterface $repo
  * @param PackageInterface             $package
  *
  * @throws FilesystemException
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if ($package->isDev()) {
         if (!$repo->hasPackage($package)) {
             throw new \InvalidArgumentException('Package is not installed : ' . $package->getPrettyName());
         }
         $this->symlinkInstaller->uninstall($repo, $package);
     } else {
         $this->defaultInstaller->uninstall($repo, $package);
     }
 }
コード例 #17
0
 /**
  * {@inheritDoc}
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $this->repository = $repo;
     $this->beforePatches($package, $package->getVersion(), '0');
     if ($repo->hasPackage($package)) {
         $modules = 0;
         foreach ($this->getModulesPaths($package) as $path) {
             $this->uninstallModule($path, $package);
             $modules++;
         }
         if ($modules) {
             $this->io->write('');
         }
     }
     $this->afterPatches($package, $package->getVersion(), '0');
     parent::uninstall($repo, $package);
 }