From b25ade0afc2860538cf8de688a8c362d49483c90 Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Thu, 22 Aug 2024 22:21:12 +0100 Subject: [PATCH] tmp --- src/Installer/VendorInstaller.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Installer/VendorInstaller.php b/src/Installer/VendorInstaller.php index cd12903f..cb7a04cd 100644 --- a/src/Installer/VendorInstaller.php +++ b/src/Installer/VendorInstaller.php @@ -15,6 +15,7 @@ use MoodlePluginCI\Bridge\Moodle; use MoodlePluginCI\Bridge\MoodlePlugin; use MoodlePluginCI\Process\Execute; +use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Process\Process; /** @@ -112,15 +113,16 @@ public function canInstallNvm(): bool */ public function installNvm(): void { - $cmd = 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash'; + $nvmDir = "{$this->moodle->directory}/.nvm"; + (new Filesystem())->mkdir($nvmDir); + $cmd = "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | NVM_DIR={$nvmDir} bash"; $process = $this->execute->passThroughProcess( Process::fromShellCommandline($cmd, $this->moodle->directory, null, null, null) ); if (!$process->isSuccessful()) { throw new \RuntimeException('nvm installation failed.'); } - $home = getenv('HOME'); - putenv("NVM_DIR={$home}/.nvm"); + putenv("NVM_DIR={$nvmDir}"); } /** @@ -154,7 +156,7 @@ public function installNode(): void } $nvmDir = getenv('NVM_DIR'); - $cmd = ". $nvmDir/nvm.sh && nvm install && nvm use && echo \"NVM_BIN=\$NVM_BIN\""; + $cmd = ". $nvmDir/nvm.sh; nvm --version; nvm install; nvm use; echo \"NVM_BIN=\$NVM_BIN\""; $process = $this->execute->passThroughProcess( Process::fromShellCommandline($cmd, $this->moodle->directory, null, null, null)