Skip to content

Commit

Permalink
wip: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohe-Am committed Dec 23, 2024
1 parent 096d02d commit d484493
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 32 deletions.
90 changes: 79 additions & 11 deletions .ghjk/lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": "4.0.1",
"buildDepConfigs": {
"cpy_bs_ghrel": {
"version": "3.12.7",
"version": "3.13.1",
"buildDepConfigs": {
"tar_aa": {
"version": "1.35",
Expand All @@ -38,7 +38,7 @@
"specifiedVersion": false
},
"bciqh4dfyevkzzvmnhuz7lcfqttkg5neg4ewhoxzofyuicavgk6pb7ia": {
"version": "3.12.7",
"version": "3.13.1",
"buildDepConfigs": {
"tar_aa": {
"version": "1.35",
Expand Down Expand Up @@ -72,7 +72,7 @@
"version": "3.9.0.0",
"buildDepConfigs": {
"cpy_bs_ghrel": {
"version": "3.12.7",
"version": "3.13.1",
"buildDepConfigs": {
"tar_aa": {
"version": "1.35",
Expand Down Expand Up @@ -117,7 +117,7 @@
"version": "3.31.0.1",
"buildDepConfigs": {
"cpy_bs_ghrel": {
"version": "3.12.7",
"version": "3.13.1",
"buildDepConfigs": {
"tar_aa": {
"version": "1.35",
Expand Down Expand Up @@ -247,6 +247,74 @@
"rust-src"
],
"specifiedVersion": true
},
"bciqeosxosr6ur7pu7gny33gy7dqubmxbcs4775xazb4zvaxavkd5rha": {
"version": "0.1.13",
"buildDepConfigs": {
"cargo_binstall_ghrel": {
"version": "v1.10.17",
"buildDepConfigs": {},
"portRef": "[email protected]",
"specifiedVersion": false
},
"rust_rustup": {
"version": "1.83.0",
"buildDepConfigs": {
"rustup_rustlang": {
"version": "1.27.1",
"buildDepConfigs": {
"git_aa": {
"version": "2.47.0",
"buildDepConfigs": {},
"portRef": "[email protected]",
"specifiedVersion": false
}
},
"portRef": "[email protected]",
"specifiedVersion": false
}
},
"portRef": "[email protected]",
"profile": "minimal",
"specifiedVersion": false
}
},
"portRef": "[email protected]",
"crateName": "tokio-console",
"specifiedVersion": false
},
"bciqeal5okt5zj763vhgsmf3afr5thrkqaitv6pb3wwegcwyb74gdyjq": {
"version": "v1.10.17",
"buildDepConfigs": {},
"portRef": "[email protected]",
"specifiedVersion": false
},
"bciqeub366wrduva4y3rxegdjkhlebwsud56e5orgcpbkdrbhuxmvuxa": {
"version": "1.83.0",
"buildDepConfigs": {
"rustup_rustlang": {
"version": "1.27.1",
"buildDepConfigs": {
"git_aa": {
"version": "2.47.0",
"buildDepConfigs": {},
"portRef": "[email protected]",
"specifiedVersion": false
}
},
"portRef": "[email protected]",
"specifiedVersion": false
}
},
"portRef": "[email protected]",
"profile": "minimal",
"specifiedVersion": false
},
"bciqe7g5m4v5jkg3ubqhogjjntsduyrwxcirqcp6tc3jmjr5af7ojq6a": {
"version": "v2.1.2",
"buildDepConfigs": {},
"portRef": "[email protected]",
"specifiedVersion": true
}
}
},
Expand All @@ -270,7 +338,7 @@
"bciqpu4klxr3hl6ujhmflrlfd3dxp47ijq26mnathb26ojzwkeggy5ii",
"bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji"
],
"allowedBuildDeps": "bciqoo3t36t4pphdox5wa5ugn34wkar7rwkqgb5l55lwnxbuabcc3nyq"
"allowedBuildDeps": "bciqe3wvwtylh2xeobipylsfxihnx5fhjixmozyxjsn6gnwk5vikvxxi"
},
"ghjkEnvProvInstSet____rust": {
"installs": [
Expand All @@ -282,7 +350,7 @@
"bciqpu4klxr3hl6ujhmflrlfd3dxp47ijq26mnathb26ojzwkeggy5ii",
"bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji"
],
"allowedBuildDeps": "bciqoo3t36t4pphdox5wa5ugn34wkar7rwkqgb5l55lwnxbuabcc3nyq"
"allowedBuildDeps": "bciqe3wvwtylh2xeobipylsfxihnx5fhjixmozyxjsn6gnwk5vikvxxi"
},
"ghjkEnvProvInstSet___dev": {
"installs": [
Expand All @@ -296,7 +364,7 @@
"bciqpu4klxr3hl6ujhmflrlfd3dxp47ijq26mnathb26ojzwkeggy5ii",
"bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji"
],
"allowedBuildDeps": "bciqoo3t36t4pphdox5wa5ugn34wkar7rwkqgb5l55lwnxbuabcc3nyq"
"allowedBuildDeps": "bciqe3wvwtylh2xeobipylsfxihnx5fhjixmozyxjsn6gnwk5vikvxxi"
},
"ghjkEnvProvInstSet_______task_env_cache-v8": {
"installs": [],
Expand Down Expand Up @@ -509,7 +577,7 @@
"moduleSpecifier": "file:///ports/deno_ghrel.ts"
}
},
"bciqakxf4wsx3mtku4x5exrl44k4r4kyq6gaw4va5hsb3v26cipmmekq": {
"bciqdfarczmlu3r5dkvcdoultfbnuvn6saao55h4fbb3jg72kv6mkr3y": {
"manifest": {
"ty": "denoWorker@v1",
"name": "cpy_bs_ghrel",
Expand All @@ -533,7 +601,7 @@
"moduleSpecifier": "file:///ports/cpy_bs.ts"
},
"defaultInst": {
"version": "3.12.7",
"version": "3.13.1",
"portRef": "[email protected]"
}
},
Expand Down Expand Up @@ -805,8 +873,8 @@
"portRef": "[email protected]"
}
},
"bciqoo3t36t4pphdox5wa5ugn34wkar7rwkqgb5l55lwnxbuabcc3nyq": {
"cpy_bs_ghrel": "bciqakxf4wsx3mtku4x5exrl44k4r4kyq6gaw4va5hsb3v26cipmmekq",
"bciqe3wvwtylh2xeobipylsfxihnx5fhjixmozyxjsn6gnwk5vikvxxi": {
"cpy_bs_ghrel": "bciqdfarczmlu3r5dkvcdoultfbnuvn6saao55h4fbb3jg72kv6mkr3y",
"tar_aa": "bciqb6ua63xodzwxngnbjq35hfikiwzb3dclbqkc7e6xgjdt5jin4pia",
"git_aa": "bciqfl5s36w335ducrb6f6gwb3vuwup7vzqwwg67pq42xtkngsnxqobi",
"curl_aa": "bciqcfe7qyxmokpn6pgtaj35r5qg74jkehuu6cvyrtcsnegvwlm64oqy",
Expand Down
2 changes: 1 addition & 1 deletion ghjk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { unarchive } from "./utils/unarchive.ts";
config({
defaultEnv: "dev",
enableRuntimes: true,
allowedBuildDeps: [ports.cpy_bs({ version: "3.12.7" })],
allowedBuildDeps: [ports.cpy_bs({ version: "3.13.1" })],
});

env("main").vars({
Expand Down
2 changes: 1 addition & 1 deletion src/ghjk/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub async fn cli() -> Res<std::process::ExitCode> {

let mut root_cmd = Cli::command();

debug!("colleting system commands");
debug!("collecting system commands");

let (sys_cmds, sys_actions) = match commands_from_systems(&systems).await {
Ok(val) => val,
Expand Down
11 changes: 8 additions & 3 deletions src/ghjk/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,14 @@ hash.json",
};
}
if let Some(path) = repo_root {
self.repo_root = deno_core::resolve_url_or_path(&path, cwd)
.map_err(|err| ferr!(Box::new(err)))
.wrap_err("error resolving repo_root")?;
self.repo_root = dbg!(
deno_core::resolve_url_or_path(&path, cwd)
.map_err(|err| ferr!(Box::new(err)))
.wrap_err("error resolving repo_root")?,
&path,
cwd
)
.0;
}
Ok(())
}
Expand Down
16 changes: 8 additions & 8 deletions src/ghjk/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ Args: {args:?}
let filter = tracing_subscriber::EnvFilter::from_default_env();

tracing_subscriber::registry()
.with(console_subscriber::spawn())
// filter on values from RUST_LOG
.with(filter)
// subscriber that emits to stderr
.with(fmt)
// instrument errors with SpanTraces, used by color-eyre
.with(tracing_error::ErrorLayer::default())
.init();
.with(console_subscriber::spawn())
// filter on values from RUST_LOG
.with(filter)
// subscriber that emits to stderr
.with(fmt)
// instrument errors with SpanTraces, used by color-eyre
.with(tracing_error::ErrorLayer::default())
.init();
// console_subscriber::init();
});
}
15 changes: 10 additions & 5 deletions src/ghjk/systems/deno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,20 @@ pub async fn systems_from_deno(

let dcx = gcx.deno.clone();
let join_exit_code_watcher = tokio::spawn(async {
let err = match exit_code_channel.await.expect_or_log("channel error") {
Ok(0) => return Ok(()),
Ok(exit_code) => {
let err = match exit_code_channel.await {
Ok(Ok(0)) => return Ok(()),
Ok(Ok(exit_code)) => {
ferr!("deno systems died with non-zero exit code: {exit_code}")
}
Err(err) => err.wrap_err("error on event loop for deno systems"),
Ok(Err(err)) => err.wrap_err("error on event loop for deno systems"),
Err(_) => {
ferr!("deno systems unexpected shutdown")
}
};
error!("deno systems error: {err:?}");
dcx.terminate().await.expect_or_log("error terminating deno worker");
dcx.terminate()
.await
.expect_or_log("error terminating deno worker");
Err(err)
});

Expand Down
1 change: 1 addition & 0 deletions tests/envs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ghjk_deactivate
[ "$GHJK_ENV" = "main" ] && exit 1022
ghjk envs cook sss
echo $?
. .ghjk/envs/sss/activate.sh
# by default, envs should be based on main
# so they should inherit it's env vars
Expand Down
13 changes: 10 additions & 3 deletions tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,20 @@ export async function localE2eTest(testCase: E2eTestCase) {
);

const ghjkExePath = $.path(import.meta.resolve("../target/debug/ghjk"));
const ghjkShimPath = await ghjkDataDir
.join("ghjk")
.writeText(
`!#/bin/sh
exec ${ghjkExePath.resolve().toString()} "$@"`,
{ mode: 0o700 },
);

const env: Record<string, string | undefined> = {
GHJK_AUTO_HOOK: "true",
BASH_ENV: `${ghjkDataDir.toString()}/env.bash`,
ZDOTDIR: ghjkDataDir.toString(),
GHJK_DATA_DIR: ghjkDataDir.toString(),
PATH: `${ghjkExePath.parentOrThrow().toString()}:${Deno.env.get("PATH")}`,
PATH: `${ghjkShimPath.parentOrThrow().toString()}:${Deno.env.get("PATH")}`,
HOME: tmpDir.toString(),
GHJK_REPO_ROOT: import.meta.resolve("../"),
// share the system's deno cache
Expand All @@ -151,11 +158,11 @@ export async function localE2eTest(testCase: E2eTestCase) {
shellsToHook: [],
});

await $`${ghjkExePath} print config`
await $`ghjk print config`
.cwd(tmpDir.toString())
.clearEnv()
.env(env);
await $`${ghjkExePath} envs cook`
await $`ghjk envs cook`
.cwd(tmpDir.toString())
.clearEnv()
.env(env);
Expand Down

0 comments on commit d484493

Please sign in to comment.