Skip to content

Commit

Permalink
[build-utils][ruby] Remove legacy avoidTopLevelInstall logic (#11513)
Browse files Browse the repository at this point in the history
This logic was left over from a previous iteration of the `vc build`
command which was never shipped. Thus, this logic is no longer
necessary.
  • Loading branch information
TooTallNate committed Apr 30, 2024
1 parent 1c8f0a4 commit 15475c8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 38 deletions.
6 changes: 6 additions & 0 deletions .changeset/loud-masks-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@vercel/build-utils': major
'@vercel/ruby': minor
---

Remove legacy `avoidTopLevelInstall` logic
1 change: 0 additions & 1 deletion packages/build-utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export interface Meta {
filesRemoved?: string[];
env?: Env;
buildEnv?: Env;
avoidTopLevelInstall?: boolean;
[key: string]: unknown;
}

Expand Down
23 changes: 4 additions & 19 deletions packages/ruby/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EOL } from 'os';
import { join, dirname, relative } from 'path';
import { join, dirname } from 'path';
import execa from 'execa';
import {
ensureDir,
Expand Down Expand Up @@ -187,24 +187,9 @@ export const build: BuildV3 = async ({
'did not find a vendor directory but found a Gemfile, bundling gems...'
);

const fileAtRoot = relative(workPath, gemfilePath) === gemfileName;

// If the `Gemfile` is located in the Root Directory of the project and
// the new File System API is used (`avoidTopLevelInstall`), the Install Command
// will have already installed its dependencies, so we don't need to do it again.
if (meta.avoidTopLevelInstall && fileAtRoot) {
debug('Skipping `bundle install` — already handled by Install Command');
} else {
// try installing. this won't work if native extensions are required.
// if that's the case, gems should be vendored locally before deploying.
await bundleInstall(
bundlerPath,
bundleDir,
gemfilePath,
rubyPath,
major
);
}
// try installing. this won't work if native extensions are required.
// if that's the case, gems should be vendored locally before deploying.
await bundleInstall(bundlerPath, bundleDir, gemfilePath, rubyPath, major);
}
} else {
debug('found vendor directory, skipping "bundle install"...');
Expand Down
18 changes: 0 additions & 18 deletions packages/ruby/src/install-ruby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,6 @@ export async function installBundler(meta: Meta, gemfileContents: string) {
const { gemHome, rubyPath, gemPath, vendorPath, runtime, major } =
getRubyPath(meta, gemfileContents);

// If the new File System API is used (`avoidTopLevelInstall`), the Install Command
// will have already installed the dependencies, so we don't need to do it again.
if (meta.avoidTopLevelInstall) {
debug(
`Skipping bundler installation, already installed by Install Command`
);

return {
major,
gemHome,
rubyPath,
gemPath,
vendorPath,
runtime,
bundlerPath: join(gemHome, 'bin', 'bundler'),
};
}

debug('installing bundler...');
await execa(gemPath, ['install', 'bundler', '--no-document'], {
stdio: 'pipe',
Expand Down

0 comments on commit 15475c8

Please sign in to comment.