Skip to content

Commit 8588514

Browse files
authored
Merge pull request #12 from pkgxdev/integration-test
check we… like… work
2 parents 871c0b0 + d649ef5 commit 8588514

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,10 @@ jobs:
2121
- run: deno fmt --check .
2222
- run: deno lint .
2323
- run: deno check ./pkgm.ts
24+
25+
test:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: pkgxdev/setup@v3
30+
- run: ./pkgm.ts i git

pkgm.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ import { ensureDir, existsSync } from "jsr:@std/fs@^1";
44
import { parse as parse_args } from "jsr:@std/flags@0.224.0";
55
import * as semver from "jsr:@std/semver@^1";
66

7-
const standardPath = (() => {
7+
function standardPath() {
88
const basePath = "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";
9+
// for pkgm installed via homebrew
910
const homebrew = `${Deno.env.get("HOMEBREW_PREFIX") || "/opt/homebrew"}/bin`;
10-
if (existsSync(homebrew)) {
11+
if (Deno.build.os === "darwin") {
1112
return `${homebrew}:${basePath}`;
1213
} else {
1314
return basePath;
1415
}
15-
})();
16+
}
1617

1718
const parsedArgs = parse_args(Deno.args, {
1819
alias: {
@@ -28,7 +29,7 @@ if (parsedArgs.help) {
2829
args: ["gh", "repo", "view", "pkgxdev/pkgm"],
2930
clearEnv: true,
3031
env: {
31-
"PATH": standardPath,
32+
"PATH": standardPath(),
3233
"HOME": Deno.env.get("HOME")!,
3334
},
3435
}).spawn().status;
@@ -79,7 +80,7 @@ async function install(args: string[]) {
7980
args = args.map((x) => `+${x}`);
8081

8182
const env: Record<string, string> = {
82-
"PATH": standardPath,
83+
"PATH": standardPath(),
8384
};
8485
const set = (key: string) => {
8586
const x = Deno.env.get(key);

0 commit comments

Comments
 (0)