Minor fixes

This commit is contained in:
2025-06-21 23:02:16 +03:00
parent 0965631664
commit dec67e94cb
2 changed files with 42 additions and 19 deletions

33
dev.fish Normal file
View File

@@ -0,0 +1,33 @@
set pipe_path /tmp/infin
set oldsum (cat (find . \( -name '*.rb' -o -name '*.js' \) | sort) | md5sum)
if not test -e infinsweeper.db
sqlite3 infinsweeper.db < schema.sql
end
if not test -e db.json
echo "{\"account_num\":0,\"pass_num\":0,\"signed_in_users\":{}}" > db.json
end
pkill ruby
ruby main.rb -p8080 &
echo "" > $pipe_path
while true
sleep 1
set newsum (cat (find . \( -name '*.rb' -o -name '*.js' \) | sort) | md5sum)
echo $newsum $oldsum
if test "$oldsum" != "$newsum"
set oldsum $newsum
pkill ruby
ruby main.rb -p8080 &
end
if set line (cat $pipe_path)
echo $line
if test "$line" = "die"
pkill ruby
echo "" > $pipe_path
exit
end
if test "$line" = "open"
echo "" > $pipe_path
xdg-open http://localhost:8080
end
end
end