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