From a4960bbed61a4ae6bf283f85236b101d7771f543 Mon Sep 17 00:00:00 2001 From: Adam Daniels Date: Thu, 28 Nov 2024 11:05:30 -0500 Subject: [PATCH] Chruby test suite looks for ruby binary in multiple locations Support both `/opt/rubies` and `~/.rubies` for installation paths, checking both the `engine-version` and `version` formats. Part of #2877 --- vscode/src/test/suite/ruby/chruby.test.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/vscode/src/test/suite/ruby/chruby.test.ts b/vscode/src/test/suite/ruby/chruby.test.ts index c6fb5b12a..cd728b492 100644 --- a/vscode/src/test/suite/ruby/chruby.test.ts +++ b/vscode/src/test/suite/ruby/chruby.test.ts @@ -29,7 +29,19 @@ function createRubySymlinks(destination: string) { destination, ); } else { - fs.symlinkSync(`/opt/rubies/${RUBY_VERSION}/bin/ruby`, destination); + const possibleLocations = [ + `${os.homedir()}/.rubies/${RUBY_VERSION}/bin/ruby`, + `${os.homedir()}/.rubies/ruby-${RUBY_VERSION}/bin/ruby`, + `/opt/rubies/${RUBY_VERSION}/bin/ruby`, + `/opt/rubies/ruby-${RUBY_VERSION}/bin/ruby`, + ]; + + for (const location of possibleLocations) { + if (fs.existsSync(location)) { + fs.symlinkSync(location, destination); + break; + } + } } }