31 lines
704 B
Fish
31 lines
704 B
Fish
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
|
|
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
|