Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
kabalin committed Aug 22, 2024
1 parent 729d6bd commit b25ade0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Installer/VendorInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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}");
}

/**
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b25ade0

Please sign in to comment.