mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 12:57:46 +00:00
[ruby] Fix ruby version error message (#8381)
This error message was incorrectly telling user to use the `2.7.x` value even though it will fail `bundle install` with the following error: ``` Your Ruby patchlevel is 0, but your Gemfile specified -1 Command failed with exit code 18 (EXDEV) ``` The exact version, `2.7.0`, is necessary.
This commit is contained in:
@@ -5,13 +5,15 @@ import { Meta, NodeVersion, debug, NowBuildError } from '@vercel/build-utils';
|
|||||||
|
|
||||||
interface RubyVersion extends NodeVersion {
|
interface RubyVersion extends NodeVersion {
|
||||||
minor: number;
|
minor: number;
|
||||||
|
patch: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const allOptions: RubyVersion[] = [
|
const allOptions: RubyVersion[] = [
|
||||||
{ major: 2, minor: 7, range: '2.7.x', runtime: 'ruby2.7' },
|
{ major: 2, minor: 7, patch: 0, range: '2.7.x', runtime: 'ruby2.7' },
|
||||||
{
|
{
|
||||||
major: 2,
|
major: 2,
|
||||||
minor: 5,
|
minor: 5,
|
||||||
|
patch: 0,
|
||||||
range: '2.5.x',
|
range: '2.5.x',
|
||||||
runtime: 'ruby2.5',
|
runtime: 'ruby2.5',
|
||||||
discontinueDate: new Date('2021-11-30'),
|
discontinueDate: new Date('2021-11-30'),
|
||||||
@@ -55,7 +57,7 @@ function getRubyPath(meta: Meta, gemfileContents: string) {
|
|||||||
if (isDiscontinued(selection)) {
|
if (isDiscontinued(selection)) {
|
||||||
const latest = getLatestRubyVersion();
|
const latest = getLatestRubyVersion();
|
||||||
const intro = `Found \`Gemfile\` with discontinued Ruby version: \`${line}.\``;
|
const intro = `Found \`Gemfile\` with discontinued Ruby version: \`${line}.\``;
|
||||||
const hint = `Please set \`ruby "~> ${latest.range}"\` in your \`Gemfile\` to use Ruby ${latest.range}.`;
|
const hint = `Please set \`ruby "~> ${latest.major}.${latest.minor}.${latest.patch}"\` in your \`Gemfile\` to use the latest Ruby version.`;
|
||||||
throw new NowBuildError({
|
throw new NowBuildError({
|
||||||
code: 'RUBY_DISCONTINUED_VERSION',
|
code: 'RUBY_DISCONTINUED_VERSION',
|
||||||
link: 'http://vercel.link/ruby-version',
|
link: 'http://vercel.link/ruby-version',
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
ruby "~> 2.5.x"
|
ruby "~> 2.5.0"
|
||||||
|
|
||||||
gem "cowsay", "~> 0.3.0"
|
gem "cowsay", "~> 0.3.0"
|
||||||
|
|||||||
2
packages/ruby/test/test.js
vendored
2
packages/ruby/test/test.js
vendored
@@ -12,7 +12,7 @@ const fixturesPath = path.resolve(__dirname, 'fixtures');
|
|||||||
const testsThatFailToBuild = new Map([
|
const testsThatFailToBuild = new Map([
|
||||||
[
|
[
|
||||||
'11-version-2-5-error',
|
'11-version-2-5-error',
|
||||||
'Found `Gemfile` with discontinued Ruby version: `ruby "~> 2.5.x".` Please set `ruby "~> 2.7.x"` in your `Gemfile` to use Ruby 2.7.x.',
|
'Found `Gemfile` with discontinued Ruby version: `ruby "~> 2.5.0".` Please set `ruby "~> 2.7.0"` in your `Gemfile` to use the latest Ruby version.',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user