1
0
Fork 0

Load root packages as aliases if they are aliased so that they replace everything

pull/636/merge
Jordi Boggiano 2012-04-29 21:16:24 +02:00
parent f3df4772f9
commit a4c2337433
1 changed files with 11 additions and 7 deletions

View File

@ -15,6 +15,7 @@ namespace Composer\Package\Loader;
use Composer\Package\Version\VersionParser;
use Composer\Repository\RepositoryManager;
use Composer\Util\ProcessExecutor;
use Composer\Package\AliasPackage;
/**
* ArrayLoader built for the sole purpose of loading the root package
@ -48,13 +49,6 @@ class RootPackageLoader extends ArrayLoader
foreach ($this->process->splitLines($output) as $branch) {
if ($branch && preg_match('{^(?:\* ) *(?:[^/ ]+?/)?(\S+) *[a-f0-9]+ .*$}', $branch, $match)) {
$version = 'dev-'.$match[1];
if (isset($config['extra']['branch-alias'][$version])
&& substr($config['extra']['branch-alias'][$version], -4) === '-dev'
) {
$targetBranch = $config['extra']['branch-alias'][$version];
$normalized = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
$version = preg_replace('{(\.9{7})+}', '.x', $normalized);
}
}
}
}
@ -97,6 +91,16 @@ class RootPackageLoader extends ArrayLoader
$package->setRepositories($config['repositories']);
}
if (isset($config['extra']['branch-alias'][$version])
&& substr($config['extra']['branch-alias'][$version], -4) === '-dev'
) {
$targetBranch = $config['extra']['branch-alias'][$version];
$normalized = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
$version = preg_replace('{(\.9{7})+}', '.x', $normalized);
return new AliasPackage($package, $normalized, $version);
}
return $package;
}
}