[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:
Steven
2022-08-12 11:31:36 -04:00
committed by GitHub
parent 2dfb6b45cd
commit 551cd7f688
3 changed files with 6 additions and 4 deletions

View File

@@ -5,13 +5,15 @@ import { Meta, NodeVersion, debug, NowBuildError } from '@vercel/build-utils';
interface RubyVersion extends NodeVersion {
minor: number;
patch: number;
}
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,
minor: 5,
patch: 0,
range: '2.5.x',
runtime: 'ruby2.5',
discontinueDate: new Date('2021-11-30'),
@@ -55,7 +57,7 @@ function getRubyPath(meta: Meta, gemfileContents: string) {
if (isDiscontinued(selection)) {
const latest = getLatestRubyVersion();
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({
code: 'RUBY_DISCONTINUED_VERSION',
link: 'http://vercel.link/ruby-version',