Last active
March 21, 2016 05:22
-
-
Save boombatower/eb88a3fa424386e1fc28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 150e9ee68ad703ef9ed264c1350392aa23d016b0 Mon Sep 17 00:00:00 2001 | |
From: boombatower <[email protected]> | |
Date: Sun, 20 Mar 2016 23:48:20 -0500 | |
Subject: [PATCH] Infer Composer meta information for internal Drupal git | |
repos. | |
--- | |
src/Composer/Repository/Vcs/GitDriver.php | 20 ++++++++++++++++++++ | |
1 file changed, 20 insertions(+) | |
diff --git a/src/Composer/Repository/Vcs/GitDriver.php b/src/Composer/Repository/Vcs/GitDriver.php | |
index e973041..1f60044 100644 | |
--- a/src/Composer/Repository/Vcs/GitDriver.php | |
+++ b/src/Composer/Repository/Vcs/GitDriver.php | |
@@ -147,6 +147,26 @@ public function getComposerInformation($identifier) | |
} | |
if (!isset($this->infoCache[$identifier])) { | |
+ // Parse something like [email protected]:iwheat/modules/myfields_tweaks | |
+ // to come up with necessary information for composer to avoid composer.json. | |
+ $path = ltrim(parse_url($this->url, PHP_URL_PATH), '/'); | |
+ | |
+ list($namespace, $type, $name) = explode('/', $path); | |
+ $type = rtrim($type, 's'); | |
+ $name = basename($name, '.git'); | |
+ | |
+ if ($namespace == 'home') { | |
+ $namespace = $type; // home/username | |
+ $type = 'module'; // current all | |
+ } | |
+ | |
+ $this->infoCache[$identifier] = [ | |
+ 'name' => $namespace . '/' . $name, | |
+ 'type' => 'drupal-' . $type . '-custom', | |
+ ]; | |
+ } | |
+ | |
+ if (!isset($this->infoCache[$identifier])) { | |
$resource = sprintf('%s:composer.json', ProcessExecutor::escape($identifier)); | |
$this->process->execute(sprintf('git show %s', $resource), $composer, $this->repoDir); | |
-- | |
2.1.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment