mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-14 15:04:20 +02:00
Use ridk enable to set MSYS2 ENV variables
Co-authored-by: Lars Kanis <lars@greiz-reinsdorf.de>
This commit is contained in:
committed by
Benoit Daloze
co-authored by
Lars Kanis
parent
6cc535991c
commit
23b44d8ec5
+27
@@ -66,6 +66,11 @@ export async function install(platform, engine, version) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ridk = `${rubyPrefix}\\bin\\ridk.cmd`
|
||||||
|
if (fs.existsSync(ridk)) {
|
||||||
|
await common.measure('Adding ridk env variables', async () => addRidkEnv(ridk))
|
||||||
|
}
|
||||||
|
|
||||||
return rubyPrefix
|
return rubyPrefix
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,3 +196,25 @@ export function addVCVARSEnv() {
|
|||||||
}
|
}
|
||||||
return newPathEntries
|
return newPathEntries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets MSYS2 ENV variables set from running `ridk enable`
|
||||||
|
//
|
||||||
|
function addRidkEnv(ridk) {
|
||||||
|
let newEnv = new Map()
|
||||||
|
let cmd = `cmd.exe /c "${ridk} enable && set"`
|
||||||
|
let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/)
|
||||||
|
newSet = newSet.filter(line => /^\S+=\S+/.test(line))
|
||||||
|
newSet.forEach(s => {
|
||||||
|
let [k,v] = common.partition(s, '=')
|
||||||
|
newEnv.set(k,v)
|
||||||
|
})
|
||||||
|
|
||||||
|
for (let [k, v] of newEnv) {
|
||||||
|
if (process.env[k] !== v) {
|
||||||
|
if (!/^Path$/i.test(k)) {
|
||||||
|
console.log(`${k}=${v}`)
|
||||||
|
core.exportVariable(k, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user