Commit Diff


commit - a1ff38e7714d72b4bbc719d1f9c575fc18a474ed
commit + 1089295496d18416b7f539d2ccce4714f733648c
blob - 0896a45076225f2350f9b0f4c72ff37cc072dc77
blob + f4aabcc6d1a6e8e53d41d199755d345992318a87
--- README.md
+++ README.md
@@ -48,13 +48,17 @@ just run <target>    # build and run a tool
 
 ## Deploying
 
-Builds and copies binaries to `$HOME/.local/bin`:
+Knit builds and copies binaries to `$HOME/.local/bin`:
 
 ```sh
-just deploy <target>
+knit deploy/<target>
+knit deploy/all      # build and install every tool
 ```
 
-`deploy mpd` installs the configured `mpd_*` binaries. Deployed Python tools
+The equivalent convenience wrapper is `just deploy <target>`.
+
+`knit deploy/mpd` (or `just deploy mpd`) installs the configured `mpd_*`
+binaries. Deployed Python tools
 (diggah, lazymaster, nts, shuffle) are thin shims that run out of this
 repository's `.venv`, and deployed Ruby tools (hue, reflink-snap) run
 straight from the checkout; both need the checkout to stay in place.
blob - 16155eeab5531a0310685212cc3a4cccdfe5b6b8
blob + c48fca2d085b5600a27ac258c7b032027ac1fece
--- justfile
+++ justfile
@@ -1,11 +1,6 @@
 knit := "knit"
 cargo := "cargo"
 
-deploy_dir := home_directory() / ".local/bin"
-
-# The MPD C binaries deployed under the umbrella name "mpd"
-mpd_bins := "mpd_add_to_playlist mpd_add_to_queue mpd_edit_queue mpd_update_library mpd_update_queue mpd_insert_next mpd_edit_playlist mpd_now_playing mpd_trim_queue mpd_report mpd_report_monthly"
-
 # Show this help message
 default:
     @just --list
@@ -14,7 +9,7 @@ default:
 all:
     {{ knit }} all
 
-# Build one or more tools, e.g. just build lazymaster
+# Build one or more tools
 build +targets:
     {{ knit }} {{ "bin/" + replace(targets, " ", " bin/") }}
 
@@ -24,17 +19,9 @@ run target *args:
 
 # Build and copy tools to ~/.local/bin
 deploy +targets:
-    @install -d -m 700 {{ deploy_dir }}
-    @for target in {{ targets }}; do \
-        case "$target" in mpd) bins="{{ mpd_bins }}" ;; *) bins="$target" ;; esac; \
-        for bin in $bins; do \
-            {{ knit }} bin/"$bin" && \
-            install -m 755 bin/"$bin" {{ deploy_dir }}/ && \
-            echo "deployed $bin to {{ deploy_dir }}"; \
-        done; \
-    done
+    {{ knit }} {{ "deploy/" + replace(targets, " ", " deploy/") }}
 
-# Run the native test suites (Rust, Zig, Go)
+# Run all test suites
 test:
     {{ cargo }} test --workspace
     cd pracomer && zig build test
@@ -63,5 +50,6 @@ cargo-lockfile:
 clean:
     {{ cargo }} clean
     for dir in pmn pracomer speediness; do rm -rf "$dir"/zig-out "$dir"/.zig-cache; done
+    for dir in hue; do rm -rf "$dir"/vendor; done
     find bin -type f -delete
     rm -rf .venv .knit .venv-stamp
blob - 9e9f7ddb5489025ed5c1191a8f4d23d36fc7ed24
blob + 66d8eab07b59e565113a3e88d207f891f343d06a
--- knitfile
+++ knitfile
@@ -1,7 +1,19 @@
-knit = require("knit")
+local knit = require("knit")
 
-root = knit.abs(".")
+local root = knit.abs(".")
+local deploy_dir = cli.deploy_dir or env.HOME .. "/.local/bin"
 
+rust_bins := bin/dam bin/lastfm_rs bin/plants
+zig_bins := bin/pmn bin/pracomer bin/speediness
+go_bins := bin/wrd
+python_bins := bin/diggah bin/lazymaster bin/nts bin/shuffle bin/kundali
+ruby_bins := bin/hue bin/reflink-snap
+mpd_queue_bins := bin/mpd_add_to_queue bin/mpd_edit_queue bin/mpd_update_queue bin/mpd_insert_next bin/mpd_trim_queue
+mpd_playlist_bins := bin/mpd_add_to_playlist bin/mpd_edit_playlist bin/mpd_update_library
+mpd_report_bins := bin/mpd_now_playing bin/mpd_report bin/mpd_report_monthly
+mpd_bins := $mpd_queue_bins $mpd_playlist_bins $mpd_report_bins
+bins := $rust_bins $zig_bins $go_bins $mpd_bins $python_bins $ruby_bins
+
 cflags := -std=c17 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wconversion -Wstrict-prototypes -O2 -march=native -mtune=native -fanalyzer -Wshadow -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE -Wformat -Werror=format-security -Wnull-dereference -Wdangling-pointer -Wtrampolines -Walloca -Wcast-align=strict -Wdate-time -Wfloat-equal -Wpointer-arith -Wredundant-decls -Wswitch-default -Wvla -Wwrite-strings
 ldflags := -lmpdclient -Wl,-z,relro -Wl,-z,now
 cc := /usr/bin/cc
@@ -103,13 +115,20 @@ $ bin/reflink-snap: reflink-snap/reflink-snap.rb
     printf '#!/bin/sh\nexec ruby "%s/reflink-snap/reflink-snap.rb" "$$@"\n' $root > $output
     chmod +x $output
 
-$ all:VB: bin/dam bin/lastfm_rs bin/plants \
-          bin/pmn bin/pracomer bin/speediness \
-          bin/wrd \
-          bin/mpd_add_to_playlist bin/mpd_add_to_queue bin/mpd_edit_queue \
-          bin/mpd_update_library bin/mpd_update_queue bin/mpd_insert_next \
-          bin/mpd_edit_playlist bin/mpd_now_playing bin/mpd_trim_queue \
-          bin/mpd_report bin/mpd_report_monthly \
-          bin/diggah bin/lazymaster bin/nts bin/shuffle bin/kundali \
-          bin/hue bin/reflink-snap
+$ all:VB: $bins
+
+$ deploy-dir:VB:
+    install -d -m 700 $deploy_dir
+
+$ deploy/all:VB: deploy-dir $bins
+    install -m 755 $bins $deploy_dir/
+    echo "deployed all tools to $deploy_dir"
+
+$ deploy/mpd:VB: deploy-dir $mpd_bins
+    install -m 755 $mpd_bins $deploy_dir/
+    echo "deployed mpd tools to $deploy_dir"
+
+$ deploy/%:VB: deploy-dir bin/%
+    install -m 755 bin/$match $deploy_dir/
+    echo "deployed $match to $deploy_dir"
 }