Browse Source

multiple alias support.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
6ab6730c32
  1. 6
      extensions/composer/Installer.php

6
extensions/composer/Installer.php

@ -90,6 +90,7 @@ class Installer extends LibraryInstaller
} }
$fs = new Filesystem; $fs = new Filesystem;
$vendorDir = $fs->normalizePath($this->vendorDir); $vendorDir = $fs->normalizePath($this->vendorDir);
$aliases = [];
foreach ($autoload['psr-0'] as $name => $path) { foreach ($autoload['psr-0'] as $name => $path) {
$name = str_replace('\\', '/', trim($name, '\\')); $name = str_replace('\\', '/', trim($name, '\\'));
if (!$fs->isAbsolutePath($path)) { if (!$fs->isAbsolutePath($path)) {
@ -97,11 +98,12 @@ class Installer extends LibraryInstaller
} }
$path = $fs->normalizePath($path); $path = $fs->normalizePath($path);
if (strpos($path . '/', $vendorDir . '/') === 0) { if (strpos($path . '/', $vendorDir . '/') === 0) {
return ["@$name" => '<vendor-dir>' . substr($path, strlen($vendorDir)) . '/' . $name]; $aliases["@$name"] = '<vendor-dir>' . substr($path, strlen($vendorDir)) . '/' . $name;
} else { } else {
return ["@$name" => $path . '/' . $name]; $aliases["@$name"] = $path . '/' . $name;
} }
} }
return $aliases;
} }
protected function removePackage(PackageInterface $package) protected function removePackage(PackageInterface $package)

Loading…
Cancel
Save