mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Cleanup PATH for JRuby on Windows
* That way we remove the default Ruby in PATH which was confusing.
This commit is contained in:
@@ -34,7 +34,7 @@ jobs:
|
||||
ruby-version: ${{ matrix.ruby }}
|
||||
- run: ruby --version
|
||||
- run: ridk version
|
||||
if: matrix.os == 'windows-latest' && !startsWith(matrix.ruby, '2.3') && !startsWith(matrix.ruby, '2.2')
|
||||
if: matrix.os == 'windows-latest' && !startsWith(matrix.ruby, 'jruby') && !startsWith(matrix.ruby, '2.3') && !startsWith(matrix.ruby, '2.2')
|
||||
- name: Subprocess test
|
||||
run: ruby test_subprocess.rb
|
||||
- name: OpenSSL version
|
||||
|
||||
+15
-8
@@ -5160,9 +5160,13 @@ function getAvailableVersions(platform, engine) {
|
||||
async function install(platform, ruby) {
|
||||
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
||||
|
||||
core.addPath(path.join(rubyPrefix, 'bin'))
|
||||
if (ruby.startsWith('rubinius')) {
|
||||
core.addPath(path.join(rubyPrefix, 'gems', 'bin'))
|
||||
if (platform === 'windows-latest') {
|
||||
__webpack_require__(826).setupPath(undefined, rubyPrefix)
|
||||
} else {
|
||||
core.addPath(path.join(rubyPrefix, 'bin'))
|
||||
if (ruby.startsWith('rubinius')) {
|
||||
core.addPath(path.join(rubyPrefix, 'gems', 'bin'))
|
||||
}
|
||||
}
|
||||
|
||||
return rubyPrefix
|
||||
@@ -7860,6 +7864,7 @@ module.exports = function mergeConfig(config1, config2) {
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAvailableVersions", function() { return getAvailableVersions; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setupPath", function() { return setupPath; });
|
||||
// Most of this logic is from
|
||||
// https://github.com/MSP-Greg/actions-ruby/blob/master/lib/main.js
|
||||
|
||||
@@ -7895,8 +7900,7 @@ async function install(platform, ruby) {
|
||||
const rubyPrefix = `${drive}:\\${base}`
|
||||
|
||||
const [hostedRuby, msys2] = await linkMSYS2()
|
||||
const newPath = setupPath(msys2, rubyPrefix)
|
||||
core.exportVariable('PATH', newPath)
|
||||
setupPath(msys2, rubyPrefix)
|
||||
|
||||
if (version.startsWith('2.2') || version.startsWith('2.3')) {
|
||||
core.exportVariable('SSL_CERT_FILE', `${hostedRuby}\\ssl\\cert.pem`)
|
||||
@@ -7933,13 +7937,16 @@ function setupPath(msys2, rubyPrefix) {
|
||||
// Remove default Ruby in PATH
|
||||
path = path.filter(e => !e.match(/\bRuby\b/))
|
||||
|
||||
// Add MSYS2 in PATH
|
||||
path.unshift(`${msys2}\\mingw64\\bin`, `${msys2}\\usr\\bin`)
|
||||
if (msys2) {
|
||||
// Add MSYS2 in PATH
|
||||
path.unshift(`${msys2}\\mingw64\\bin`, `${msys2}\\usr\\bin`)
|
||||
}
|
||||
|
||||
// Add the downloaded Ruby in PATH
|
||||
path.unshift(`${rubyPrefix}\\bin`)
|
||||
|
||||
return path.join(';')
|
||||
const newPath = path.join(';')
|
||||
core.exportVariable('PATH', newPath)
|
||||
}
|
||||
|
||||
|
||||
|
||||
+7
-3
@@ -16,9 +16,13 @@ export function getAvailableVersions(platform, engine) {
|
||||
export async function install(platform, ruby) {
|
||||
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
||||
|
||||
core.addPath(path.join(rubyPrefix, 'bin'))
|
||||
if (ruby.startsWith('rubinius')) {
|
||||
core.addPath(path.join(rubyPrefix, 'gems', 'bin'))
|
||||
if (platform === 'windows-latest') {
|
||||
require('./windows').setupPath(undefined, rubyPrefix)
|
||||
} else {
|
||||
core.addPath(path.join(rubyPrefix, 'bin'))
|
||||
if (ruby.startsWith('rubinius')) {
|
||||
core.addPath(path.join(rubyPrefix, 'gems', 'bin'))
|
||||
}
|
||||
}
|
||||
|
||||
return rubyPrefix
|
||||
|
||||
+8
-6
@@ -33,8 +33,7 @@ export async function install(platform, ruby) {
|
||||
const rubyPrefix = `${drive}:\\${base}`
|
||||
|
||||
const [hostedRuby, msys2] = await linkMSYS2()
|
||||
const newPath = setupPath(msys2, rubyPrefix)
|
||||
core.exportVariable('PATH', newPath)
|
||||
setupPath(msys2, rubyPrefix)
|
||||
|
||||
if (version.startsWith('2.2') || version.startsWith('2.3')) {
|
||||
core.exportVariable('SSL_CERT_FILE', `${hostedRuby}\\ssl\\cert.pem`)
|
||||
@@ -62,7 +61,7 @@ async function linkMSYS2() {
|
||||
return [latestHostedRuby, msys2]
|
||||
}
|
||||
|
||||
function setupPath(msys2, rubyPrefix) {
|
||||
export function setupPath(msys2, rubyPrefix) {
|
||||
let path = process.env['PATH'].split(';')
|
||||
|
||||
// Remove conflicting dev tools from PATH
|
||||
@@ -71,11 +70,14 @@ function setupPath(msys2, rubyPrefix) {
|
||||
// Remove default Ruby in PATH
|
||||
path = path.filter(e => !e.match(/\bRuby\b/))
|
||||
|
||||
// Add MSYS2 in PATH
|
||||
path.unshift(`${msys2}\\mingw64\\bin`, `${msys2}\\usr\\bin`)
|
||||
if (msys2) {
|
||||
// Add MSYS2 in PATH
|
||||
path.unshift(`${msys2}\\mingw64\\bin`, `${msys2}\\usr\\bin`)
|
||||
}
|
||||
|
||||
// Add the downloaded Ruby in PATH
|
||||
path.unshift(`${rubyPrefix}\\bin`)
|
||||
|
||||
return path.join(';')
|
||||
const newPath = path.join(';')
|
||||
core.exportVariable('PATH', newPath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user