Skip to content

Commit 0b32c24

Browse files
authored
Merge pull request #32 from avsm/custom-repo-refactor
Simplify custom repository
2 parents 26b0ce2 + 88145d8 commit 0b32c24

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

lib/index.js

Lines changed: 4 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/installer.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ function getOpamDownloadUrl(version: string, filename: string) {
2626

2727
async function acquireOpamWindows(version: string, customRepository: string) {
2828
const repository =
29-
customRepository === ""
30-
? "https://github.com/fdopen/opam-repository-mingw.git#opam2"
31-
: customRepository;
29+
customRepository ||
30+
"https://github.com/fdopen/opam-repository-mingw.git#opam2";
31+
3232
let downloadPath;
3333
try {
3434
downloadPath = await tc.downloadTool("https://cygwin.com/setup-x86_64.exe");
@@ -57,9 +57,8 @@ async function acquireOpamLinux(version: string, customRepository: string) {
5757
const fileName = getOpamFileName(opamVersion);
5858
const downloadUrl = getOpamDownloadUrl(opamVersion, fileName);
5959
const repository =
60-
customRepository === ""
61-
? "https://github.com/ocaml/opam-repository.git"
62-
: customRepository;
60+
customRepository || "https://github.com/ocaml/opam-repository.git";
61+
6362
let downloadPath;
6463
try {
6564
downloadPath = await tc.downloadTool(downloadUrl);
@@ -85,9 +84,8 @@ async function acquireOpamLinux(version: string, customRepository: string) {
8584

8685
async function acquireOpamDarwin(version: string, customRepository: string) {
8786
const repository =
88-
customRepository === ""
89-
? "https://github.com/ocaml/opam-repository.git"
90-
: customRepository;
87+
customRepository || "https://github.com/ocaml/opam-repository.git";
88+
9189
await exec("brew", ["install", "opam"]);
9290
await exec("opam", ["init", "-yav", repository]);
9391
await exec(path.join(__dirname, "install-ocaml-unix.sh"), [version]);

0 commit comments

Comments
 (0)