From 30e4c7a571cebbf377a1d71a947c6de1f98e518a Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Thu, 18 Feb 2021 16:54:21 +0100
Subject: [PATCH] Add support for self-hosted packages where the project name
 is not the same as the path name

---
 src/Handler.php | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/Handler.php b/src/Handler.php
index 88314de..8f8513e 100644
--- a/src/Handler.php
+++ b/src/Handler.php
@@ -67,9 +67,13 @@ class Handler extends BaseHandler {
       }
       $this->io->write('Dorgflow: Preparing ' . $url . ' packages for development', TRUE);
       foreach ($projects as $project => $specification) {
+        [, $projectname] = explode('/', $project);
         if (!$simpleMode) {
           $fullUrl = $url . ':' . $specification['path'];
           $version = $specification['version'];
+          if (isset($specification['name'])) {
+            $projectname = $specification['name'];
+          }
         }
         else {
           $fullUrl = $url;
@@ -81,7 +85,7 @@ class Handler extends BaseHandler {
         }
         $path = $installationManager->getInstallPath($package);
         $this->io->write("- $project => $path", TRUE);
-        $this->prepareWorkingDirectory($path, $project, $version, $fullUrl);
+        $this->prepareWorkingDirectory($path, $projectname, $version, $fullUrl);
       }
     }
   }
@@ -91,15 +95,14 @@ class Handler extends BaseHandler {
    *
    * @param string $path
    *   Name of the working directory.
-   * @param string $project
+   * @param string $projectname
    *   Name of the project.
    * @param string $version
    *   Version to checkout.
    * @param string $url
    *   Base URL to checkout from.
    */
-  protected function prepareWorkingDirectory(string $path, string $project, string $version, string $url): void {
-    [, $projectname] = explode('/', $project);
+  protected function prepareWorkingDirectory(string $path, string $projectname, string $version, string $url): void {
     $uri = 'git@' . $url . '/' . $projectname . '.git';
 
     // Git Clone the repository into the working directory.
-- 
GitLab