mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-14 15:04:20 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e648fd85b4 | ||
|
|
fb9d6fbc69 | ||
|
|
9c77d1b41f |
+16
-2
@@ -976,6 +976,8 @@ async function run() {
|
|||||||
const engineVersions = installer.getAvailableVersions(platform, engine)
|
const engineVersions = installer.getAvailableVersions(platform, engine)
|
||||||
const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
||||||
|
|
||||||
|
createGemRC()
|
||||||
|
|
||||||
const [rubyPrefix, newPathEntries] = await installer.install(platform, ruby)
|
const [rubyPrefix, newPathEntries] = await installer.install(platform, ruby)
|
||||||
|
|
||||||
setupPath(ruby, newPathEntries)
|
setupPath(ruby, newPathEntries)
|
||||||
@@ -1040,6 +1042,13 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
|||||||
return engine + '-' + version
|
return engine + '-' + version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createGemRC() {
|
||||||
|
const gemrc = path.join(os.homedir(), '.gemrc')
|
||||||
|
if (!fs.existsSync(gemrc)) {
|
||||||
|
fs.writeFileSync(gemrc, `gem: --no-document${os.EOL}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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(entry => !/\bruby\b/i.test(entry))
|
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
|
||||||
@@ -3415,7 +3424,7 @@ function getAvailableVersions(platform, engine) {
|
|||||||
|
|
||||||
async function install(platform, ruby) {
|
async function install(platform, ruby) {
|
||||||
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
||||||
let newPathEntries;
|
let newPathEntries
|
||||||
if (ruby.startsWith('rubinius')) {
|
if (ruby.startsWith('rubinius')) {
|
||||||
newPathEntries = [path.join(rubyPrefix, 'bin'), path.join(rubyPrefix, 'gems', 'bin')]
|
newPathEntries = [path.join(rubyPrefix, 'bin'), path.join(rubyPrefix, 'gems', 'bin')]
|
||||||
} else {
|
} else {
|
||||||
@@ -4801,6 +4810,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
// https://github.com/MSP-Greg/actions-ruby/blob/master/lib/main.js
|
// https://github.com/MSP-Greg/actions-ruby/blob/master/lib/main.js
|
||||||
|
|
||||||
const fs = __webpack_require__(747)
|
const fs = __webpack_require__(747)
|
||||||
|
const path = __webpack_require__(622)
|
||||||
const cp = __webpack_require__(129)
|
const cp = __webpack_require__(129)
|
||||||
const core = __webpack_require__(470)
|
const core = __webpack_require__(470)
|
||||||
const exec = __webpack_require__(986)
|
const exec = __webpack_require__(986)
|
||||||
@@ -4869,6 +4879,8 @@ async function symLinkToEmbeddedMSYS2() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setupMingw(version) {
|
async function setupMingw(version) {
|
||||||
|
core.exportVariable('MAKE', 'make.exe')
|
||||||
|
|
||||||
if (version.startsWith('2.2') || version.startsWith('2.3')) {
|
if (version.startsWith('2.2') || version.startsWith('2.3')) {
|
||||||
core.exportVariable('SSL_CERT_FILE', certFile)
|
core.exportVariable('SSL_CERT_FILE', certFile)
|
||||||
await installMSYS(version)
|
await installMSYS(version)
|
||||||
@@ -4899,6 +4911,8 @@ async function installMSYS(version) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setupMSWin() {
|
async function setupMSWin() {
|
||||||
|
core.exportVariable('MAKE', 'nmake.exe')
|
||||||
|
|
||||||
// All standard MSVC OpenSSL builds use C:\Program Files\Common Files\SSL
|
// All standard MSVC OpenSSL builds use C:\Program Files\Common Files\SSL
|
||||||
const certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
|
const certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
|
||||||
if (!fs.existsSync(certsDir)) {
|
if (!fs.existsSync(certsDir)) {
|
||||||
@@ -4940,7 +4954,7 @@ function addVCVARSEnv() {
|
|||||||
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'], '').split(';')
|
newPathEntries = v.replace(process.env['Path'], '').split(path.delimiter)
|
||||||
} else {
|
} else {
|
||||||
core.exportVariable(k, v)
|
core.exportVariable(k, v)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ export async function run() {
|
|||||||
const engineVersions = installer.getAvailableVersions(platform, engine)
|
const engineVersions = installer.getAvailableVersions(platform, engine)
|
||||||
const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
||||||
|
|
||||||
|
createGemRC()
|
||||||
|
|
||||||
const [rubyPrefix, newPathEntries] = await installer.install(platform, ruby)
|
const [rubyPrefix, newPathEntries] = await installer.install(platform, ruby)
|
||||||
|
|
||||||
setupPath(ruby, newPathEntries)
|
setupPath(ruby, newPathEntries)
|
||||||
@@ -82,6 +84,13 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
|||||||
return engine + '-' + version
|
return engine + '-' + version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createGemRC() {
|
||||||
|
const gemrc = path.join(os.homedir(), '.gemrc')
|
||||||
|
if (!fs.existsSync(gemrc)) {
|
||||||
|
fs.writeFileSync(gemrc, `gem: --no-document${os.EOL}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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(entry => !/\bruby\b/i.test(entry))
|
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ export function getAvailableVersions(platform, engine) {
|
|||||||
|
|
||||||
export async function install(platform, ruby) {
|
export async function install(platform, ruby) {
|
||||||
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
||||||
let newPathEntries;
|
let newPathEntries
|
||||||
if (ruby.startsWith('rubinius')) {
|
if (ruby.startsWith('rubinius')) {
|
||||||
newPathEntries = [path.join(rubyPrefix, 'bin'), path.join(rubyPrefix, 'gems', 'bin')]
|
newPathEntries = [path.join(rubyPrefix, 'bin'), path.join(rubyPrefix, 'gems', 'bin')]
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+6
-1
@@ -2,6 +2,7 @@
|
|||||||
// https://github.com/MSP-Greg/actions-ruby/blob/master/lib/main.js
|
// https://github.com/MSP-Greg/actions-ruby/blob/master/lib/main.js
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const cp = require('child_process')
|
const cp = require('child_process')
|
||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
const exec = require('@actions/exec')
|
const exec = require('@actions/exec')
|
||||||
@@ -70,6 +71,8 @@ async function symLinkToEmbeddedMSYS2() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setupMingw(version) {
|
async function setupMingw(version) {
|
||||||
|
core.exportVariable('MAKE', 'make.exe')
|
||||||
|
|
||||||
if (version.startsWith('2.2') || version.startsWith('2.3')) {
|
if (version.startsWith('2.2') || version.startsWith('2.3')) {
|
||||||
core.exportVariable('SSL_CERT_FILE', certFile)
|
core.exportVariable('SSL_CERT_FILE', certFile)
|
||||||
await installMSYS(version)
|
await installMSYS(version)
|
||||||
@@ -100,6 +103,8 @@ async function installMSYS(version) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setupMSWin() {
|
async function setupMSWin() {
|
||||||
|
core.exportVariable('MAKE', 'nmake.exe')
|
||||||
|
|
||||||
// All standard MSVC OpenSSL builds use C:\Program Files\Common Files\SSL
|
// All standard MSVC OpenSSL builds use C:\Program Files\Common Files\SSL
|
||||||
const certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
|
const certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
|
||||||
if (!fs.existsSync(certsDir)) {
|
if (!fs.existsSync(certsDir)) {
|
||||||
@@ -141,7 +146,7 @@ export function addVCVARSEnv() {
|
|||||||
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'], '').split(';')
|
newPathEntries = v.replace(process.env['Path'], '').split(path.delimiter)
|
||||||
} else {
|
} else {
|
||||||
core.exportVariable(k, v)
|
core.exportVariable(k, v)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user