mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 17:24:46 +00:00
shellcheck fixes
This commit is contained in:
43
tests-ng/globs.sh
vendored
43
tests-ng/globs.sh
vendored
@@ -31,31 +31,34 @@ 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
|
||||
# the dotfile destination
|
||||
tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
|
||||
tmpd=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d)
|
||||
# temporary
|
||||
tmpa=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
|
||||
tmpa=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d)
|
||||
|
||||
clear_on_exit "${tmps}"
|
||||
clear_on_exit "${tmpd}"
|
||||
@@ -66,18 +69,18 @@ clear_on_exit "${tmpa}"
|
||||
###########
|
||||
# create the action files
|
||||
actionsd="${tmps}/actions"
|
||||
mkdir -p ${actionsd}
|
||||
cat > ${actionsd}/action1.yaml << _EOF
|
||||
mkdir -p "${actionsd}"
|
||||
cat > "${actionsd}"/action1.yaml << _EOF
|
||||
actions:
|
||||
fromaction1: echo "fromaction1" > ${tmpa}/fromaction1
|
||||
_EOF
|
||||
cat > ${actionsd}/action2.yaml << _EOF
|
||||
cat > "${actionsd}"/action2.yaml << _EOF
|
||||
actions:
|
||||
fromaction2: echo "fromaction2" > ${tmpa}/fromaction2
|
||||
_EOF
|
||||
|
||||
cfg="${tmps}/config.yaml"
|
||||
cat > ${cfg} << _EOF
|
||||
cat > "${cfg}" << _EOF
|
||||
config:
|
||||
backup: true
|
||||
create: true
|
||||
@@ -98,18 +101,18 @@ profiles:
|
||||
_EOF
|
||||
|
||||
# create the source
|
||||
mkdir -p ${tmps}/dotfiles/
|
||||
echo "abc" > ${tmps}/dotfiles/abc
|
||||
mkdir -p "${tmps}"/dotfiles/
|
||||
echo "abc" > "${tmps}"/dotfiles/abc
|
||||
|
||||
# install
|
||||
cd ${ddpath} | ${bin} install -c ${cfg} -f -p p1 -V
|
||||
cd "${ddpath}" | ${bin} install -c "${cfg}" -f -p p1 -V
|
||||
|
||||
# checks
|
||||
[ ! -e ${tmpd}/abc ] && echo "dotfile not installed" && exit 1
|
||||
[ ! -e ${tmpa}/fromaction1 ] && echo "action1 not executed" && exit 1
|
||||
grep fromaction1 ${tmpa}/fromaction1
|
||||
[ ! -e ${tmpa}/fromaction2 ] && echo "action2 not executed" && exit 1
|
||||
grep fromaction2 ${tmpa}/fromaction2
|
||||
[ ! -e "${tmpd}"/abc ] && echo "dotfile not installed" && exit 1
|
||||
[ ! -e "${tmpa}"/fromaction1 ] && echo "action1 not executed" && exit 1
|
||||
grep fromaction1 "${tmpa}"/fromaction1
|
||||
[ ! -e "${tmpa}"/fromaction2 ] && echo "action2 not executed" && exit 1
|
||||
grep fromaction2 "${tmpa}"/fromaction2
|
||||
|
||||
echo "OK"
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user