From ace88fa986e650fc6c9d2fb7545bd661198d97a1 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 26 Mar 2016 08:44:54 +0000 Subject: [PATCH] Rename LibraryBinariesHandler and reorganize constructor args, refs #5100 --- ...BinariesHandler.php => BinaryInstaller.php} | 10 ++++------ src/Composer/Installer/LibraryInstaller.php | 18 +++++++++--------- 2 files changed, 13 insertions(+), 15 deletions(-) rename src/Composer/Installer/{LibraryBinariesHandler.php => BinaryInstaller.php} (96%) diff --git a/src/Composer/Installer/LibraryBinariesHandler.php b/src/Composer/Installer/BinaryInstaller.php similarity index 96% rename from src/Composer/Installer/LibraryBinariesHandler.php rename to src/Composer/Installer/BinaryInstaller.php index 294210cbf..fea3905c3 100644 --- a/src/Composer/Installer/LibraryBinariesHandler.php +++ b/src/Composer/Installer/BinaryInstaller.php @@ -20,13 +20,13 @@ use Composer\Util\ProcessExecutor; use Composer\Util\Silencer; /** - * Package installation manager. + * Utility to handle installation of package "bin"/binaries * * @author Jordi Boggiano * @author Konstantin Kudryashov * @author Helmut Hummel */ -class LibraryBinariesHandler +class BinaryInstaller { protected $binDir; protected $binCompat; @@ -34,14 +34,12 @@ class LibraryBinariesHandler protected $filesystem; /** - * LibraryBinaryHandler constructor. - * + * @param IOInterface $io * @param string $binDir * @param string $binCompat - * @param IOInterface $io * @param Filesystem $filesystem */ - public function __construct($binDir, $binCompat, IOInterface $io, Filesystem $filesystem = null) + public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null) { $this->binDir = $binDir; $this->binCompat = $binCompat; diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index a89af316c..241d55eea 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -35,7 +35,7 @@ class LibraryInstaller implements InstallerInterface protected $type; protected $filesystem; protected $binCompat; - protected $libraryBinariesHandler; + protected $binaryInstaller; /** * Initializes library installer. @@ -44,9 +44,9 @@ class LibraryInstaller implements InstallerInterface * @param Composer $composer * @param string $type * @param Filesystem $filesystem - * @param LibraryBinariesHandler $libraryBinariesHandler + * @param BinaryInstaller $binaryInstaller */ - public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, LibraryBinariesHandler $libraryBinariesHandler = null) + public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null) { $this->composer = $composer; $this->downloadManager = $composer->getDownloadManager(); @@ -55,7 +55,7 @@ class LibraryInstaller implements InstallerInterface $this->filesystem = $filesystem ?: new Filesystem(); $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/'); - $this->libraryBinariesHandler = $libraryBinariesHandler ?: new LibraryBinariesHandler(rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->io, $this->filesystem); + $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem); } /** @@ -84,11 +84,11 @@ class LibraryInstaller implements InstallerInterface // remove the binaries if it appears the package files are missing if (!is_readable($downloadPath) && $repo->hasPackage($package)) { - $this->libraryBinariesHandler->removeBinaries($package); + $this->binaryInstaller->removeBinaries($package); } $this->installCode($package); - $this->libraryBinariesHandler->installBinaries($package, $this->getInstallPath($package)); + $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package)); if (!$repo->hasPackage($package)) { $repo->addPackage(clone $package); } @@ -105,9 +105,9 @@ class LibraryInstaller implements InstallerInterface $this->initializeVendorDir(); - $this->libraryBinariesHandler->removeBinaries($initial); + $this->binaryInstaller->removeBinaries($initial); $this->updateCode($initial, $target); - $this->libraryBinariesHandler->installBinaries($target, $this->getInstallPath($target)); + $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target)); $repo->removePackage($initial); if (!$repo->hasPackage($target)) { $repo->addPackage(clone $target); @@ -124,7 +124,7 @@ class LibraryInstaller implements InstallerInterface } $this->removeCode($package); - $this->libraryBinariesHandler->removeBinaries($package); + $this->binaryInstaller->removeBinaries($package); $repo->removePackage($package); $downloadPath = $this->getPackageBasePath($package);