@vercel/ruby 1.2.8-canary.4 → 1.2.8-canary.5

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 +23 -8
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -8665,10 +8665,11 @@ exports.version = 3;
8665
8665
  async function build({ workPath, files, entrypoint, config, meta = {}, }) {
8666
8666
  await build_utils_1.download(files, workPath, meta);
8667
8667
  const entrypointFsDirname = path_1.join(workPath, path_1.dirname(entrypoint));
8668
+ const gemfileName = 'Gemfile';
8668
8669
  const gemfilePath = await build_utils_1.walkParentDirs({
8669
8670
  base: workPath,
8670
8671
  start: entrypointFsDirname,
8671
- filename: 'Gemfile',
8672
+ filename: gemfileName,
8672
8673
  });
8673
8674
  const gemfileContents = gemfilePath
8674
8675
  ? await fs_extra_1.readFile(gemfilePath, 'utf8')
@@ -8700,14 +8701,23 @@ async function build({ workPath, files, entrypoint, config, meta = {}, }) {
8700
8701
  if (!hasVendorDir) {
8701
8702
  if (gemfilePath) {
8702
8703
  build_utils_1.debug('did not find a vendor directory but found a Gemfile, bundling gems...');
8703
- // try installing. this won't work if native extesions are required.
8704
- // if that's the case, gems should be vendored locally before deploying.
8705
- try {
8706
- await bundleInstall(bundlerPath, bundleDir, gemfilePath);
8704
+ const fileAtRoot = path_1.relative(workPath, gemfilePath) === gemfileName;
8705
+ // If the `Gemfile` is located in the Root Directory of the project and
8706
+ // the new File System API is used (`avoidTopLevelInstall`), the Install Command
8707
+ // will have already installed its dependencies, so we don't need to do it again.
8708
+ if (meta.avoidTopLevelInstall && fileAtRoot) {
8709
+ build_utils_1.debug('Skipping `bundle install` — already handled by Install Command');
8707
8710
  }
8708
- catch (err) {
8709
- build_utils_1.debug('unable to build gems from Gemfile. vendor the gems locally with "bundle install --deployment" and retry.');
8710
- throw err;
8711
+ else {
8712
+ // try installing. this won't work if native extesions are required.
8713
+ // if that's the case, gems should be vendored locally before deploying.
8714
+ try {
8715
+ await bundleInstall(bundlerPath, bundleDir, gemfilePath);
8716
+ }
8717
+ catch (err) {
8718
+ build_utils_1.debug('unable to build gems from Gemfile. vendor the gems locally with "bundle install --deployment" and retry.');
8719
+ throw err;
8720
+ }
8711
8721
  }
8712
8722
  }
8713
8723
  }
@@ -8830,6 +8840,11 @@ function getRubyPath(meta, gemfileContents) {
8830
8840
  // process.env.GEM_HOME), and returns
8831
8841
  // the absolute path to it
8832
8842
  async function installBundler(meta, gemfileContents) {
8843
+ // If the new File System API is used (`avoidTopLevelInstall`), the Install Command
8844
+ // will have already installed the dependencies, so we don't need to do it again.
8845
+ if (meta.avoidTopLevelInstall) {
8846
+ build_utils_1.debug(`Skipping bundler installation, already installed by Install Command`);
8847
+ }
8833
8848
  const { gemHome, rubyPath, gemPath, vendorPath, runtime } = getRubyPath(meta, gemfileContents);
8834
8849
  build_utils_1.debug('installing bundler...');
8835
8850
  await execa_1.default(gemPath, ['install', 'bundler', '--no-document'], {
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.4",
4
+ "version": "1.2.8-canary.5",
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": "ed1dacd27698f3bb181f32b516af6953655b37e9"
31
+ "gitHead": "1202ff7b2b8a821c6404a86baa12996f3078ed36"
32
32
  }