Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/cmd/build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { gum, rsync } from "brewkit/utils.ts"
import fix_up from "brewkit/porcelain/fix-up.ts"
import { Command } from "cliffy/command/mod.ts"
import fetch from "brewkit/porcelain/fetch.ts"
import get_config from "brewkit/config.ts"
import get_config, { platform_cache } from "brewkit/config.ts"
import { Path, hooks, utils } from "pkgx"
import * as YAML from "deno/yaml/mod.ts"
const { useConfig } = hooks
Expand Down Expand Up @@ -121,6 +121,8 @@ if (env['GITHUB_TOKEN']) {
env['GH_TOKEN'] = env['GITHUB_TOKEN']
}

platform_cache(() => config.path.home).mkdir('p') // we’ve indeed found things to break without this

const proc = new Deno.Command(script.string, {clearEnv: true, env}).spawn()
const rv = await proc.status
if (!rv.success) throw new Error(`${rv.code} ${rv.signal}`)
Expand Down
4 changes: 3 additions & 1 deletion bin/cmd/test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { Package, PackageRequirement, Path, hooks, utils } from "pkgx"
import { gum, find_pkgx, rsync, find_in_PATH } from "brewkit/utils.ts"
import get_config from "brewkit/config.ts"
import get_config, { platform_cache } from "brewkit/config.ts"
import * as YAML from "deno/yaml/mod.ts"
import undent from "outdent"
import useConfig from "libpkgx/hooks/useConfig.ts";
Expand Down Expand Up @@ -99,6 +99,8 @@ if (env['GITHUB_TOKEN']) {
env['GH_TOKEN'] = env['GITHUB_TOKEN']
}

platform_cache(() => config.path.home).mkdir('p') // we’ve indeed found things to break without this

const proc = new Deno.Command(script.string, {clearEnv: true, env}).spawn()
const rv = await proc.status
if (!rv.success) throw new Error(`${rv.code} ${rv.signal}`)
4 changes: 2 additions & 2 deletions lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ export default async function config(arg?: string): Promise<Config> {
}
}

function platform_cache() {
export function platform_cache(home = Path.home) {
return flatmap(Deno.env.get('XDG_CACHE_HOME'), Path.abs) ?? (platform =>
platform == 'darwin' ? Path.home().join('Library/Caches') : Path.home().join(".cache")
platform == 'darwin' ? home().join('Library/Caches') : home().join(".cache")
)(host().platform)
}

Expand Down
8 changes: 7 additions & 1 deletion projects/version-transformer.com/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ build:
echo {{version}} > VERSION

test:
test $(cat {{prefix}}/VERSION) = {{version}}
- test $(cat {{prefix}}/VERSION) = {{version}}

# test that cache directories are created in our sandbox
- run: touch ~/.cache/foo
if: linux
- run: touch ~/Library/Caches/foo
if: darwin