@vercel/ruby 2.0.2 → 2.0.3
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.
- package/dist/index.js +60 -19
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -7669,18 +7669,33 @@ var import_path = require("path");
|
|
|
7669
7669
|
var import_semver = __toESM(require_semver2());
|
|
7670
7670
|
var import_execa = __toESM(require_execa());
|
|
7671
7671
|
var import_build_utils = require("@vercel/build-utils");
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7672
|
+
function getOptions() {
|
|
7673
|
+
const options = [
|
|
7674
|
+
{
|
|
7675
|
+
major: 2,
|
|
7676
|
+
minor: 7,
|
|
7677
|
+
range: "2.7.x",
|
|
7678
|
+
runtime: "ruby2.7",
|
|
7679
|
+
discontinueDate: /* @__PURE__ */ new Date("2023-12-07")
|
|
7680
|
+
},
|
|
7681
|
+
{
|
|
7682
|
+
major: 2,
|
|
7683
|
+
minor: 5,
|
|
7684
|
+
range: "2.5.x",
|
|
7685
|
+
runtime: "ruby2.5",
|
|
7686
|
+
discontinueDate: /* @__PURE__ */ new Date("2021-11-30")
|
|
7687
|
+
}
|
|
7688
|
+
];
|
|
7689
|
+
if (process.env.VERCEL_ALLOW_RUBY32 === "1") {
|
|
7690
|
+
return [
|
|
7691
|
+
{ major: 3, minor: 2, range: "3.2.x", runtime: "ruby3.2" },
|
|
7692
|
+
...options
|
|
7693
|
+
];
|
|
7680
7694
|
}
|
|
7681
|
-
|
|
7695
|
+
return options;
|
|
7696
|
+
}
|
|
7682
7697
|
function getLatestRubyVersion() {
|
|
7683
|
-
return
|
|
7698
|
+
return getOptions()[0];
|
|
7684
7699
|
}
|
|
7685
7700
|
function isDiscontinued({ discontinueDate }) {
|
|
7686
7701
|
const today = Date.now();
|
|
@@ -7696,7 +7711,7 @@ function getRubyPath(meta, gemfileContents) {
|
|
|
7696
7711
|
const line = gemfileContents.split("\n").find((line2) => line2.startsWith("ruby"));
|
|
7697
7712
|
if (line) {
|
|
7698
7713
|
const strVersion = line.slice(4).trim().slice(1, -1).replace("~>", "");
|
|
7699
|
-
const found =
|
|
7714
|
+
const found = getOptions().some((o) => {
|
|
7700
7715
|
selection = o;
|
|
7701
7716
|
return (0, import_semver.intersects)(o.range, strVersion);
|
|
7702
7717
|
});
|
|
@@ -7780,7 +7795,7 @@ async function matchPaths(configPatterns, workPath) {
|
|
|
7780
7795
|
);
|
|
7781
7796
|
return patternPaths.reduce((a, b) => a.concat(b), []);
|
|
7782
7797
|
}
|
|
7783
|
-
async function bundleInstall(bundlePath, bundleDir, gemfilePath) {
|
|
7798
|
+
async function bundleInstall(bundlePath, bundleDir, gemfilePath, runtime) {
|
|
7784
7799
|
(0, import_build_utils2.debug)(`running "bundle install --deployment"...`);
|
|
7785
7800
|
const bundleAppConfig = await (0, import_build_utils2.getWriteableDirectory)();
|
|
7786
7801
|
const gemfileContent = await (0, import_fs_extra.readFile)(gemfilePath, "utf8");
|
|
@@ -7789,19 +7804,45 @@ async function bundleInstall(bundlePath, bundleDir, gemfilePath) {
|
|
|
7789
7804
|
gemfilePath,
|
|
7790
7805
|
gemfileContent.replace('ruby "~> 2.7.x"', 'ruby "~> 2.7.0"')
|
|
7791
7806
|
);
|
|
7807
|
+
} else if (gemfileContent.includes('ruby "~> 3.2.x"')) {
|
|
7808
|
+
await (0, import_fs_extra.writeFile)(
|
|
7809
|
+
gemfilePath,
|
|
7810
|
+
gemfileContent.replace('ruby "~> 3.2.x"', 'ruby "~> 3.2.0"')
|
|
7811
|
+
);
|
|
7792
7812
|
}
|
|
7793
|
-
|
|
7813
|
+
const bundlerEnv = (0, import_build_utils2.cloneEnv)(process.env, {
|
|
7814
|
+
// Ensure the correct version of `ruby` is in front of the $PATH
|
|
7815
|
+
PATH: `${(0, import_path2.dirname)(bundlePath)}:${process.env.PATH}`,
|
|
7816
|
+
BUNDLE_SILENCE_ROOT_WARNING: "1",
|
|
7817
|
+
BUNDLE_APP_CONFIG: bundleAppConfig,
|
|
7818
|
+
BUNDLE_JOBS: "4"
|
|
7819
|
+
});
|
|
7820
|
+
if (runtime === "ruby3.2") {
|
|
7821
|
+
const result2 = await (0, import_execa2.default)("bundler", ["add", "webrick"], {
|
|
7822
|
+
stdio: "pipe",
|
|
7823
|
+
env: bundlerEnv,
|
|
7824
|
+
reject: false
|
|
7825
|
+
});
|
|
7826
|
+
if (result2.exitCode !== 0) {
|
|
7827
|
+
console.log(result2.stdout);
|
|
7828
|
+
console.error(result2.stderr);
|
|
7829
|
+
throw result2;
|
|
7830
|
+
}
|
|
7831
|
+
}
|
|
7832
|
+
const result = await (0, import_execa2.default)(
|
|
7794
7833
|
bundlePath,
|
|
7795
7834
|
["install", "--deployment", "--gemfile", gemfilePath, "--path", bundleDir],
|
|
7796
7835
|
{
|
|
7797
7836
|
stdio: "pipe",
|
|
7798
|
-
env:
|
|
7799
|
-
|
|
7800
|
-
BUNDLE_APP_CONFIG: bundleAppConfig,
|
|
7801
|
-
BUNDLE_JOBS: "4"
|
|
7802
|
-
})
|
|
7837
|
+
env: bundlerEnv,
|
|
7838
|
+
reject: false
|
|
7803
7839
|
}
|
|
7804
7840
|
);
|
|
7841
|
+
if (result.exitCode !== 0) {
|
|
7842
|
+
console.log(result.stdout);
|
|
7843
|
+
console.error(result.stderr);
|
|
7844
|
+
throw result;
|
|
7845
|
+
}
|
|
7805
7846
|
}
|
|
7806
7847
|
var version = 3;
|
|
7807
7848
|
async function build({
|
|
@@ -7854,7 +7895,7 @@ async function build({
|
|
|
7854
7895
|
if (meta.avoidTopLevelInstall && fileAtRoot) {
|
|
7855
7896
|
(0, import_build_utils2.debug)("Skipping `bundle install` \u2014 already handled by Install Command");
|
|
7856
7897
|
} else {
|
|
7857
|
-
await bundleInstall(bundlerPath, bundleDir, gemfilePath);
|
|
7898
|
+
await bundleInstall(bundlerPath, bundleDir, gemfilePath, runtime);
|
|
7858
7899
|
}
|
|
7859
7900
|
}
|
|
7860
7901
|
} else {
|
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": "2.0.
|
|
4
|
+
"version": "2.0.3",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index",
|
|
7
7
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/fs-extra": "8.0.0",
|
|
19
19
|
"@types/semver": "6.0.0",
|
|
20
|
-
"@vercel/build-utils": "7.2.
|
|
21
|
-
"@vercel/ncc": "0.24.0",
|
|
20
|
+
"@vercel/build-utils": "7.2.5",
|
|
22
21
|
"execa": "2.0.4",
|
|
23
22
|
"fs-extra": "^7.0.1",
|
|
24
23
|
"jest-junit": "16.0.0",
|
|
@@ -27,6 +26,7 @@
|
|
|
27
26
|
"scripts": {
|
|
28
27
|
"build": "node ../../utils/build-builder.mjs",
|
|
29
28
|
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
|
30
|
-
"test-e2e": "pnpm test"
|
|
29
|
+
"test-e2e": "pnpm test",
|
|
30
|
+
"type-check": "tsc --noEmit"
|
|
31
31
|
}
|
|
32
32
|
}
|