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

Function makeLocalRubyEnv

packages/ruby/src/install-ruby.ts:71–107  ·  view source on GitHub ↗
({
  major,
  minor,
  rubyPath,
  gemPath,
}: {
  major: number;
  minor: number;
  rubyPath: string;
  gemPath: string;
})

Source from the content-addressed store, hash-verified

69}
70
71function makeLocalRubyEnv({
72 major,
73 minor,
74 rubyPath,
75 gemPath,
76}: {
77 major: number;
78 minor: number;
79 rubyPath: string;
80 gemPath: string;
81}) {
82 const gemHome = join(tmpdir(), `vercel-ruby-${major}${minor}-${process.pid}`);
83
84 const matchedOption = allOptions.find(
85 o => o.major === major && o.minor === minor && o.state !== 'discontinued'
86 );
87
88 if (!matchedOption) {
89 throw new NowBuildError({
90 code: 'RUBY_INVALID_VERSION',
91 link: 'http://vercel.link/ruby-version',
92 message: `Local Ruby ${major}.${minor} does not match any supported Vercel runtime. Supported: ${allOptions
93 .filter(o => o.state !== 'discontinued')
94 .map(o => `${o.major}.${o.minor}`)
95 .join(', ')}`,
96 });
97 }
98
99 return {
100 major,
101 gemHome,
102 runtime: matchedOption.runtime,
103 rubyPath,
104 gemPath,
105 vendorPath: `vendor/bundle/ruby/${major}.${minor}.0`,
106 };
107}
108
109function getRubyPath(meta: Meta, gemfileContents: string) {
110 let selection: RubyVersion | null = null;

Callers 1

getRubyPathFunction · 0.85

Calls 3

filterMethod · 0.80
findMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected