Display Locking instead of Installing for lock file install operations

main
Nils Adermann 5 years ago
parent 25de5218c3
commit 3cbe91983c

@ -56,11 +56,19 @@ class InstallOperation extends SolverOperation
return 'install';
}
/**
* {@inheritDoc}
*/
public function show($lock)
{
return ($lock ? 'Locking ' : 'Installing ').$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
}
/**
* {@inheritDoc}
*/
public function __toString()
{
return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
return $this->show(false);
}
}

@ -60,8 +60,16 @@ class MarkAliasInstalledOperation extends SolverOperation
/**
* {@inheritDoc}
*/
public function __toString()
public function show($lock)
{
return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
}
/**
* {@inheritDoc}
*/
public function __toString()
{
return $this->show(false);
}
}

@ -60,8 +60,16 @@ class MarkAliasUninstalledOperation extends SolverOperation
/**
* {@inheritDoc}
*/
public function __toString()
public function show($lock)
{
return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
}
/**
* {@inheritDoc}
*/
public function __toString()
{
return $this->show(false);
}
}

@ -33,6 +33,14 @@ interface OperationInterface
*/
public function getReason();
/**
* Serializes the operation in a human readable format
*
* @param $lock bool Whether this is an operation on the lock file
* @return string
*/
public function show($lock);
/**
* Serializes the operation in a human readable format
*

@ -43,6 +43,12 @@ abstract class SolverOperation implements OperationInterface
return $this->reason;
}
/**
* @param $lock bool Whether this is an operation on the lock file
* @return string
*/
abstract public function show($lock);
protected function formatVersion(PackageInterface $package)
{
return $package->getFullPrettyVersion();

@ -59,8 +59,16 @@ class UninstallOperation extends SolverOperation
/**
* {@inheritDoc}
*/
public function __toString()
public function show($lock)
{
return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
}
/**
* {@inheritDoc}
*/
public function __toString()
{
return $this->show(false);
}
}

@ -72,9 +72,17 @@ class UpdateOperation extends SolverOperation
/**
* {@inheritDoc}
*/
public function __toString()
public function show($lock)
{
return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
$this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
}
/**
* {@inheritDoc}
*/
public function __toString()
{
return $this->show(false);
}
}

@ -24,7 +24,7 @@ use Composer\Semver\Constraint\Constraint;
/**
* @author Nils Adermann <naderman@naderman.de>
*/
abstract class Transaction
class Transaction
{
/**
* @var array
@ -53,7 +53,6 @@ abstract class Transaction
$this->presentPackages = $presentPackages;
$this->setResultPackageMaps($resultPackages);
$this->operations = $this->calculateOperations();
}
public function getOperations()

@ -484,7 +484,7 @@ class Installer
// output op, but alias op only in debug verbosity
if (false === strpos($operation->getJobType(), 'Alias') || $this->io->isDebug()) {
$this->io->writeError(' - ' . $operation);
$this->io->writeError(' - ' . $operation->show(true));
}
}
@ -673,7 +673,7 @@ class Installer
// output op, but alias op only in debug verbosity
if ((!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) || $this->io->isDebug()) {
$this->io->writeError(' - ' . $operation);
$this->io->writeError(' - ' . $operation->show(false));
}
$this->installationManager->execute($localRepo, $operation);

@ -27,8 +27,8 @@ update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
- Installing a/a (1.0.0)
- Installing c/c (1.0.0)
- Locking a/a (1.0.0)
- Locking c/c (1.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals

@ -22,8 +22,8 @@ update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
- Installing a/a (1.0.0)
- Installing b/b (1.0.0)
- Locking a/a (1.0.0)
- Locking b/b (1.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals

@ -21,7 +21,7 @@ install --no-dev
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Installing a/a (1.0.0)
- Locking a/a (1.0.0)
Writing lock file
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals

@ -22,8 +22,8 @@ update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
- Installing c/c (1.0.0)
- Installing a/a (1.0.0)
- Locking c/c (1.0.0)
- Locking a/a (1.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals

@ -21,7 +21,7 @@ install
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Installing a/a (1.0.0)
- Locking a/a (1.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals

Loading…
Cancel
Save