Introduce InstallerBinaryInterface
This is an interface for Installer which should support installing binary. ATM there is only the `LibraryInstaller`. It eases the check for supported method when installing binaries for all packagespull/5127/head
parent
e9fc0e6548
commit
4f7fbbc879
|
@ -137,9 +137,14 @@ class InstallationManager
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$installer = $this->getInstaller($package->getType());
|
$installer = $this->getInstaller($package->getType());
|
||||||
$installer->installBinary($package);
|
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
// the given installer doesn't support installing binaries
|
// no installer found for the current package type (@see `getInstaller()`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the given installer support installing binaries
|
||||||
|
if ($installer instanceof InstallerBinaryInterface) {
|
||||||
|
$installer->installBinary($package);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer\Installer;
|
||||||
|
|
||||||
|
use Composer\Package\PackageInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for the package installation manager that handle binary installation.
|
||||||
|
*
|
||||||
|
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||||
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*/
|
||||||
|
interface InstallerBinaryInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Installs binary file for a specific package.
|
||||||
|
*
|
||||||
|
* @param PackageInterface $package package instance
|
||||||
|
*/
|
||||||
|
public function installBinary(PackageInterface $package);
|
||||||
|
}
|
|
@ -25,7 +25,7 @@ use Composer\Util\Silencer;
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||||
*/
|
*/
|
||||||
class LibraryInstaller implements InstallerInterface
|
class LibraryInstaller implements InstallerInterface, InstallerBinaryInterface
|
||||||
{
|
{
|
||||||
protected $composer;
|
protected $composer;
|
||||||
protected $vendorDir;
|
protected $vendorDir;
|
||||||
|
|
Loading…
Reference in New Issue