summaryrefslogtreecommitdiff
path: root/justfile
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-07-27 19:03:49 -0700
committerFuwn <[email protected]>2024-07-27 19:03:49 -0700
commitefeff94b550651ab8f134e705b07b80c1c8faeba (patch)
treed345d0a0d5602cc01ee164a02a08b07bf97ecfd8 /justfile
downloadyuna-main.tar.xz
yuna-main.zip
feat: initial development buildHEADmain
Diffstat (limited to 'justfile')
-rw-r--r--justfile33
1 files changed, 33 insertions, 0 deletions
diff --git a/justfile b/justfile
new file mode 100644
index 0000000..2b85db7
--- /dev/null
+++ b/justfile
@@ -0,0 +1,33 @@
+run directory:
+ cd '{{directory}}' && gleam run
+
+watch directory:
+ #!/usr/bin/env sh
+
+ cd '{{directory}}'
+
+ start_gleam() {
+ gleam run &
+ }
+
+ stop_beam() {
+ BEAM_PID=$(pgrep -f beam.smp)
+
+ if [ -n "${BEAM_PID}" ]; then
+ kill "${BEAM_PID}"
+ wait "${BEAM_PID}" 2>/dev/null
+ fi
+ }
+
+ if ! command -v inotifywait >/dev/null; then
+ echo "error: inotifywait could not be found. please install inotify-tools."
+ exit 1
+ fi
+
+ start_gleam
+
+ while inotifywait -r -e modify,create,delete,move src; do
+ stop_beam
+ sleep 1
+ start_gleam
+ done