8000 Consider truffleruby preview releases to be stable versions · ruby/setup-ruby@d2b39ad · GitHub
[go: up one dir, main page]

Skip to content

Commit d2b39ad

Browse files
committed
Consider truffleruby preview releases to be stable versions
1 parent e939497 commit d2b39ad

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

bundler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
8080

8181
if (bundlerVersion === 'default') {
8282
if (common.isBundler2dot2Default(engine, rubyVersion)) {
83-
if (common.windows && engine === 'ruby' && (common.isStableVersion(rubyVersion) || rubyVersion === 'head')) {
83+
if (common.windows && engine === 'ruby' && (common.isStableVersion(engine, rubyVersion) || rubyVersion === 'head')) {
8484
// https://github.com/ruby/setup-ruby/issues/371
8585
console.log(`Installing latest Bundler for ${engine}-${rubyVersion} on Windows because bin/bundle does not work in bash otherwise`)
8686
bundlerVersion = 'latest'

common.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ export function isHeadVersion(rubyVersion) {
7070
return ['head', 'debug', 'mingw', 'mswin', 'ucrt'].includes(rubyVersion)
7171
}
7272

73-
export function isStableVersion(rubyVersion) {
74-
return /^\d+(\.\d+)*$/.test(rubyVersion)
73+
export function isStableVersion(engine, rubyVersion) {
74+
if (engine.startsWith('truffleruby')) {
75+
return /^\d+(\.\d+)*(-preview\d+)?$/.test(rubyVersion)
76+
} else {
77+
return /^\d+(\.\d+)*$/.test(rubyVersion)
78+
}
7579
}
7680

7781
export function hasBundlerDefaultGem(engine, rubyVersion) {

dist/index.js

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, parsedVe
145145
if (!engineVersions.includes(parsedVersion)) {
146146
const latestToFirstVersion = engineVersions.slice().reverse()
147147
// Try to match stable versions first, so an empty version (engine-only) matches the latest stable version
148-
let found = latestToFirstVersion.find(v => common.isStableVersion(v) && v.startsWith(parsedVersion))
148+
let found = latestToFirstVersion.find(v => common.isStableVersion(engine, v) && v.startsWith(parsedVersion))
149149
if (!found) {
150150
// Exclude head versions, they must be exact matches
151151
found = latestToFirstVersion.find(v => !common.isHeadVersion(v) && v.startsWith(parsedVersion))

0 commit comments

Comments
 (0)
0