mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 22:44:20 +02:00
Fixup Rubygems latest
This commit is contained in:
+28
-3
@@ -65086,11 +65086,12 @@ __nccwpck_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "rubygemsUpdate": () => (/* binding */ rubygemsUpdate)
|
||||
/* harmony export */ });
|
||||
const common = __nccwpck_require__(3143)
|
||||
const path = __nccwpck_require__(1017)
|
||||
const exec = __nccwpck_require__(1514)
|
||||
const semver = __nccwpck_require__(1383)
|
||||
|
||||
async function rubygemsUpdate(rubygemsVersionInput, rubyPrefix) {
|
||||
async function rubygemsUpdate(rubygemsVersionInput, rubyPrefix, platform, engine, version) {
|
||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||
|
||||
let gemVersion = ''
|
||||
@@ -65106,7 +65107,7 @@ async function rubygemsUpdate(rubygemsVersionInput, rubyPrefix) {
|
||||
|
||||
if (rubygemsVersionInput === 'latest') {
|
||||
console.log('Updating RubyGems to latest version')
|
||||
await exec.exec(gem, ['update', '--system'])
|
||||
await rubygemsLatest(gem, platform, engine, version)
|
||||
} else if (semver.gt(rubygemsVersionInput, gemVersion)) {
|
||||
console.log(`Updating RubyGems to ${rubygemsVersionInput}`)
|
||||
await exec.exec(gem, ['update', '--system', rubygemsVersionInput])
|
||||
@@ -65117,6 +65118,30 @@ async function rubygemsUpdate(rubygemsVersionInput, rubyPrefix) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Older RubyGems versions do not account for 'required_ruby_version' when
|
||||
// running 'gem update --system', so we have to force a compatible version of
|
||||
// rubygems-update. See https://github.com/ruby/setup-ruby/pull/551 and
|
||||
// https://github.com/rubygems/rubygems/issues/7329
|
||||
async function rubygemsLatest(gem, platform, engine, version) {
|
||||
if (engine === 'ruby') {
|
||||
const rubyFloatVersion = common.floatVersion(version)
|
||||
if (common.isHeadVersion(version)) {
|
||||
console.log('Ruby master builds use included RubyGems')
|
||||
} else if (rubyFloatVersion >= 3.0) {
|
||||
await exec.exec(gem, ['update', '--system'])
|
||||
} else if (rubyFloatVersion >= 2.6) {
|
||||
await exec.exec(gem, ['update', '--system', '3.4.22'])
|
||||
} else if (rubyFloatVersion >= 2.3) {
|
||||
await exec.exec(gem, ['update', '--system', '3.3.27'])
|
||||
} else {
|
||||
console.log(`Cannot update RubyGems for Ruby version ${version}`)
|
||||
}
|
||||
} else {
|
||||
// non MRI Rubies (TruffleRuby and JRuby)
|
||||
await exec.exec(gem, ['update', '--system'])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -65775,7 +65800,7 @@ async function setupRuby(options = {}) {
|
||||
const rubygemsInputSet = inputs['rubygems'] !== 'default'
|
||||
if (rubygemsInputSet) {
|
||||
await common.measure('Updating RubyGems', async () =>
|
||||
rubygems.rubygemsUpdate(inputs['rubygems'], rubyPrefix))
|
||||
rubygems.rubygemsUpdate(inputs['rubygems'], rubyPrefix, platform, engine, version))
|
||||
}
|
||||
|
||||
// When setup-ruby is used by other actions, this allows code in them to run
|
||||
|
||||
Reference in New Issue
Block a user