1
0
Fork 0

Use pretty name/version in lock file and debug:packages, fixes #98

pull/120/head
Jordi Boggiano 2011-11-20 15:42:12 +01:00
parent 8df2436be8
commit 3b8ee5dd54
4 changed files with 11 additions and 5 deletions

View File

@ -50,12 +50,12 @@ EOT
$installedRepo = new PlatformRepository($localRepo);
foreach ($installedRepo->getPackages() as $package) {
$output->writeln('installed: '.$package->getName().' '.$package->getVersion());
$output->writeln('installed: '.$package->getPrettyName().' '.$package->getPrettyVersion().' ('.$package->getName().' '.$package->getVersion().')');
}
foreach ($composer->getRepositoryManager()->getRepositories() as $repository) {
foreach ($repository->getPackages() as $package) {
$output->writeln('available: '.$package->getName().' '.$package->getVersion());
$output->writeln('available: '.$package->getPrettyName().' '.$package->getPrettyVersion().' ('.$package->getName().' '.$package->getVersion().')');
}
}
}

View File

@ -27,7 +27,6 @@ class ArrayDumper
'names',
'extra',
'installationSource' => 'installation-source',
'version',
'license',
'requires',
'conflicts',
@ -41,6 +40,7 @@ class ArrayDumper
$data = array();
$data['name'] = $package->getPrettyName();
$data['version'] = $package->getPrettyVersion();
if ($package->getTargetDir()) {
$data['target-dir'] = $package->getTargetDir();
}

View File

@ -89,8 +89,8 @@ class Locker
{
$hash = array();
foreach ($packages as $package) {
$name = $package->getName();
$version = $package->getVersion();
$name = $package->getPrettyName();
$version = $package->getPrettyVersion();
if (!$name || !$version) {
throw new \LogicException(sprintf(

View File

@ -13,6 +13,7 @@
namespace Composer\Repository;
use Composer\Package\PackageInterface;
use Composer\Package\Version\VersionParser;
/**
* A repository implementation that simply stores packages in an array
@ -29,6 +30,11 @@ class ArrayRepository implements RepositoryInterface
*/
public function findPackage($name, $version)
{
// normalize version & name
$versionParser = new VersionParser();
$version = $versionParser->normalize($version);
$name = strtolower($name);
foreach ($this->getPackages() as $package) {
if ($name === $package->getName() && $version === $package->getVersion()) {
return $package;