1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 21:29:43 +00:00

allow (dyn)variables in import for #89

This commit is contained in:
deadc0de6
2019-03-05 22:11:05 +01:00
parent 82ac34a520
commit e2feeb09c2
2 changed files with 20 additions and 0 deletions

View File

@@ -52,6 +52,9 @@ mkdir -p ${tmps}/dotfiles
tmpd=`mktemp -d --suffix='-dotdrop-tests'`
extdotfiles="${tmps}/df_p1.yaml"
dynextdotfiles_name="d_uid_dynvar"
dynextdotfiles="${tmps}/ext_${dynextdotfiles_name}"
# create the config file
cfg="${tmps}/config.yaml"
@@ -60,6 +63,8 @@ config:
backup: true
create: true
dotpath: dotfiles
dynvariables:
d_uid: "echo ${dynextdotfiles_name}"
dotfiles:
f_abc:
dst: ${tmpd}/abc
@@ -70,12 +75,16 @@ dotfiles:
f_xyz:
dst: ${tmpd}/xyz
src: xyz
f_dyn:
dst: ${tmpd}/dyn
src: dyn
profiles:
p1:
dotfiles:
- f_abc
import:
- $(basename ${extdotfiles})
- "ext_{{@@ d_uid @@}}"
_EOF
# create the external dotfile file
@@ -85,11 +94,17 @@ dotfiles:
- f_xyz
_EOF
cat > ${dynextdotfiles} << _EOF
dotfiles:
- f_dyn
_EOF
# create the source
mkdir -p ${tmps}/dotfiles/
echo "abc" > ${tmps}/dotfiles/abc
echo "def" > ${tmps}/dotfiles/def
echo "xyz" > ${tmps}/dotfiles/xyz
echo "dyn" > ${tmps}/dotfiles/dyn
# install
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
@@ -98,9 +113,11 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
[ ! -e ${tmpd}/abc ] && exit 1
[ ! -e ${tmpd}/def ] && exit 1
[ ! -e ${tmpd}/xyz ] && exit 1
[ ! -e ${tmpd}/dyn ] && exit 1
grep 'abc' ${tmpd}/abc
grep 'def' ${tmpd}/def
grep 'xyz' ${tmpd}/xyz
grep 'dyn' ${tmpd}/dyn
## CLEANING
rm -rf ${tmps} ${tmpd}