mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-10 14:29:15 +00:00
shellcheck fixes
This commit is contained in:
69
tests-ng/template-link-value.sh
vendored
69
tests-ng/template-link-value.sh
vendored
@@ -28,30 +28,33 @@ cur=$(dirname "$(${rl} "${0}")")
|
||||
# dotdrop path can be pass as argument
|
||||
ddpath="${cur}/../"
|
||||
[ "${1}" != "" ] && ddpath="${1}"
|
||||
[ ! -d ${ddpath} ] && echo "ddpath \"${ddpath}\" is not a directory" && exit 1
|
||||
[ ! -d "${ddpath}" ] && echo "ddpath \"${ddpath}\" is not a directory" && exit 1
|
||||
|
||||
export PYTHONPATH="${ddpath}:${PYTHONPATH}"
|
||||
bin="python3 -m dotdrop.dotdrop"
|
||||
hash coverage 2>/dev/null && bin="coverage run -a --source=dotdrop -m dotdrop.dotdrop" || true
|
||||
if hash coverage 2>/dev/null; then
|
||||
bin="coverage run -a --source=dotdrop -m dotdrop.dotdrop"
|
||||
fi
|
||||
|
||||
echo "dotdrop path: ${ddpath}"
|
||||
echo "pythonpath: ${PYTHONPATH}"
|
||||
|
||||
# get the helpers
|
||||
source ${cur}/helpers
|
||||
# shellcheck source=tests-ng/helpers
|
||||
source "${cur}"/helpers
|
||||
|
||||
echo -e "$(tput setaf 6)==> RUNNING $(basename $BASH_SOURCE) <==$(tput sgr0)"
|
||||
echo -e "$(tput setaf 6)==> RUNNING $(basename "${BASH_SOURCE[0]}") <==$(tput sgr0)"
|
||||
|
||||
################################################################
|
||||
# this is the test
|
||||
################################################################
|
||||
|
||||
# the dotfile source
|
||||
tmps=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
|
||||
mkdir -p ${tmps}/dotfiles
|
||||
tmps=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d)
|
||||
mkdir -p "${tmps}"/dotfiles
|
||||
echo "dotfiles source (dotpath): ${tmps}"
|
||||
# the dotfile destination
|
||||
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
|
||||
tmpd=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d)
|
||||
echo "dotfiles destination: ${tmpd}"
|
||||
|
||||
clear_on_exit "${tmps}"
|
||||
@@ -60,7 +63,7 @@ clear_on_exit "${tmpd}"
|
||||
# create the config file
|
||||
cfg="${tmps}/config.yaml"
|
||||
|
||||
cat > ${cfg} << _EOF
|
||||
cat > "${cfg}" << _EOF
|
||||
config:
|
||||
backup: true
|
||||
create: true
|
||||
@@ -115,38 +118,38 @@ _EOF
|
||||
#cat ${cfg}
|
||||
|
||||
# create the dotfile
|
||||
echo "filea" > ${tmps}/dotfiles/a
|
||||
echo "fileb" > ${tmps}/dotfiles/b
|
||||
echo "filec" > ${tmps}/dotfiles/c
|
||||
echo "filed" > ${tmps}/dotfiles/d
|
||||
mkdir -p ${tmps}/dotfiles/e/{1,2,3}
|
||||
echo filee > ${tmps}/dotfiles/e/1/file
|
||||
echo filee > ${tmps}/dotfiles/e/2/file
|
||||
echo filee > ${tmps}/dotfiles/e/3/file
|
||||
mkdir -p ${tmps}/dotfiles/f/{1,2,3}
|
||||
echo filee > ${tmps}/dotfiles/f/1/file
|
||||
echo filee > ${tmps}/dotfiles/f/2/file
|
||||
echo filee > ${tmps}/dotfiles/f/3/file
|
||||
echo "filea" > "${tmps}"/dotfiles/a
|
||||
echo "fileb" > "${tmps}"/dotfiles/b
|
||||
echo "filec" > "${tmps}"/dotfiles/c
|
||||
echo "filed" > "${tmps}"/dotfiles/d
|
||||
mkdir -p "${tmps}"/dotfiles/e/{1,2,3}
|
||||
echo filee > "${tmps}"/dotfiles/e/1/file
|
||||
echo filee > "${tmps}"/dotfiles/e/2/file
|
||||
echo filee > "${tmps}"/dotfiles/e/3/file
|
||||
mkdir -p "${tmps}"/dotfiles/f/{1,2,3}
|
||||
echo filee > "${tmps}"/dotfiles/f/1/file
|
||||
echo filee > "${tmps}"/dotfiles/f/2/file
|
||||
echo filee > "${tmps}"/dotfiles/f/3/file
|
||||
|
||||
# install
|
||||
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -b -V
|
||||
cd "${ddpath}" | ${bin} install -f -c "${cfg}" -p p1 -b -V
|
||||
|
||||
# checks
|
||||
[ ! -e ${tmpd}/a ] && echo "[ERROR] dotfile a not linked" && exit 1
|
||||
[ ! -h ${tmpd}/b ] && echo "[ERROR] dotfile b linked" && exit 1
|
||||
[ ! -e ${tmpd}/c ] && echo "[ERROR] dotfile c not linked" && exit 1
|
||||
[ ! -h ${tmpd}/d ] && echo "[ERROR] dotfile d linked" && exit 1
|
||||
[ ! -e "${tmpd}"/a ] && echo "[ERROR] dotfile a not linked" && exit 1
|
||||
[ ! -h "${tmpd}"/b ] && echo "[ERROR] dotfile b linked" && exit 1
|
||||
[ ! -e "${tmpd}"/c ] && echo "[ERROR] dotfile c not linked" && exit 1
|
||||
[ ! -h "${tmpd}"/d ] && echo "[ERROR] dotfile d linked" && exit 1
|
||||
|
||||
# link_children
|
||||
[ ! -d ${tmpd}/e ] && echo "[ERROR] dir e does not exist" && exit 1
|
||||
[ ! -h ${tmpd}/e/1 ] && echo "[ERROR] children e/1 not linked" && exit 1
|
||||
[ ! -h ${tmpd}/e/2 ] && echo "[ERROR] children e/2 not linked" && exit 1
|
||||
[ ! -h ${tmpd}/e/3 ] && echo "[ERROR] children e/3 not linked" && exit 1
|
||||
[ ! -d "${tmpd}"/e ] && echo "[ERROR] dir e does not exist" && exit 1
|
||||
[ ! -h "${tmpd}"/e/1 ] && echo "[ERROR] children e/1 not linked" && exit 1
|
||||
[ ! -h "${tmpd}"/e/2 ] && echo "[ERROR] children e/2 not linked" && exit 1
|
||||
[ ! -h "${tmpd}"/e/3 ] && echo "[ERROR] children e/3 not linked" && exit 1
|
||||
|
||||
[ ! -d ${tmpd}/f ] && echo "[ERROR] dir f does not exist" && exit 1
|
||||
[ ! -h ${tmpd}/f/1 ] && echo "[ERROR] children f/1 not linked" && exit 1
|
||||
[ ! -h ${tmpd}/f/2 ] && echo "[ERROR] children f/2 not linked" && exit 1
|
||||
[ ! -h ${tmpd}/f/3 ] && echo "[ERROR] children f/3 not linked" && exit 1
|
||||
[ ! -d "${tmpd}"/f ] && echo "[ERROR] dir f does not exist" && exit 1
|
||||
[ ! -h "${tmpd}"/f/1 ] && echo "[ERROR] children f/1 not linked" && exit 1
|
||||
[ ! -h "${tmpd}"/f/2 ] && echo "[ERROR] children f/2 not linked" && exit 1
|
||||
[ ! -h "${tmpd}"/f/3 ] && echo "[ERROR] children f/3 not linked" && exit 1
|
||||
|
||||
echo "OK"
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user