mascarpone/Taskfile

47 lines
899 B
Text
Raw Normal View History

2025-11-27 13:45:21 -06:00
#!/usr/bin/env bash
playwright:local() {
bash e2e/Taskfile playwright:local
}
playwright:ui() {
bash e2e/Taskfile playwright:ui
}
refresh_sqlx_db() {
rm -f some_user.db
for migration in migrations/each_user/*.sql; do
echo "Applying $migration..."
sqlite3 some_user.db < "$migration"
done
}
2025-12-01 15:23:56 -06:00
_env() {
refresh_sqlx_db > /dev/null
DATABASE_URL=sqlite:some_user.db \
CACHE_BUST_ASSETS_DIR=static \
"$@"
}
_cargo() {
_env cargo "$@"
}
edit() {
_env nvim
}
2025-11-27 13:45:21 -06:00
deploy_to_server() {
where="$1"
2025-12-01 15:23:56 -06:00
_cargo build --release
2025-11-27 13:45:21 -06:00
rsync -v -essh ./target/release/mascarpone "$where:~" \
2025-12-01 22:10:28 -06:00
&& rsync -rav -essh ./hashed_static "$where:~/" \
&& ssh -t "$where" "sudo mv -f mascarpone /usr/bin/ && sudo rm -rf /var/local/mascarpone/hashed_static && sudo mv -f hashed_static /var/local/mascarpone/ && sudo systemctl restart mascarpone"
2025-11-27 13:45:21 -06:00
}
2025-11-28 17:05:06 -06:00
dev() {
2025-12-01 15:23:56 -06:00
_cargo run -- serve
2025-11-28 17:05:06 -06:00
}
2025-11-27 13:45:21 -06:00
"$@"