From 9e84839a2f7e6759569e609d72c7dbc501c4f202 Mon Sep 17 00:00:00 2001 From: Lander Vanderstraeten Date: Fri, 22 Feb 2019 13:50:57 +0100 Subject: [PATCH] Test --- src/Console/Application.php | 1 + src/Util/ComposerFile.php | 12 ++++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Console/Application.php b/src/Console/Application.php index 291a5f520..e0ed415db 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -183,6 +183,7 @@ protected function initializeComposerHelper(): Helper\ComposerHelper } $composerFileLocation = getcwd().DIRECTORY_SEPARATOR.'composer.json'; + ComposerFile::ensureProjectBinDirInSystemPath($composerFileLocation); $composerFile = ComposerFile::createFrom($composerFileLocation); return $this->composerHelper = new Helper\ComposerHelper($composerFile); diff --git a/src/Util/ComposerFile.php b/src/Util/ComposerFile.php index 22b2febe6..23bf2b734 100644 --- a/src/Util/ComposerFile.php +++ b/src/Util/ComposerFile.php @@ -32,7 +32,7 @@ public static function createFrom(string $composerFileLocation): self * * @see https://github.com/composer/composer/blob/1.1/src/Composer/EventDispatcher/EventDispatcher.php#L147-L160 */ - private static function ensureProjectBinDirInSystemPath(string $binDir): bool + public static function ensureProjectBinDirInSystemPath(string $binDir) { $pathStr = 'PATH'; if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) { @@ -40,7 +40,7 @@ private static function ensureProjectBinDirInSystemPath(string $binDir): bool } if (!is_dir($binDir)) { - return false; + return; } // add the bin dir to the PATH to make local binaries of deps usable in scripts @@ -54,19 +54,15 @@ private static function ensureProjectBinDirInSystemPath(string $binDir): bool $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr); putenv($pathStr.'='.$_SERVER[$pathStr]); } - - return true; } public function getBinDir(): string { $binDir = $this->configuration['bin-dir'] ?? 'vendor/bin'; - if (self::ensureProjectBinDirInSystemPath($binDir)) { - return $binDir; - } + self::ensureProjectBinDirInSystemPath($binDir); - throw new RuntimeException('Could not get bin dir location'); + return $binDir; } /**