From 939c9db0953ce4df68083a8d1cb233dd539f0e36 Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Sat, 13 Jan 2024 16:42:06 +0100 Subject: [PATCH] Composer internally calls the paths url so let's follow --- src/Composer/PathRepositoryDefinition.php | 10 +++++----- src/Composer/RepositoryDefinitionFactory.php | 2 +- src/Runner/InstallRunner.php | 5 +++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Composer/PathRepositoryDefinition.php b/src/Composer/PathRepositoryDefinition.php index a7e2accc..f573946f 100644 --- a/src/Composer/PathRepositoryDefinition.php +++ b/src/Composer/PathRepositoryDefinition.php @@ -7,12 +7,12 @@ class PathRepositoryDefinition implements RepositoryDefinition { - public readonly string $path; + public readonly string $url; - public function __construct(string|Stringable $path, public readonly stdClass $repositoryOptions = new stdClass) + public function __construct(string|Stringable $url, public readonly stdClass $repositoryOptions = new stdClass) { // Cast to string once rather than everywhere. - $this->path = (string) $path; + $this->url = (string) $url; } public function getType(): string @@ -22,7 +22,7 @@ public function getType(): string public function getUrl(): string { - return $this->path; + return $this->url; } public function dumpStdClass() @@ -30,7 +30,7 @@ public function dumpStdClass() return (object) [ 'type' => 'path', 'options' => $this->repositoryOptions, - 'url' => $this->path + 'url' => $this->url ]; } } \ No newline at end of file diff --git a/src/Composer/RepositoryDefinitionFactory.php b/src/Composer/RepositoryDefinitionFactory.php index 91284bb7..88dbe425 100644 --- a/src/Composer/RepositoryDefinitionFactory.php +++ b/src/Composer/RepositoryDefinitionFactory.php @@ -10,7 +10,7 @@ class RepositoryDefinitionFactory public static function create(stdClass $input): RepositoryDefinition { if ($input->type == 'path') { - return new PathRepositoryDefinition($input->path, $input->options ?? new stdClass); + return new PathRepositoryDefinition($input->url, $input->options ?? new stdClass); } } } \ No newline at end of file diff --git a/src/Runner/InstallRunner.php b/src/Runner/InstallRunner.php index 2d049aa4..5f8edc26 100644 --- a/src/Runner/InstallRunner.php +++ b/src/Runner/InstallRunner.php @@ -7,6 +7,7 @@ use Horde\Components\Config; use Horde\Components\RuntimeContext\GitCheckoutDirectory; use Horde\Components\Output; +use Horde\Components\Wrapper\HordeYml; use stdClass; class InstallRunner @@ -58,8 +59,12 @@ public function run(Config $config) // Inject all horde apps as local sources. $composerJson = $this->installationDirectory->getComposerJson(); foreach ($this->gitCheckoutDirectory->getHordeYmlDirs() as $hordeYmlDir) { + // Load HordeYml to get the ComponentVersion + $hordeYml = new HordeYml($hordeYmlDir); + $composerJson->getRepositoryList()->ensurePresent(new PathRepositoryDefinition($hordeYmlDir)); } $composerJson->writeFile($this->installationDirectory->getComposerJsonPath()); + // } } \ No newline at end of file