Start using sinatra & ruby for backend
Signed-off-by: Syed Daanish <me@syedm.dev>
This commit is contained in:
31
run.fish
Normal file
31
run.fish
Normal file
@@ -0,0 +1,31 @@
|
||||
set pipe_path /tmp/infin
|
||||
set oldsum (cat (find . -name '*.rb' | sort) | md5sum)
|
||||
if not test -p infinsweeper.db
|
||||
sqlite3 infinsweeper.db < schema.sql
|
||||
end
|
||||
pkill ruby
|
||||
ruby main.rb -p8080 &
|
||||
if not test -p $pipe_path
|
||||
touch $pipe_path
|
||||
end
|
||||
while true
|
||||
sleep 1
|
||||
set newsum (cat (find . -name '*.rb' | sort) | md5sum)
|
||||
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
|
Reference in New Issue
Block a user