Merge branch 'master' of https://github.com/composer/composer
commit
b5b0337ed0
|
@ -54,7 +54,7 @@ EOF;
|
|||
|
||||
$filesystem = new Filesystem();
|
||||
$vendorPath = strtr(realpath($installationManager->getVendorPath()), '\\', '/');
|
||||
$relVendorPath = ltrim(substr($vendorPath, strlen(getcwd())), '/');
|
||||
$relVendorPath = $filesystem->findShortestPath(getcwd(), $vendorPath);
|
||||
$vendorDirCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
|
||||
|
||||
$namespacesFile = <<<EOF
|
||||
|
@ -93,7 +93,12 @@ EOF;
|
|||
$path = strtr($path, '\\', '/');
|
||||
$baseDir = '';
|
||||
if (!$filesystem->isAbsolutePath($path)) {
|
||||
if (strpos($path, $relVendorPath) === 0) {
|
||||
// vendor dir == working dir
|
||||
if (preg_match('{^(\./?)?$}', $relVendorPath)) {
|
||||
$path = '/'.$path;
|
||||
$baseDir = '$vendorDir . ';
|
||||
} elseif (strpos($path, $relVendorPath) === 0) {
|
||||
// path starts with vendor dir
|
||||
$path = substr($path, strlen($relVendorPath));
|
||||
$baseDir = '$vendorDir . ';
|
||||
} else {
|
||||
|
|
|
@ -937,7 +937,7 @@ class Solver
|
|||
$this->installedMap[$package->getId()] = $package;
|
||||
}
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.3.2', '>')) {
|
||||
if (version_compare(PHP_VERSION, '5.3.3', '>')) {
|
||||
$this->decisionMap = new \SplFixedArray($this->pool->getMaxId() + 1);
|
||||
} else {
|
||||
$this->decisionMap = array_fill(0, $this->pool->getMaxId() + 1, 0);
|
||||
|
|
|
@ -53,6 +53,9 @@ class PearRepository extends ArrayRepository
|
|||
foreach ($categories as $category) {
|
||||
$categoryLink = $category->getAttribute("xlink:href");
|
||||
$categoryLink = str_replace("info.xml", "packages.xml", $categoryLink);
|
||||
if ('/' !== substr($categoryLink, 0, 1)) {
|
||||
$categoryLink = '/' . $categoryLink;
|
||||
}
|
||||
$packagesXML = $this->requestXml($this->url . $categoryLink);
|
||||
|
||||
$packages = $packagesXML->getElementsByTagName('p');
|
||||
|
|
|
@ -77,6 +77,24 @@ class AutoloadGeneratorTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertAutoloadFiles('main', $this->vendorDir.'/.composer');
|
||||
}
|
||||
|
||||
public function testVendorDirSameAsWorkingDir()
|
||||
{
|
||||
$this->vendorDir = $this->workingDir;
|
||||
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package->setAutoload(array('psr-0' => array('Main' => 'src/', 'Lala' => 'src/')));
|
||||
|
||||
$this->repo->expects($this->once())
|
||||
->method('getPackages')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
if (!is_dir($this->vendorDir.'/.composer')) {
|
||||
mkdir($this->vendorDir.'/.composer', 0777, true);
|
||||
}
|
||||
$this->generator->dump($this->repo, $package, $this->im, $this->vendorDir.'/.composer');
|
||||
$this->assertAutoloadFiles('main3', $this->vendorDir.'/.composer');
|
||||
}
|
||||
|
||||
public function testMainPackageAutoloadingAlternativeVendorDir()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
// autoload_namespace.php generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
|
||||
return array(
|
||||
'Main' => $vendorDir . '/src/',
|
||||
'Lala' => $vendorDir . '/src/',
|
||||
);
|
Loading…
Reference in New Issue