mirror of
https://github.com/composer/composer
synced 2025-05-11 09:32:55 +00:00
This commit is contained in:
parent
203f972ed7
commit
63da7c6b2d
7 changed files with 31 additions and 11 deletions
|
@ -15,6 +15,8 @@ namespace Composer\Repository;
|
|||
use Composer\Json\JsonFile;
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\Dumper\ArrayDumper;
|
||||
use Composer\Installer\InstallationManager;
|
||||
use Composer\Util\Filesystem;
|
||||
|
||||
/**
|
||||
* Filesystem repository.
|
||||
|
@ -84,13 +86,18 @@ class FilesystemRepository extends WritableArrayRepository
|
|||
/**
|
||||
* Writes writable repository.
|
||||
*/
|
||||
public function write($devMode)
|
||||
public function write($devMode, InstallationManager $installationManager)
|
||||
{
|
||||
$data = array('packages' => array(), 'dev' => $devMode);
|
||||
$dumper = new ArrayDumper();
|
||||
$fs = new Filesystem();
|
||||
$repoDir = dirname($fs->normalizePath($this->file->getPath()));
|
||||
|
||||
foreach ($this->getCanonicalPackages() as $package) {
|
||||
$data['packages'][] = $dumper->dump($package);
|
||||
$pkgArray = $dumper->dump($package);
|
||||
$path = $installationManager->getInstallPath($package);
|
||||
$pkgArray['install-path'] = ('' !== $path && null !== $path) ? $fs->findShortestPath($repoDir, $path, true) : null;
|
||||
$data['packages'][] = $pkgArray;
|
||||
}
|
||||
|
||||
usort($data['packages'], function ($a, $b) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue