Small cleanups
This commit is contained in:
+8
-8
@@ -1073,7 +1073,7 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
|||||||
|
|
||||||
function setupPath(ruby, newPathEntries) {
|
function setupPath(ruby, newPathEntries) {
|
||||||
const originalPath = process.env['PATH'].split(path.delimiter)
|
const originalPath = process.env['PATH'].split(path.delimiter)
|
||||||
let cleanPath = originalPath.filter(e => !/\bruby\b/i.test(e))
|
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
|
||||||
|
|
||||||
if (cleanPath.length !== originalPath.length) {
|
if (cleanPath.length !== originalPath.length) {
|
||||||
console.log("Entries removed from PATH to avoid conflicts with Ruby:")
|
console.log("Entries removed from PATH to avoid conflicts with Ruby:")
|
||||||
@@ -4895,9 +4895,9 @@ async function install(platform, ruby) {
|
|||||||
// we use certs and embedded MSYS2 from hostedRuby
|
// we use certs and embedded MSYS2 from hostedRuby
|
||||||
const hostedRuby = latestHostedRuby()
|
const hostedRuby = latestHostedRuby()
|
||||||
|
|
||||||
let toolsPaths = (version === 'mswin') ?
|
let toolchainPaths = (version === 'mswin') ?
|
||||||
await setupMSWin(hostedRuby) : await setupMingw(hostedRuby, version)
|
await setupMSWin(hostedRuby) : await setupMingw(hostedRuby, version)
|
||||||
const newPathEntries = [`${rubyPrefix}\\bin`, ...toolsPaths]
|
const newPathEntries = [`${rubyPrefix}\\bin`, ...toolchainPaths]
|
||||||
|
|
||||||
// Install Bundler if needed
|
// Install Bundler if needed
|
||||||
if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) {
|
if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) {
|
||||||
@@ -4949,8 +4949,8 @@ async function setupMSWin(hostedRuby) {
|
|||||||
return addVCVARSEnv()
|
return addVCVARSEnv()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sets msvc environment for use in Actions
|
/* Sets MSVC environment for use in Actions
|
||||||
* allows steps to run without running vcvars*.bat, also allows using PS scripts
|
* allows steps to run without running vcvars*.bat, also for PowerShell
|
||||||
* adds a convenience VCVARS environment variable
|
* adds a convenience VCVARS environment variable
|
||||||
* this assumes a single Visual Studio version being available in the windows-latest image */
|
* this assumes a single Visual Studio version being available in the windows-latest image */
|
||||||
function addVCVARSEnv() {
|
function addVCVARSEnv() {
|
||||||
@@ -4966,17 +4966,17 @@ function addVCVARSEnv() {
|
|||||||
newEnv.set(k,v)
|
newEnv.set(k,v)
|
||||||
})
|
})
|
||||||
|
|
||||||
let newPathEntries = null
|
let newPathEntries = undefined
|
||||||
for (let [k, v] of newEnv) {
|
for (let [k, v] of newEnv) {
|
||||||
if (process.env[k] !== v) {
|
if (process.env[k] !== v) {
|
||||||
if (k === 'Path') {
|
if (k === 'Path') {
|
||||||
newPathEntries = v.replace(process.env['Path'], '')
|
newPathEntries = v.replace(process.env['Path'], '').split(';')
|
||||||
} else {
|
} else {
|
||||||
core.exportVariable(k, v)
|
core.exportVariable(k, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [newPathEntries]
|
return newPathEntries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
|||||||
|
|
||||||
function setupPath(ruby, newPathEntries) {
|
function setupPath(ruby, newPathEntries) {
|
||||||
const originalPath = process.env['PATH'].split(path.delimiter)
|
const originalPath = process.env['PATH'].split(path.delimiter)
|
||||||
let cleanPath = originalPath.filter(e => !/\bruby\b/i.test(e))
|
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
|
||||||
|
|
||||||
if (cleanPath.length !== originalPath.length) {
|
if (cleanPath.length !== originalPath.length) {
|
||||||
console.log("Entries removed from PATH to avoid conflicts with Ruby:")
|
console.log("Entries removed from PATH to avoid conflicts with Ruby:")
|
||||||
|
|||||||
+7
-7
@@ -36,9 +36,9 @@ export async function install(platform, ruby) {
|
|||||||
// we use certs and embedded MSYS2 from hostedRuby
|
// we use certs and embedded MSYS2 from hostedRuby
|
||||||
const hostedRuby = latestHostedRuby()
|
const hostedRuby = latestHostedRuby()
|
||||||
|
|
||||||
let toolsPaths = (version === 'mswin') ?
|
let toolchainPaths = (version === 'mswin') ?
|
||||||
await setupMSWin(hostedRuby) : await setupMingw(hostedRuby, version)
|
await setupMSWin(hostedRuby) : await setupMingw(hostedRuby, version)
|
||||||
const newPathEntries = [`${rubyPrefix}\\bin`, ...toolsPaths]
|
const newPathEntries = [`${rubyPrefix}\\bin`, ...toolchainPaths]
|
||||||
|
|
||||||
// Install Bundler if needed
|
// Install Bundler if needed
|
||||||
if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) {
|
if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) {
|
||||||
@@ -90,8 +90,8 @@ async function setupMSWin(hostedRuby) {
|
|||||||
return addVCVARSEnv()
|
return addVCVARSEnv()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sets msvc environment for use in Actions
|
/* Sets MSVC environment for use in Actions
|
||||||
* allows steps to run without running vcvars*.bat, also allows using PS scripts
|
* allows steps to run without running vcvars*.bat, also for PowerShell
|
||||||
* adds a convenience VCVARS environment variable
|
* adds a convenience VCVARS environment variable
|
||||||
* this assumes a single Visual Studio version being available in the windows-latest image */
|
* this assumes a single Visual Studio version being available in the windows-latest image */
|
||||||
export function addVCVARSEnv() {
|
export function addVCVARSEnv() {
|
||||||
@@ -107,15 +107,15 @@ export function addVCVARSEnv() {
|
|||||||
newEnv.set(k,v)
|
newEnv.set(k,v)
|
||||||
})
|
})
|
||||||
|
|
||||||
let newPathEntries = null
|
let newPathEntries = undefined
|
||||||
for (let [k, v] of newEnv) {
|
for (let [k, v] of newEnv) {
|
||||||
if (process.env[k] !== v) {
|
if (process.env[k] !== v) {
|
||||||
if (k === 'Path') {
|
if (k === 'Path') {
|
||||||
newPathEntries = v.replace(process.env['Path'], '')
|
newPathEntries = v.replace(process.env['Path'], '').split(';')
|
||||||
} else {
|
} else {
|
||||||
core.exportVariable(k, v)
|
core.exportVariable(k, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [newPathEntries]
|
return newPathEntries
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user