From 23b973520669420f429b95a24c70af2ed3f3b894 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 15 May 2020 12:58:32 +0200 Subject: [PATCH] Fix checks for head versions * Always use common.isHeadVersion(). --- .github/workflows/test.yml | 4 ++-- dist/index.js | 4 ++-- index.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0e8c56cc3..18e4a60e1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,13 +15,13 @@ jobs: matrix: os: [ ubuntu, macos, windows ] # Use various version syntax here for testing - ruby: [ 2.2, 2.3, 2.4, 2.5, 2.6.6, 2.7, ruby-head, ruby-debug, jruby-9.1, jruby, jruby-head, truffleruby, truffleruby-head ] + ruby: [ 2.2, 2.3, 2.4, 2.5, 2.6.6, 2.7, ruby-head, debug, jruby-9.1, jruby, jruby-head, truffleruby, truffleruby-head ] include: - { os: ubuntu, ruby: rubinius } - { os: windows, ruby: mingw } - { os: windows, ruby: mswin } exclude: - - { os: windows, ruby: ruby-debug } + - { os: windows, ruby: debug } - { os: windows, ruby: truffleruby } - { os: windows, ruby: truffleruby-head } diff --git a/dist/index.js b/dist/index.js index 4fb3b06a0..e2a1e22da 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1036,7 +1036,7 @@ function parseRubyEngineAndVersion(rubyVersion) { } let engine, version - if (rubyVersion.match(/^(\d+|head|mingw|mswin)/)) { // X.Y.Z => ruby-X.Y.Z + if (rubyVersion.match(/^(\d+)/) || common.isHeadVersion(rubyVersion)) { // X.Y.Z => ruby-X.Y.Z engine = 'ruby' version = rubyVersion } else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion @@ -1057,7 +1057,7 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, parsedVe let version = parsedVersion if (!engineVersions.includes(parsedVersion)) { const latestToFirstVersion = engineVersions.slice().reverse() - const found = latestToFirstVersion.find(v => v !== 'head' && v.startsWith(parsedVersion)) + const found = latestToFirstVersion.find(v => !common.isHeadVersion(v) && v.startsWith(parsedVersion)) if (found) { version = found } else { diff --git a/index.js b/index.js index 3816af53a..13301e3fa 100644 --- a/index.js +++ b/index.js @@ -65,7 +65,7 @@ function parseRubyEngineAndVersion(rubyVersion) { } let engine, version - if (rubyVersion.match(/^(\d+|head|mingw|mswin)/)) { // X.Y.Z => ruby-X.Y.Z + if (rubyVersion.match(/^(\d+)/) || common.isHeadVersion(rubyVersion)) { // X.Y.Z => ruby-X.Y.Z engine = 'ruby' version = rubyVersion } else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion @@ -86,7 +86,7 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, parsedVe let version = parsedVersion if (!engineVersions.includes(parsedVersion)) { const latestToFirstVersion = engineVersions.slice().reverse() - const found = latestToFirstVersion.find(v => v !== 'head' && v.startsWith(parsedVersion)) + const found = latestToFirstVersion.find(v => !common.isHeadVersion(v) && v.startsWith(parsedVersion)) if (found) { version = found } else {