al-quran.reflectslight.io/bin/setup
2024-08-27 10:15:03 -03:00

59 lines
999 B
Bash
Executable file

#!/bin/sh
set -e
##
# functions
printok()
{
echo "ok: ${1}"
}
printerr()
{
echo "error: ${1}"
}
require_dependency()
{
local cmd
for i in $(seq 1 $#); do
eval "cmd=\$${i}"
if which "${cmd}" > /dev/null 2>&1; then
printok "${cmd} found"
else
printerr "${cmd} is required but was not found on \$PATH"
exit 1
fi
done
}
##
# main
require_dependency git bundle npm
git submodule update -f --init --recursive
printok "submodules checked out"
bundle install
printok "ruby dependencies installed"
npm i
printok "nodejs dependencies installed"
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
fi
done
if [ "${found}" = "1" ]; then
printok "tidy-html5 found"
else
printerr "tidy-html5 is required but was not found on \$PATH"
fi