[build-utils][ruby] Remove legacy avoidTopLevelInstall logic (#11513)

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.
This commit is contained in:
Nathan Rajlich
2024-04-30 01:37:43 -07:00
committed by GitHub
parent 1c8f0a4c33
commit 15475c8a2c
4 changed files with 10 additions and 38 deletions

View File

@@ -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,
@@ -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"...');

View File

@@ -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',