From 239f20612254bf01f042864405d9d8d52eb5c5a8 Mon Sep 17 00:00:00 2001 From: Andrew Berry Date: Thu, 11 Oct 2018 10:17:10 -0400 Subject: [PATCH] Support inline aliases for downloading files --- src/Handler.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Handler.php b/src/Handler.php index 23cb9d9..b2274b9 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -143,7 +143,6 @@ public function onPostCmdEvent(Event $event) { * Downloads drupal scaffold files for the current process. */ public function downloadScaffold() { - $drupalCorePackage = $this->getDrupalCorePackage(); $webroot = realpath($this->getWebRoot()); // Collect options, excludes and settings files. @@ -154,7 +153,22 @@ public function downloadScaffold() { $dispatcher = new EventDispatcher($this->composer, $this->io); $dispatcher->dispatch(self::PRE_DRUPAL_SCAFFOLD_CMD); - $version = $this->getDrupalCoreVersion($drupalCorePackage); + // First check for inline aliases. This allows a fork of drupal/core to be + // used, so that a require constraint of "8.6.1-patch1 as 8.6.1" will + // download the correct scaffolding files. + $aliases = $this->composer->getPackage()->getAliases(); + $version = NULL; + foreach ($aliases as $alias) { + if ($alias['package'] == 'drupal/core') { + $version = $alias['alias']; + } + } + + // No alias was found, so use the version from the package. + if (!$version) { + $drupalCorePackage = $this->getDrupalCorePackage(); + $version = $this->getDrupalCoreVersion($drupalCorePackage); + } $remoteFs = new RemoteFilesystem($this->io);