|
@@ -14,6 +14,8 @@ namespace Composer\Installer;
|
|
|
|
|
|
use Composer\Repository\InstalledRepositoryInterface;
|
|
|
use Composer\Package\PackageInterface;
|
|
|
+use Composer\Package\Version\VersionParser;
|
|
|
+use Composer\IO\IOInterface;
|
|
|
|
|
|
/**
|
|
|
* Metapackage installation manager.
|
|
@@ -22,6 +24,13 @@ use Composer\Package\PackageInterface;
|
|
|
*/
|
|
|
class MetapackageInstaller implements InstallerInterface
|
|
|
{
|
|
|
+ private $io;
|
|
|
+
|
|
|
+ public function __construct(IOInterface $io)
|
|
|
+ {
|
|
|
+ $this->io = $io;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* {@inheritDoc}
|
|
|
*/
|
|
@@ -43,6 +52,8 @@ class MetapackageInstaller implements InstallerInterface
|
|
|
*/
|
|
|
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
|
|
|
{
|
|
|
+ $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
|
|
|
+
|
|
|
$repo->addPackage(clone $package);
|
|
|
}
|
|
|
|
|
@@ -55,6 +66,12 @@ class MetapackageInstaller implements InstallerInterface
|
|
|
throw new \InvalidArgumentException('Package is not installed: '.$initial);
|
|
|
}
|
|
|
|
|
|
+ $name = $target->getName();
|
|
|
+ $from = $initial->getFullPrettyVersion();
|
|
|
+ $to = $target->getFullPrettyVersion();
|
|
|
+ $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
|
|
|
+ $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
|
|
|
+
|
|
|
$repo->removePackage($initial);
|
|
|
$repo->addPackage(clone $target);
|
|
|
}
|
|
@@ -68,6 +85,8 @@ class MetapackageInstaller implements InstallerInterface
|
|
|
throw new \InvalidArgumentException('Package is not installed: '.$package);
|
|
|
}
|
|
|
|
|
|
+ $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
|
|
|
+
|
|
|
$repo->removePackage($package);
|
|
|
}
|
|
|
|