From 2a4165e9e03fac7fc000275b3d9a2280463a32be Mon Sep 17 00:00:00 2001 From: jutty Date: Sun, 8 Mar 2026 23:17:14 -0300 Subject: [PATCH] Better templating error message, container builds justfile recipes --- .justfile | 48 +++++++++++++++++++++++++++++++-- Cargo.lock | 4 +-- containers/build.sh | 4 +-- src/router/handlers/template.rs | 29 ++++++++++++++------ static/graph.toml | 12 +++++---- 5 files changed, 78 insertions(+), 19 deletions(-) diff --git a/.justfile b/.justfile index 62f4a15..54eeb91 100644 --- a/.justfile +++ b/.justfile @@ -20,6 +20,35 @@ run-watch: alias w := run-watch +# Build on changes +[group: 'develop'] +build-watch target=default_target: + @{{ watch_cmd }} {{ just_cmd }} build {{ target }} + +alias bw := build-watch + +# Build dev container +[group: 'develop', working-directory: 'containers'] +build-containerized distro="alpine": build + ./build.sh {{ distro }}-dev + +alias bc := build-containerized + +# Run dev container +[group: 'develop', working-directory: 'containers'] +run-containerized distro="alpine": + ./run.sh {{ distro }}-dev + +alias rc := run-containerized + +# Build dev container and serve from it on changes +[group: 'develop'] +run-watch-containerized: + @{{ watch_cmd }} "{{ just_cmd }} build-containerized \ + && {{ just_cmd }} run-containerized" + +alias wc := run-watch-containerized + [private] quick-assess: {{ just_cmd }} lint check quick-test-cover @@ -297,13 +326,28 @@ clean: alias cl := clean -# Build project with Cargo +# Build [group: 'build'] build target=default_target: cargo build --target {{ target }} --locked + alias b := build +# glibc build +[group: 'build'] +build-gnu: + cargo build --target {{ glibc_target }} --locked + +alias bg := build-gnu + +# musl build +[group: 'build'] +build-musl: + cargo build --target {{ musl_target }} --locked + +alias bm := build-musl + # Release build [group: 'build'] release-build target=default_target: @@ -314,7 +358,7 @@ alias rb := release-build # glibc release build [group: 'build'] release-build-gnu: - cargo build --target {{ glibc_target }} --locked --release + cargo build --target {{ glibc_target }} --locked --release alias rbg := release-build-gnu diff --git a/Cargo.lock b/Cargo.lock index 1b418d6..cad448a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -550,9 +550,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.182" +version = "0.2.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" +checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" [[package]] name = "libm" diff --git a/containers/build.sh b/containers/build.sh index 6e2338d..33a5816 100755 --- a/containers/build.sh +++ b/containers/build.sh @@ -9,9 +9,9 @@ if podman container exists "$tag"; then fi if [ "$suffix" = 'debian-dev' ]; then - cp -v ../target/x86_64-unknown-linux-gnu/release/en en + cp -v ../target/x86_64-unknown-linux-gnu/debug/en en elif [ "$suffix" = 'alpine-dev' ]; then - cp -v ../target/x86_64-unknown-linux-musl/release/en en + cp -v ../target/x86_64-unknown-linux-musl/debug/en en fi podman build \ diff --git a/src/router/handlers/template.rs b/src/router/handlers/template.rs index 72c1fb2..92a8041 100644 --- a/src/router/handlers/template.rs +++ b/src/router/handlers/template.rs @@ -53,7 +53,10 @@ pub(in crate::router::handlers) fn render( let tera = match tera::Tera::new("./templates/**/*") { Ok(t) => t, Err(e) => { - return (emergency_wrap(&e, "Failed instantiating template engine"), 500); + return ( + emergency_wrap(&e, "Failed instantiating template engine"), + 500, + ); }, }; @@ -103,8 +106,11 @@ fn emergency_wrap(error: &tera::Error, message: &str) -> String { \n\ \n\ en Pre-Templating Error\n - \n\ - \n\ + \n\ + \n\