MCPcopy Create free account
hub / github.com/vercel/vercel / resolveSystemRuby

Function resolveSystemRuby

packages/ruby/src/install-ruby.ts:52–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50}
51
52function resolveSystemRuby(): {
53 rubyPath: string;
54 gemPath: string;
55 major: number;
56 minor: number;
57} | null {
58 const rubyPath = which.sync('ruby', { nothrow: true }) as string | null;
59 const gemPath = which.sync('gem', { nothrow: true }) as string | null;
60 if (!rubyPath || !gemPath) return null;
61 const ver = spawnSync(rubyPath, ['-e', 'print RUBY_VERSION'], {
62 encoding: 'utf8',
63 });
64 if (ver.status !== 0 || !ver.stdout) return null;
65 const [mj, mn] = String(ver.stdout).trim().split('.');
66 const major = Number(mj) ?? 3;
67 const minor = Number(mn) ?? 3;
68 return { rubyPath, gemPath, major, minor };
69}
70
71function makeLocalRubyEnv({
72 major,

Callers 1

getRubyPathFunction · 0.85

Calls 2

splitMethod · 0.80
syncMethod · 0.45

Tested by

no test coverage detected