diff --git a/common.js b/common.js index 1b4bc11..ae9b78a 100644 --- a/common.js +++ b/common.js @@ -98,6 +98,15 @@ function getImageOS() { return imageOS } +export const supportedPlatforms = [ + 'ubuntu-18.04', + 'ubuntu-20.04', + 'macos-10.15', + 'macos-11.0', + 'windows-2019', + 'windows-2022', +] + export function getVirtualEnvironmentName() { const imageOS = getImageOS() diff --git a/dist/index.js b/dist/index.js index 8ff2ee4..3a40693 100644 --- a/dist/index.js +++ b/dist/index.js @@ -259,6 +259,7 @@ __nccwpck_require__.r(__webpack_exports__); /* harmony export */ "isBundler2Default": () => (/* binding */ isBundler2Default), /* harmony export */ "floatVersion": () => (/* binding */ floatVersion), /* harmony export */ "hashFile": () => (/* binding */ hashFile), +/* harmony export */ "supportedPlatforms": () => (/* binding */ supportedPlatforms), /* harmony export */ "getVirtualEnvironmentName": () => (/* binding */ getVirtualEnvironmentName), /* harmony export */ "shouldUseToolCache": () => (/* binding */ shouldUseToolCache), /* harmony export */ "getToolCacheRubyPrefix": () => (/* binding */ getToolCacheRubyPrefix), @@ -366,6 +367,15 @@ function getImageOS() { return imageOS } +const supportedPlatforms = [ + 'ubuntu-18.04', + 'ubuntu-20.04', + 'macos-10.15', + 'macos-11.0', + 'windows-2019', + 'windows-2022', +] + function getVirtualEnvironmentName() { const imageOS = getImageOS() @@ -59565,6 +59575,10 @@ const releasesURL = 'https://github.com/ruby/ruby-builder/releases' const windows = common.windows function getAvailableVersions(platform, engine) { + if (!common.supportedPlatforms.includes(platform)) { + throw new Error(`Unsupported platform ${platform}`) + } + return rubyBuilderVersions[engine] } @@ -59747,6 +59761,10 @@ const msysPathEntries = [`${msys1}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys1}\\ const virtualEnv = common.getVirtualEnvironmentName() function getAvailableVersions(platform, engine) { + if (!common.supportedPlatforms.includes(platform)) { + throw new Error(`Unsupported platform ${platform}`) + } + if (engine === 'ruby') { return Object.keys(rubyInstallerVersions) } else { @@ -60315,7 +60333,7 @@ async function setupRuby(options = {}) { const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version']) let installer - if (platform.startsWith('windows-') && engine !== 'jruby') { + if (platform.startsWith('windows-') && engine === 'ruby') { installer = __nccwpck_require__(3216) } else { installer = __nccwpck_require__(9974) diff --git a/index.js b/index.js index b3c78e6..9dd98da 100644 --- a/index.js +++ b/index.js @@ -42,7 +42,7 @@ export async function setupRuby(options = {}) { const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version']) let installer - if (platform.startsWith('windows-') && engine !== 'jruby') { + if (platform.startsWith('windows-') && engine === 'ruby') { installer = require('./windows') } else { installer = require('./ruby-builder') diff --git a/ruby-builder.js b/ruby-builder.js index 942cb1e..81ca2cd 100644 --- a/ruby-builder.js +++ b/ruby-builder.js @@ -13,6 +13,10 @@ const releasesURL = 'https://github.com/ruby/ruby-builder/releases' const windows = common.windows export function getAvailableVersions(platform, engine) { + if (!common.supportedPlatforms.includes(platform)) { + throw new Error(`Unsupported platform ${platform}`) + } + return rubyBuilderVersions[engine] } diff --git a/windows.js b/windows.js index da9fd2b..36bcd1d 100644 --- a/windows.js +++ b/windows.js @@ -25,6 +25,10 @@ const msysPathEntries = [`${msys1}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys1}\\ const virtualEnv = common.getVirtualEnvironmentName() export function getAvailableVersions(platform, engine) { + if (!common.supportedPlatforms.includes(platform)) { + throw new Error(`Unsupported platform ${platform}`) + } + if (engine === 'ruby') { return Object.keys(rubyInstallerVersions) } else {