|
@@ -53,7 +53,7 @@ return array(
|
|
|
EOF;
|
|
|
|
|
|
$packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getPackages());
|
|
|
- $autoloads = $this->parseAutoloads($packageMap);
|
|
|
+ $autoloads = $this->parseAutoloads($packageMap, $filesystem);
|
|
|
|
|
|
foreach ($autoloads['psr-0'] as $namespace => $paths) {
|
|
|
$exportedPaths = array();
|
|
@@ -118,10 +118,9 @@ EOF;
|
|
|
$autoloads['classmap'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['classmap']));
|
|
|
foreach ($autoloads['classmap'] as $dir) {
|
|
|
foreach (ClassMapGenerator::createMap($dir) as $class => $path) {
|
|
|
-
|
|
|
$classmapFile .= ' '.var_export($class, true) . ' => ';
|
|
|
|
|
|
- if (0 === strpos($path, dirname($vendorPath), 0)) {
|
|
|
+ if (0 === strpos($path, getcwd())) {
|
|
|
// this path seems to be located within this application/package
|
|
|
$path = '/' . $filesystem->findShortestPath(getcwd(), $path, true);
|
|
|
$classmapFile .= '$baseDir . ';
|
|
@@ -170,11 +169,16 @@ EOF;
|
|
|
/**
|
|
|
* Compiles an ordered list of namespace => path mappings
|
|
|
*
|
|
|
- * @param array $packageMap array of array(package, installDir-relative-to-composer.json)
|
|
|
- * @return array array('psr-0' => array('Ns\\Foo' => array('installDir')))
|
|
|
+ * @param array $packageMap array of array(package, installDir-relative-to-composer.json)
|
|
|
+ * @param Filesystem $filesystem optional filesystem instance to use
|
|
|
+ * @return array array('psr-0' => array('Ns\\Foo' => array('installDir')))
|
|
|
*/
|
|
|
- public function parseAutoloads(array $packageMap)
|
|
|
+ public function parseAutoloads(array $packageMap, Filesystem $filesystem = null)
|
|
|
{
|
|
|
+ if (!$filesystem) {
|
|
|
+ $filesystem = new Filesystem;
|
|
|
+ }
|
|
|
+
|
|
|
$autoloads = array('classmap' => array(), 'psr-0' => array(), 'files' => array());
|
|
|
foreach ($packageMap as $item) {
|
|
|
list($package, $installPath) = $item;
|
|
@@ -190,7 +194,13 @@ EOF;
|
|
|
}
|
|
|
foreach ($mapping as $namespace => $paths) {
|
|
|
foreach ((array) $paths as $path) {
|
|
|
- $autoloads[$type][$namespace][] = empty($installPath) ? $path : $installPath.'/'.$path;
|
|
|
+ if ($filesystem->isAbsolutePath($path)) {
|
|
|
+ // handle absolute paths in raw form
|
|
|
+ $autoloads[$type][$namespace][] = $path;
|
|
|
+ } else {
|
|
|
+ // prepend install path (including target dir) to the relative paths
|
|
|
+ $autoloads[$type][$namespace][] = empty($installPath) ? $path : $installPath.'/'.$path;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|