test-server.sh: add test-server script for local development
This commit is contained in:
parent
1bb95607f8
commit
7336a33858
1 changed files with 36 additions and 0 deletions
36
test-server.sh
Executable file
36
test-server.sh
Executable file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
for i in node npm git; do
|
||||||
|
if ! command -v $i &> /dev/null; then
|
||||||
|
echo ">> $i could not be found, please install"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# http-server not pulled, pulling
|
||||||
|
if [ ! -d "./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?"
|
||||||
|
read -p "Continue (y/n)?" choice
|
||||||
|
case "$choice" in
|
||||||
|
y|Y ) echo "yes";;
|
||||||
|
n|N ) echo "no";;
|
||||||
|
* ) echo "invalid";;
|
||||||
|
esac
|
||||||
|
git clone https://github.com/http-party/http-server
|
||||||
|
fi
|
||||||
|
|
||||||
|
# http-server depends not pulled, pulling
|
||||||
|
if [ ! -d "http-server/node_modules/" ]; then
|
||||||
|
echo ">> http-server dependencies not pulled, pulling"
|
||||||
|
npm --prefix ./http-server i
|
||||||
|
fi
|
||||||
|
|
||||||
|
# website not built, building
|
||||||
|
if [ ! -d "./public" ]; then
|
||||||
|
echo ">> website not build, building"
|
||||||
|
ikiwiki --setup ./ikiwiki.setup
|
||||||
|
fi
|
||||||
|
|
||||||
|
# starting server
|
||||||
|
echo ">> starting http server"
|
||||||
|
node ./http-server/bin/http-server -c-1 ./public
|
Loading…
Reference in a new issue