@vercel/ruby 1.2.8-canary.5 → 1.2.10-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +33 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -8793,11 +8793,21 @@ const execa_1 = __importDefault(__webpack_require__(4237));
8793
8793
  const build_utils_1 = __webpack_require__(3445);
8794
8794
  const allOptions = [
8795
8795
  { major: 2, minor: 7, range: '2.7.x', runtime: 'ruby2.7' },
8796
- { major: 2, minor: 5, range: '2.5.x', runtime: 'ruby2.5' },
8796
+ {
8797
+ major: 2,
8798
+ minor: 5,
8799
+ range: '2.5.x',
8800
+ runtime: 'ruby2.5',
8801
+ discontinueDate: new Date('2021-11-30'),
8802
+ },
8797
8803
  ];
8798
8804
  function getLatestRubyVersion() {
8799
8805
  return allOptions[0];
8800
8806
  }
8807
+ function isDiscontinued({ discontinueDate }) {
8808
+ const today = Date.now();
8809
+ return discontinueDate !== undefined && discontinueDate.getTime() <= today;
8810
+ }
8801
8811
  function getRubyPath(meta, gemfileContents) {
8802
8812
  let selection = getLatestRubyVersion();
8803
8813
  if (meta.isDev) {
@@ -8818,8 +8828,19 @@ function getRubyPath(meta, gemfileContents) {
8818
8828
  if (!found) {
8819
8829
  throw new build_utils_1.NowBuildError({
8820
8830
  code: 'RUBY_INVALID_VERSION',
8821
- message: 'Found `Gemfile` with invalid Ruby version: `' + line + '`.',
8822
- link: 'https://vercel.com/docs/runtimes#official-runtimes/ruby/ruby-version',
8831
+ message: `Found \`Gemfile\` with invalid Ruby version: \`${line}.\``,
8832
+ link: 'http://vercel.link/ruby-version',
8833
+ });
8834
+ }
8835
+ if (isDiscontinued(selection)) {
8836
+ const latest = getLatestRubyVersion();
8837
+ const intro = `Found \`Gemfile\` with discontinued Ruby version: \`${line}.\``;
8838
+ const hint = `Please set \`ruby "~> ${latest.range}"\` in your \`Gemfile\` to use Ruby ${latest.range}.`;
8839
+ const upstream = 'This change is the result of a decision made by an upstream infrastructure provider (AWS).';
8840
+ throw new build_utils_1.NowBuildError({
8841
+ code: 'RUBY_DISCONTINUED_VERSION',
8842
+ link: 'http://vercel.link/ruby-version',
8843
+ message: `${intro} ${hint} ${upstream}`,
8823
8844
  });
8824
8845
  }
8825
8846
  }
@@ -8840,12 +8861,20 @@ function getRubyPath(meta, gemfileContents) {
8840
8861
  // process.env.GEM_HOME), and returns
8841
8862
  // the absolute path to it
8842
8863
  async function installBundler(meta, gemfileContents) {
8864
+ const { gemHome, rubyPath, gemPath, vendorPath, runtime } = getRubyPath(meta, gemfileContents);
8843
8865
  // If the new File System API is used (`avoidTopLevelInstall`), the Install Command
8844
8866
  // will have already installed the dependencies, so we don't need to do it again.
8845
8867
  if (meta.avoidTopLevelInstall) {
8846
8868
  build_utils_1.debug(`Skipping bundler installation, already installed by Install Command`);
8869
+ return {
8870
+ gemHome,
8871
+ rubyPath,
8872
+ gemPath,
8873
+ vendorPath,
8874
+ runtime,
8875
+ bundlerPath: path_1.join(gemHome, 'bin', 'bundler'),
8876
+ };
8847
8877
  }
8848
- const { gemHome, rubyPath, gemPath, vendorPath, runtime } = getRubyPath(meta, gemfileContents);
8849
8878
  build_utils_1.debug('installing bundler...');
8850
8879
  await execa_1.default(gemPath, ['install', 'bundler', '--no-document'], {
8851
8880
  stdio: 'pipe',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vercel/ruby",
3
3
  "author": "Nathan Cahill <nathan@nathancahill.com>",
4
- "version": "1.2.8-canary.5",
4
+ "version": "1.2.10-canary.0",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index",
7
7
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby",
@@ -28,5 +28,5 @@
28
28
  "semver": "6.1.1",
29
29
  "typescript": "4.3.4"
30
30
  },
31
- "gitHead": "1202ff7b2b8a821c6404a86baa12996f3078ed36"
31
+ "gitHead": "2c3ddffaacb370eb4c0893815b3bc7417f92d432"
32
32
  }