@@ -3,7 +3,7 @@ const path = require('path')
3
3
const exec = require ( '@actions/exec' )
4
4
const semver = require ( 'semver' )
5
5
6
- export async function rubygemsUpdate ( rubygemsVersionInput , rubyPrefix , platform , engine , version ) {
6
+ export async function rubygemsUpdate ( rubygemsVersionInput , rubyPrefix , platform , engine , rubyVersion ) {
7
7
const gem = path . join ( rubyPrefix , 'bin' , 'gem' )
8
8
9
9
let gemVersion = ''
@@ -19,7 +19,7 @@ export async function rubygemsUpdate(rubygemsVersionInput, rubyPrefix, platform,
19
19
20
20
if ( rubygemsVersionInput === 'latest' ) {
21
21
console . log ( 'Updating RubyGems to latest version' )
22
- await rubygemsLatest ( gem , platform , engine , version )
22
+ await rubygemsLatest ( gem , platform , engine , rubyVersion )
23
23
} else if ( semver . gt ( rubygemsVersionInput , gemVersion ) ) {
24
24
console . log ( `Updating RubyGems to ${ rubygemsVersionInput } ` )
25
25
await exec . exec ( gem , [ 'update' , '--system' , rubygemsVersionInput ] )
@@ -34,19 +34,19 @@ export async function rubygemsUpdate(rubygemsVersionInput, rubyPrefix, platform,
34
34
// running 'gem update --system', so we have to force a compatible version of
35
35
// rubygems-update. See https://github.com/ruby/setup-ruby/pull/551 and
36
36
// https://github.com/rubygems/rubygems/issues/7329
37
- async function rubygemsLatest ( gem , platform , engine , version ) {
37
+ async function rubygemsLatest ( gem , platform , engine , rubyVersion ) {
38
38
if ( engine === 'ruby' ) {
39
- const rubyFloatVersion = common . floatVersion ( version )
40
- if ( common . isHeadVersion ( version ) ) {
39
+ const floatVersion = common . floatVersion ( rubyVersion )
40
+ if ( common . isHeadVersion ( rubyVersion ) ) {
41
41
console . log ( 'Ruby master builds use included RubyGems' )
42
- } else if ( rubyFloatVersion >= 3.0 ) {
42
+ } else if ( floatVersion >= 3.0 ) {
43
43
await exec . exec ( gem , [ 'update' , '--system' ] )
44
- } else if ( rubyFloatVersion >= 2.6 ) {
44
+ } else if ( floatVersion >= 2.6 ) {
45
45
await exec . exec ( gem , [ 'update' , '--system' , '3.4.22' ] )
46
- } else if ( rubyFloatVersion >= 2.3 ) {
46
+ } else if ( floatVersion >= 2.3 ) {
47
47
await exec . exec ( gem , [ 'update' , '--system' , '3.3.27' ] )
48
48
} else {
49
- console . log ( `Cannot update RubyGems for Ruby version ${ version } ` )
49
+ console . log ( `Cannot update RubyGems for Ruby version ${ rubyVersion } ` )
50
50
}
51
51
} else {
52
52
// non MRI Rubies (TruffleRuby and JRuby)
0 commit comments