Simplify the logic to set up certs dir and cert.pem

This commit is contained in:
Benoit Daloze
2020-02-24 22:52:23 +01:00
parent d2b72024f1
commit dbcdcf481d
2 changed files with 20 additions and 28 deletions
Generated Vendored
+11 -15
View File
@@ -4890,26 +4890,22 @@ async function install(platform, ruby) {
return rubyPrefix return rubyPrefix
} }
// all standard msvc OpenSSL builds use C:\Program Files\Common Files\SSL
// as per openssl/openssl
function setupMSWin(hostedRuby) { function setupMSWin(hostedRuby) {
// create cert dir // All standard MSVC OpenSSL builds use C:\Program Files\Common Files\SSL
const msCertDir = 'C:\\Program Files\\Common Files\\SSL\\certs' const certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
if (!fs.existsSync(msCertDir)) { if (!fs.existsSync(certsDir)) {
fs.mkdirSync(msCertDir, { recursive: true }) fs.mkdirSync(certsDir)
} }
// Copy cert file // Copy cert.pem from hosted Ruby
const msCert = 'C:\\Program Files\\Common Files\\SSL\\cert.pem' const cert = 'C:\\Program Files\\Common Files\\SSL\\cert.pem'
if (!fs.existsSync(msCert)) { if (!fs.existsSync(cert)) {
const ri2Cert = `${hostedRuby}\\ssl\\cert.pem` const hostedCert = `${hostedRuby}\\ssl\\cert.pem`
if (fs.existsSync(ri2Cert)) { fs.copyFileSync(hostedCert, cert)
fs.copyFileSync(ri2Cert, msCert)
}
} }
// add convenience VCVARS env variable for msvc use // Add a convenience VCVARS environment variable to ease setting up MSVC
// depends on single Visual Studio version being available in Actions image // This assumes a single Visual Studio version being available in the windows-latest image
core.exportVariable('VCVARS', '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"') core.exportVariable('VCVARS', '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"')
} }
+9 -13
View File
@@ -48,22 +48,18 @@ export async function install(platform, ruby) {
return rubyPrefix return rubyPrefix
} }
// all standard msvc OpenSSL builds use C:\Program Files\Common Files\SSL
// as per openssl/openssl
function setupMSWin(hostedRuby) { function setupMSWin(hostedRuby) {
// create cert dir // All standard MSVC OpenSSL builds use C:\Program Files\Common Files\SSL
const msCertDir = 'C:\\Program Files\\Common Files\\SSL\\certs' const certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
if (!fs.existsSync(msCertDir)) { if (!fs.existsSync(certsDir)) {
fs.mkdirSync(msCertDir, { recursive: true }) fs.mkdirSync(certsDir)
} }
// Copy cert file // Copy cert.pem from hosted Ruby
const msCert = 'C:\\Program Files\\Common Files\\SSL\\cert.pem' const cert = 'C:\\Program Files\\Common Files\\SSL\\cert.pem'
if (!fs.existsSync(msCert)) { if (!fs.existsSync(cert)) {
const ri2Cert = `${hostedRuby}\\ssl\\cert.pem` const hostedCert = `${hostedRuby}\\ssl\\cert.pem`
if (fs.existsSync(ri2Cert)) { fs.copyFileSync(hostedCert, cert)
fs.copyFileSync(ri2Cert, msCert)
}
} }
// add convenience VCVARS env variable for msvc use // add convenience VCVARS env variable for msvc use