summaryrefslogtreecommitdiff
path: root/Justfile
diff options
context:
space:
mode:
Diffstat (limited to 'Justfile')
-rw-r--r--Justfile67
1 files changed, 55 insertions, 12 deletions
diff --git a/Justfile b/Justfile
index fb24e36..37add68 100644
--- a/Justfile
+++ b/Justfile
@@ -1,4 +1,5 @@
# Witryna development tasks
+version := `grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/'`
# List available recipes
default:
@@ -34,7 +35,41 @@ lint-picky:
cargo clippy --all-targets --all-features -- -W clippy::pedantic -W clippy::nursery -W clippy::unwrap_used -W clippy::expect_used -W clippy::panic -W clippy::indexing_slicing -W clippy::clone_on_ref_ptr -W clippy::print_stdout -W clippy::print_stderr
# Run all lints
-lint: lint-rust lint-yaml lint-secrets
+lint: lint-rust lint-yaml lint-secrets check-version
+
+# --- Version ---
+
+# Verify all files match Cargo.toml version
+check-version:
+ #!/usr/bin/env bash
+ set -euo pipefail
+ v="{{version}}"
+ # Arch pkgver: strip pre-release punctuation (0.2.0-rc.1 → 0.2.0rc1)
+ pkgver=$(echo "$v" | sed 's/-\([a-z]*\)\./\1/')
+ tag="v${v}"
+ ok=true
+ check() { grep -qF "$2" "$1" || { echo "MISMATCH: $1 missing '$2'"; ok=false; }; }
+ check arch/PKGBUILD "pkgver=${pkgver}"
+ check arch/PKGBUILD "_tag=${tag}"
+ check man/witryna.1 "witryna ${v}\""
+ check man/witryna.1 "${tag}"
+ check man/witryna.toml.5 "witryna ${v}\""
+ $ok && echo "All versions match Cargo.toml: ${v}" || { echo "Run 'just bump-version' to fix"; exit 1; }
+
+# Sync version in packaging/doc files to match Cargo.toml
+bump-version:
+ #!/usr/bin/env bash
+ set -euo pipefail
+ v="{{version}}"
+ pkgver=$(echo "$v" | sed 's/-\([a-z]*\)\./\1/')
+ tag="v${v}"
+ echo "Syncing to ${v} (pkgver=${pkgver}, tag=${tag})"
+ sed -i "s/^pkgver=.*/pkgver=${pkgver}/" arch/PKGBUILD
+ sed -i "s/^_tag=.*/_tag=${tag}/" arch/PKGBUILD
+ sed -i "1s/\"witryna [^\"]*\"/\"witryna ${v}\"/" man/witryna.1
+ sed -i "1s/\"witryna [^\"]*\"/\"witryna ${v}\"/" man/witryna.toml.5
+ sed -i '/^\.SH VERSION$/,/^\.SH /{s/^v.*/'"${tag}"'/}' man/witryna.1
+ echo "Done. Remaining manual updates: CHANGELOG.md, README.md"
# --- Testing ---
@@ -59,16 +94,6 @@ test-all: lint test test-integration
build-release:
cargo build --release
-# --- Man pages ---
-
-# View witryna(1) man page (run `cargo build` first)
-man-1:
- man -l target/man/witryna.1
-
-# View witryna.toml(5) man page
-man-5:
- man -l man/witryna.toml.5
-
# --- Packaging ---
# Build Debian package
@@ -100,6 +125,24 @@ inspect-rpm:
echo "" && echo "=== Config files ===" && rpm -qcp "$rpm"
echo "" && echo "=== Scripts ===" && rpm -q --scripts -p "$rpm"
+# Test PKGBUILD locally (requires makepkg)
+build-arch:
+ cd arch && makepkg -sf
+
+# Build Nix package (requires nix with flakes)
+build-nix:
+ nix build .#witryna
+
+# Show contents of built Arch package
+inspect-arch:
+ #!/usr/bin/env bash
+ set -euo pipefail
+ pkg=$(find arch -name 'witryna-*.pkg.tar.zst' 2>/dev/null | head -1)
+ if [[ -z "$pkg" ]]; then echo "No .pkg.tar.zst found — run 'just build-arch' first" >&2; exit 1; fi
+ echo "=== Info ===" && pacman -Qip "$pkg"
+ echo "" && echo "=== Contents ===" && pacman -Qlp "$pkg"
+ echo "" && echo "=== Backup files ===" && pacman -Qip "$pkg" | grep -A99 "^Backup Files"
+
# --- Release ---
RELEASE_HOST := "git@sandcrawler"
@@ -117,7 +160,7 @@ build-tarball: build-release
cp target/release/witryna "$staging/"
cp examples/witryna.toml "$staging/"
cp debian/witryna.service "$staging/"
- cp target/man/witryna.1 "$staging/"
+ cp man/witryna.1 "$staging/"
cp man/witryna.toml.5 "$staging/"
cp README.md "$staging/"
cp examples/hooks/caddy-deploy.sh "$staging/examples/hooks/"