al-quran.reflectslight.io/bin/setup

60 lines
1 KiB
Text
Raw Normal View History

2024-06-22 06:47:55 +02:00
#!/bin/sh
set -e
##
# functions
printok()
{
echo "ok: ${1}" > /dev/stdout
}
printerr()
{
2024-06-22 06:48:50 +02:00
echo "error: ${1}" > /dev/stderr
2024-06-22 06:47:55 +02:00
}
require_dependency()
{
2024-08-21 00:20:35 +02:00
local cmd
2024-06-22 06:47:55 +02:00
for i in $(seq 1 $#); do
eval "cmd=\$${i}"
2024-08-21 00:20:35 +02:00
if which "${cmd}" > /dev/null 2>&1; then
2024-06-22 06:47:55 +02:00
printok "${cmd} found"
else
printerr "${cmd} is required but was not found on \$PATH"
exit 1
fi
done
}
2024-05-02 13:04:35 +02:00
##
# main
2024-06-22 06:47:55 +02:00
require_dependency git bundle npm
2024-05-02 13:23:02 +02:00
git submodule update -f --init --recursive
2024-06-22 06:47:55 +02:00
printok "submodules checked out"
2024-05-02 13:04:35 +02:00
bundle install
2024-06-22 06:47:55 +02:00
printok "ruby dependencies installed"
2024-05-02 13:04:35 +02:00
npm i
2024-06-22 06:47:55 +02:00
printok "nodejs dependencies installed"
2024-08-21 00:20:35 +02:00
if [ ! -e "nanoc.yaml" ]; then
cp nanoc.yaml.sample nanoc.yaml
printok "nanoc.yaml.sample -> nanoc.yaml"
fi
found=0
for t in tidy tidy5; do
if which ${t} > /dev/null 2>&1; then
found=1
break
2024-08-21 00:20:35 +02:00
fi
done
if [ "${found}" = "1" ]; then
printok "tidy-html5 found"
else
printerr "tidy-html5 is required but was not found on \$PATH"
fi