Remplace all echo with writeln method of IO
parent
7888ec5313
commit
0f9dcc9618
|
@ -123,7 +123,7 @@ EOT
|
||||||
// prepare solver
|
// prepare solver
|
||||||
$installationManager = $composer->getInstallationManager();
|
$installationManager = $composer->getInstallationManager();
|
||||||
$policy = new DependencyResolver\DefaultPolicy();
|
$policy = new DependencyResolver\DefaultPolicy();
|
||||||
$solver = new DependencyResolver\Solver($policy, $pool, $installedRepo);
|
$solver = new DependencyResolver\Solver($policy, $pool, $installedRepo, $this->getApplication()->getIO());
|
||||||
|
|
||||||
// solve dependencies
|
// solve dependencies
|
||||||
$operations = $solver->solve($request);
|
$operations = $solver->solve($request);
|
||||||
|
|
|
@ -84,6 +84,14 @@ class Application extends BaseApplication
|
||||||
return $this->composer;
|
return $this->composer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return IOInterface
|
||||||
|
*/
|
||||||
|
public function getIO()
|
||||||
|
{
|
||||||
|
return $this->io;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstraps a Composer instance
|
* Bootstraps a Composer instance
|
||||||
*
|
*
|
||||||
|
@ -144,8 +152,8 @@ class Application extends BaseApplication
|
||||||
|
|
||||||
// initialize installation manager
|
// initialize installation manager
|
||||||
$im = new Installer\InstallationManager($vendorDir);
|
$im = new Installer\InstallationManager($vendorDir);
|
||||||
$im->addInstaller(new Installer\LibraryInstaller($vendorDir, $binDir, $dm, $rm->getLocalRepository(), null));
|
$im->addInstaller(new Installer\LibraryInstaller($vendorDir, $binDir, $dm, $rm->getLocalRepository(), $io, null));
|
||||||
$im->addInstaller(new Installer\InstallerInstaller($vendorDir, $binDir, $dm, $rm->getLocalRepository(), $im));
|
$im->addInstaller(new Installer\InstallerInstaller($vendorDir, $binDir, $dm, $rm->getLocalRepository(), $io, $im));
|
||||||
|
|
||||||
// load package
|
// load package
|
||||||
$loader = new Package\Loader\RootPackageLoader($rm);
|
$loader = new Package\Loader\RootPackageLoader($rm);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
namespace Composer\DependencyResolver;
|
namespace Composer\DependencyResolver;
|
||||||
|
|
||||||
|
use Composer\IO\IOInterface;
|
||||||
use Composer\Repository\RepositoryInterface;
|
use Composer\Repository\RepositoryInterface;
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
use Composer\DependencyResolver\Operation;
|
use Composer\DependencyResolver\Operation;
|
||||||
|
@ -55,12 +56,15 @@ class Solver
|
||||||
protected $packageToUpdateRule = array();
|
protected $packageToUpdateRule = array();
|
||||||
protected $packageToFeatureRule = array();
|
protected $packageToFeatureRule = array();
|
||||||
|
|
||||||
public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed)
|
protected $io;
|
||||||
|
|
||||||
|
public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
|
||||||
{
|
{
|
||||||
$this->policy = $policy;
|
$this->policy = $policy;
|
||||||
$this->pool = $pool;
|
$this->pool = $pool;
|
||||||
$this->installed = $installed;
|
$this->installed = $installed;
|
||||||
$this->rules = new RuleSet;
|
$this->rules = new RuleSet;
|
||||||
|
$this->io = $io;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2046,26 +2050,26 @@ class Solver
|
||||||
|
|
||||||
public function printDecisionMap()
|
public function printDecisionMap()
|
||||||
{
|
{
|
||||||
echo "\nDecisionMap: \n";
|
$this->io->writeln("\nDecisionMap: ");
|
||||||
foreach ($this->decisionMap as $packageId => $level) {
|
foreach ($this->decisionMap as $packageId => $level) {
|
||||||
if ($packageId === 0) {
|
if ($packageId === 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($level > 0) {
|
if ($level > 0) {
|
||||||
echo ' +' . $this->pool->packageById($packageId) . "\n";
|
$this->io->writeln(' +' . $this->pool->packageById($packageId));
|
||||||
} else {
|
} else {
|
||||||
echo ' -' . $this->pool->packageById($packageId) . "\n";
|
$this->io->writeln(' -' . $this->pool->packageById($packageId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "\n";
|
$this->io->writeln('');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function printDecisionQueue()
|
public function printDecisionQueue()
|
||||||
{
|
{
|
||||||
echo "DecisionQueue: \n";
|
$this->io->writeln("DecisionQueue: ");
|
||||||
foreach ($this->decisionQueue as $i => $literal) {
|
foreach ($this->decisionQueue as $i => $literal) {
|
||||||
echo ' ' . $literal . ' ' . $this->decisionQueueWhy[$i] . "\n";
|
$this->io->writeln(' ' . $literal . ' ' . $this->decisionQueueWhy[$i]);
|
||||||
}
|
}
|
||||||
echo "\n";
|
$this->io->writeln('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
namespace Composer\Installer;
|
namespace Composer\Installer;
|
||||||
|
|
||||||
|
use Composer\IO\IOInterface;
|
||||||
use Composer\Autoload\AutoloadGenerator;
|
use Composer\Autoload\AutoloadGenerator;
|
||||||
use Composer\Downloader\DownloadManager;
|
use Composer\Downloader\DownloadManager;
|
||||||
use Composer\Repository\WritableRepositoryInterface;
|
use Composer\Repository\WritableRepositoryInterface;
|
||||||
|
@ -33,10 +34,11 @@ class InstallerInstaller extends LibraryInstaller
|
||||||
* @param string $binDir relative path for binaries
|
* @param string $binDir relative path for binaries
|
||||||
* @param DownloadManager $dm download manager
|
* @param DownloadManager $dm download manager
|
||||||
* @param WritableRepositoryInterface $repository repository controller
|
* @param WritableRepositoryInterface $repository repository controller
|
||||||
|
* @param IOInterface $io io instance
|
||||||
*/
|
*/
|
||||||
public function __construct($vendorDir, $binDir, DownloadManager $dm, WritableRepositoryInterface $repository, InstallationManager $im)
|
public function __construct($vendorDir, $binDir, DownloadManager $dm, WritableRepositoryInterface $repository, IOInterface $io, InstallationManager $im)
|
||||||
{
|
{
|
||||||
parent::__construct($vendorDir, $binDir, $dm, $repository, 'composer-installer');
|
parent::__construct($vendorDir, $binDir, $dm, $repository, $io, 'composer-installer');
|
||||||
$this->installationManager = $im;
|
$this->installationManager = $im;
|
||||||
|
|
||||||
foreach ($repository->getPackages() as $package) {
|
foreach ($repository->getPackages() as $package) {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
namespace Composer\Installer;
|
namespace Composer\Installer;
|
||||||
|
|
||||||
|
use Composer\IO\IOInterface;
|
||||||
use Composer\Downloader\DownloadManager;
|
use Composer\Downloader\DownloadManager;
|
||||||
use Composer\Repository\WritableRepositoryInterface;
|
use Composer\Repository\WritableRepositoryInterface;
|
||||||
use Composer\DependencyResolver\Operation\OperationInterface;
|
use Composer\DependencyResolver\Operation\OperationInterface;
|
||||||
|
@ -30,6 +31,7 @@ class LibraryInstaller implements InstallerInterface
|
||||||
protected $binDir;
|
protected $binDir;
|
||||||
protected $downloadManager;
|
protected $downloadManager;
|
||||||
protected $repository;
|
protected $repository;
|
||||||
|
protected $io;
|
||||||
private $type;
|
private $type;
|
||||||
private $filesystem;
|
private $filesystem;
|
||||||
|
|
||||||
|
@ -40,12 +42,14 @@ class LibraryInstaller implements InstallerInterface
|
||||||
* @param string $binDir relative path for binaries
|
* @param string $binDir relative path for binaries
|
||||||
* @param DownloadManager $dm download manager
|
* @param DownloadManager $dm download manager
|
||||||
* @param WritableRepositoryInterface $repository repository controller
|
* @param WritableRepositoryInterface $repository repository controller
|
||||||
|
* @param IOInterface $io io instance
|
||||||
* @param string $type package type that this installer handles
|
* @param string $type package type that this installer handles
|
||||||
*/
|
*/
|
||||||
public function __construct($vendorDir, $binDir, DownloadManager $dm, WritableRepositoryInterface $repository, $type = 'library')
|
public function __construct($vendorDir, $binDir, DownloadManager $dm, WritableRepositoryInterface $repository, IOInterface $io, $type = 'library')
|
||||||
{
|
{
|
||||||
$this->downloadManager = $dm;
|
$this->downloadManager = $dm;
|
||||||
$this->repository = $repository;
|
$this->repository = $repository;
|
||||||
|
$this->io = $io;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
|
|
||||||
$this->filesystem = new Filesystem();
|
$this->filesystem = new Filesystem();
|
||||||
|
@ -136,7 +140,7 @@ class LibraryInstaller implements InstallerInterface
|
||||||
foreach ($package->getBinaries() as $bin) {
|
foreach ($package->getBinaries() as $bin) {
|
||||||
$link = $this->binDir.'/'.basename($bin);
|
$link = $this->binDir.'/'.basename($bin);
|
||||||
if (file_exists($link)) {
|
if (file_exists($link)) {
|
||||||
echo 'Skipped installation of '.$bin.' for package '.$package->getName().', name conflicts with an existing file'.PHP_EOL;
|
$this->io->writeln('Skipped installation of '.$bin.' for package '.$package->getName().', name conflicts with an existing file');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$bin = $this->getInstallPath($package).'/'.$bin;
|
$bin = $this->getInstallPath($package).'/'.$bin;
|
||||||
|
|
Loading…
Reference in New Issue