Add configuration-File support.

This commit is contained in:
Frank Agerholm 2024-12-04 21:44:12 +01:00
commit ce035d9186
No known key found for this signature in database
3 changed files with 73 additions and 10 deletions

View file

@ -1,18 +1,59 @@
#!/bin/sh
if ! test -d website
# Default configurations:
DEPLOY_HELPER_ENABLE_NIKOLA=true
DEPLOY_HELPER_ENABLE_NODE=false
if test -f .deployment-helper
then
echo "Website directory not found"
exit 1
# shellcheck source=/dev/null
. .deployment-helper
fi
if ! command -v nikola >/dev/null 2>&1
if $DEPLOY_HELPER_ENABLE_NODE
then
echo "nikola command not found"
exit 1
if ! command -v node >/dev/null 2>&1
then
echo "node not found" 1>&2
exit 1
fi
if ! command -v npm >/dev/null 2>&1
then
echo "npm not found" 1>&2
exit 1
fi
if ! test -d node
then
echo "Node directory not found" 1>&2
exit 1
fi
cd node || { echo 'Directory "node" not found'; exit 1;}
if ! npm install
then
echo "Error installing node-dependencies" 1>&2
exit 1
fi
cd ..
fi
cd website
if $DEPLOY_HELPER_ENABLE_NIKOLA
then
if ! test -d website
then
echo "Website directory not found" 1>&2
exit 1
fi
nikola build
if ! command -v nikola >/dev/null 2>&1
then
echo "nikola command not found" 1>&2
exit 1
fi
cd website || { echo 'Directory "website" not found'; exit 1;}
nikola build
cd ..
fi
exit "$?"