Merge pull request #29 from eregon/no-symlink-usr-bin

Only add ruby in $PATH, do not overwrite /usr/bin/ruby
This commit is contained in:
Eileen M. Uchitelle
2020-01-09 14:05:44 -05:00
committed by GitHub
2 changed files with 0 additions and 20 deletions

View File

@@ -16,10 +16,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const exec = __importStar(require("@actions/exec"));
const tc = __importStar(require("@actions/tool-cache"));
const path = __importStar(require("path"));
const IS_WINDOWS = process.platform === 'win32';
function findRubyVersion(version) {
return __awaiter(this, void 0, void 0, function* () {
const installDir = tc.find('Ruby', version);
@@ -27,13 +25,6 @@ function findRubyVersion(version) {
throw new Error(`Version ${version} not found`);
}
const toolPath = 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 = '/usr/bin/ruby';
exec.exec('sudo ln', ['-sf', path.join(toolPath, 'ruby'), dest]); // replace any existing
}
core.addPath(toolPath);
});
}

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);
}