dev server: relative puzzle dirs, default bind 0.0.0.0

This commit is contained in:
Neale Pickett 2020-07-24 13:42:28 -06:00
parent 34155cef43
commit 6df57448ed
3 changed files with 2 additions and 30 deletions

View File

@ -1,27 +0,0 @@
#!/bin/sh
#
# Script to clone and start a development server
set -e
if [ -f tools/devel-server.py ]; then
cat <<EOM
This script is intended to be used to bootstrap a moth development server. It
looks like you're running the script from a moth repository working directory.
$ mkdir /tmp/moth
$ cd /tmp/moth
$ curl https://raw.githubusercontent.com/dirtbags/moth/master/devel.sh | sh
EOM
exit 1
fi
[ -d puzzles ] || mkdir -p puzzles
[ -d moth/bin ] || git clone https://github.com/dirtbags/moth.git
cd moth
puzzles="$(readlink -e ../puzzles)"
ln -sf "${puzzles}" puzzles
printf "\n[+] Place puzzles at ${puzzles} ...\n"
python3 tools/devel-server.py

View File

@ -262,7 +262,7 @@ if __name__ == '__main__':
'--theme', default='theme', '--theme', default='theme',
help="Directory containing theme files") help="Directory containing theme files")
parser.add_argument( parser.add_argument(
'--bind', default="127.0.0.1:8080", '--bind', default=":8080",
help="Bind to ip:port" help="Bind to ip:port"
) )
parser.add_argument( parser.add_argument(
@ -277,7 +277,7 @@ if __name__ == '__main__':
) )
args = parser.parse_args() args = parser.parse_args()
parts = args.bind.split(":") parts = args.bind.split(":")
addr = parts[0] or "0.0.0.0" addr = parts[0]
port = int(parts[1]) port = int(parts[1])
if args.verbose >= 2: if args.verbose >= 2:
log_level = logging.DEBUG log_level = logging.DEBUG

View File

@ -497,7 +497,6 @@ class Category:
with pushd(self.path): with pushd(self.path):
self.catmod.make(points, puzzle) self.catmod.make(points, puzzle)
else: else:
with pushd(self.path):
puzzle.read_directory(path) puzzle.read_directory(path)
return puzzle return puzzle