Only add ruby in $PATH, do not overwrite /usr/bin/ruby

* Fixes https://github.com/actions/setup-ruby/issues/18
* The symlink never worked on macOS, and there was a missing `await`.
* No tool should hardcode `/usr/bin/ruby`, but instead executables
  should use `#!/usr/bin/env ruby`.
* If a specific tool needs the symlink, then it can of course be
  added as part of the steps of that CI.
This commit is contained in:
Benoit Daloze
2019-09-21 22:42:25 +02:00
parent 50f3cc9f0b
commit 573594eefe
2 changed files with 0 additions and 20 deletions

View File

@@ -1,10 +1,7 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as tc from '@actions/tool-cache';
import * as path from 'path';
const IS_WINDOWS = process.platform === 'win32';
export async function findRubyVersion(version: string) {
const installDir: string | null = tc.find('Ruby', version);
@@ -14,13 +11,5 @@ export async function findRubyVersion(version: string) {
const toolPath: string = path.join(installDir, 'bin');
if (!IS_WINDOWS) {
// Ruby / Gem heavily use the '#!/usr/bin/ruby' to find ruby, so this task needs to
// replace that version of ruby so all the correct version of ruby gets selected
// replace the default
const dest: string = '/usr/bin/ruby';
exec.exec('sudo ln', ['-sf', path.join(toolPath, 'ruby'), dest]); // replace any existing
}
core.addPath(toolPath);
}