1
0
Fork 0
forked from ilot/ilot-io

test-server.sh: move under tools

This commit is contained in:
Antoine Martin 2024-09-17 15:00:22 -04:00
parent b468943328
commit d0dc2ae971
Signed by: ayakael
GPG key ID: D62A472A4AA7D541
3 changed files with 11 additions and 7 deletions

2
.gitignore vendored
View file

@ -1,3 +1,3 @@
content/.ikiwiki content/.ikiwiki
public/ public/
http-server/ tools/http-server/

View file

@ -101,7 +101,7 @@ timezone: :/etc/localtime
# regexp of normally excluded files to include # regexp of normally excluded files to include
#include: ^\.htaccess$ #include: ^\.htaccess$
# regexp of files that should be skipped # regexp of files that should be skipped
#exclude: ^(*\.private|Makefile)$ exclude: ^(tools/.*|)$
# specifies the characters that are allowed in source filenames # specifies the characters that are allowed in source filenames
wiki_file_chars: -[:alnum:]+/.:_ wiki_file_chars: -[:alnum:]+/.:_
# allow symlinks in the path leading to the srcdir (potentially insecure) # allow symlinks in the path leading to the srcdir (potentially insecure)

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
for i in node npm git; do for i in node npm git; do
if ! command -v $i &> /dev/null; then if ! command -v $i &> /dev/null; then
echo ">> $i could not be found, please install" echo ">> $i could not be found, please install"
@ -8,7 +10,7 @@ for i in node npm git; do
done done
# http-server not pulled, pulling # http-server not pulled, pulling
if [ ! -d "./http-server" ]; then if [ ! -d "$SCRIPT_DIR/http-server" ]; then
echo ">> This script will pull a lightweight nodejs http-server from https://github.com/http-party/http-server and make ./public avaiable as local http service, are you okay with this?" echo ">> This script will pull a lightweight nodejs http-server from https://github.com/http-party/http-server and make ./public avaiable as local http service, are you okay with this?"
read -p "Continue (y/n)?" choice read -p "Continue (y/n)?" choice
case "$choice" in case "$choice" in
@ -20,17 +22,19 @@ if [ ! -d "./http-server" ]; then
fi fi
# http-server depends not pulled, pulling # http-server depends not pulled, pulling
if [ ! -d "http-server/node_modules/" ]; then if [ ! -d "$SCRIPT_DIR/http-server/node_modules/" ]; then
echo ">> http-server dependencies not pulled, pulling" echo ">> http-server dependencies not pulled, pulling"
npm --prefix ./http-server i npm --prefix "$SCRIPT_DIR"/http-server i
fi fi
# website not built, building # website not built, building
if [ ! -d "./public" ]; then if [ ! -d "$SCRIPT_DIR/../public" ]; then
echo ">> website not build, building" echo ">> website not build, building"
pushd "$SCRIPT_DIR"/..
ikiwiki --setup ./ikiwiki.setup ikiwiki --setup ./ikiwiki.setup
popd
fi fi
# starting server # starting server
echo ">> starting http server" echo ">> starting http server"
node ./http-server/bin/http-server -c-1 ./public node "$SCRIPT_DIR"/http-server/bin/http-server -c-1 "$SCRIPT_DIR"/../public