Bugfixes
parent
b7f6cf69ab
commit
1a7bf8a7f8
|
@ -24,7 +24,7 @@ use Composer\Repository\RepositoryInterface;
|
|||
*/
|
||||
class AutoloadGenerator
|
||||
{
|
||||
public function dump(RepositoryInterface $localRepo, PackageInterface $package, InstallationManager $installationManager, $targetDir)
|
||||
public function dump(RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir)
|
||||
{
|
||||
$autoloadFile = file_get_contents(__DIR__.'/ClassLoader.php');
|
||||
|
||||
|
@ -60,27 +60,28 @@ EOF;
|
|||
|
||||
// build package => install path map
|
||||
$packageMap = array();
|
||||
foreach ($localRepo->getPackages() as $package) {
|
||||
foreach ($localRepo->getPackages() as $installedPackage) {
|
||||
$packageMap[] = array(
|
||||
$package,
|
||||
$installationManager->getInstallPath($package)
|
||||
$installedPackage,
|
||||
$installationManager->getInstallPath($installedPackage)
|
||||
);
|
||||
}
|
||||
|
||||
// add main package
|
||||
$packageMap[] = array($package, '');
|
||||
$packageMap[] = array($mainPackage, '');
|
||||
|
||||
$autoloads = $this->parseAutoloads($packageMap);
|
||||
|
||||
if (isset($autoloads['psr-0'])) {
|
||||
foreach ($autoloads['psr-0'] as $def) {
|
||||
$exportedPrefix = var_export($def['namespace'], true);
|
||||
$exportedPath = var_export($def['path'], true);
|
||||
if (!$this->isAbsolutePath($def['path'])) {
|
||||
$baseDir = 'dirname(dirname(__DIR__)).';
|
||||
$def['path'] = '/'.$def['path'];
|
||||
} else {
|
||||
$baseDir = '';
|
||||
}
|
||||
$exportedPrefix = var_export($def['namespace'], true);
|
||||
$exportedPath = var_export($def['path'], true);
|
||||
$namespacesFile .= " $exportedPrefix => {$baseDir}{$exportedPath},\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,9 @@ class InstallerInstaller extends LibraryInstaller
|
|||
$this->installationManager = $im;
|
||||
|
||||
foreach ($repository->getPackages() as $package) {
|
||||
$this->registerInstaller($package);
|
||||
if ('composer-installer' === $package->getType()) {
|
||||
$this->registerInstaller($package);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue