mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 17:24:46 +00:00
fix and tests for #302
This commit is contained in:
@@ -123,11 +123,13 @@ echo "{{@@ header() @@}}" > ${tmps}/dotfiles/fl
|
||||
|
||||
# create the normal dotfile
|
||||
echo "before" > ${tmps}/dotfiles/fn
|
||||
echo "{#@@ should not be stripped @@#}" >> ${tmps}/dotfiles/fn
|
||||
echo "{#@@ should be stripped @@#}" >> ${tmps}/dotfiles/fn
|
||||
echo "after" >> ${tmps}/dotfiles/fn
|
||||
|
||||
# install
|
||||
echo "installing"
|
||||
cd ${ddpath} | ${bin} install -f --showdiff -c ${cfg} -p p1 -V
|
||||
echo "comparing"
|
||||
cd ${ddpath} | ${bin} compare -c ${cfg} -p p1 -V
|
||||
|
||||
# simple file
|
||||
@@ -170,7 +172,7 @@ grep 'header' ${tmpd}/f1 || (echo "header stripped" && exit 1)
|
||||
# normal dotfile
|
||||
echo "* normal dotfile"
|
||||
[ ! -e ${tmpd}/fn ] && echo 'not installed' && exit 1
|
||||
grep 'should not be stripped' ${tmpd}/fn && echo "no templated" && exit 1
|
||||
grep 'should be stripped' ${tmpd}/fn && echo "not templated" && exit 1
|
||||
|
||||
# test backup done
|
||||
echo "before" > ${tmps}/dotfiles/f1
|
||||
|
||||
@@ -61,6 +61,7 @@ cat > ${cfg} << _EOF
|
||||
trans_read:
|
||||
r_echo_abs_src: echo "\$(cat {0}); {{@@ _dotfile_abs_src @@}}" > {1}
|
||||
r_echo_var: echo "\$(cat {0}); {{@@ r_var @@}}" > {1}
|
||||
reverse_it: cat {0} | rev > {1}
|
||||
trans_write:
|
||||
w_echo_key: echo "\$(cat {0}); {{@@ _dotfile_key @@}}" > {1}
|
||||
w_echo_var: echo "\$(cat {0}); {{@@ w_var @@}}" > {1}
|
||||
@@ -85,12 +86,17 @@ dotfiles:
|
||||
src: ghi
|
||||
trans_read: r_echo_var
|
||||
trans_write: w_echo_var
|
||||
f_rev:
|
||||
dst: ${tmpd}/rev
|
||||
src: rev
|
||||
trans_read: reverse_it
|
||||
profiles:
|
||||
p1:
|
||||
dotfiles:
|
||||
- f_abc
|
||||
- f_def
|
||||
- f_ghi
|
||||
- f_rev
|
||||
_EOF
|
||||
#cat ${cfg}
|
||||
|
||||
@@ -98,6 +104,7 @@ _EOF
|
||||
echo 'abc' > ${tmps}/dotfiles/abc
|
||||
echo 'marker' > ${tmps}/dotfiles/def
|
||||
echo 'ghi' > ${tmps}/dotfiles/ghi
|
||||
echo '{{@@ profile @@}}' | rev > ${tmps}/dotfiles/rev
|
||||
|
||||
###########################
|
||||
# test install and compare
|
||||
@@ -110,11 +117,14 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -b -V
|
||||
[ ! -e ${tmpd}/def ] && exit 1
|
||||
[ ! -e ${tmpd}/abc ] && exit 1
|
||||
[ ! -e ${tmpd}/ghi ] && exit 1
|
||||
[ ! -e ${tmpd}/rev ] && exit 1
|
||||
grep marker ${tmpd}/def
|
||||
cat ${tmpd}/abc
|
||||
grep "^abc; ${tmps}/dotfiles/abc$" ${tmpd}/abc
|
||||
cat ${tmpd}/ghi
|
||||
grep "^ghi; readvar$" ${tmpd}/ghi
|
||||
cat ${tmpd}/rev
|
||||
grep "^p1$" ${tmpd}/rev
|
||||
|
||||
###########################
|
||||
# test update
|
||||
@@ -127,6 +137,7 @@ cd ${ddpath} | ${bin} update -f -k -c ${cfg} -p p1 -b -V
|
||||
[ ! -e ${tmps}/dotfiles/def ] && exit 1
|
||||
[ ! -e ${tmps}/dotfiles/abc ] && exit 1
|
||||
[ ! -e ${tmps}/dotfiles/ghi ] && exit 1
|
||||
[ ! -e ${tmps}/dotfiles/rev ] && exit 1
|
||||
grep marker ${tmps}/dotfiles/def
|
||||
cat ${tmps}/dotfiles/abc
|
||||
grep "^abc; ${tmps}/dotfiles/abc; f_abc$" ${tmps}/dotfiles/abc
|
||||
|
||||
Reference in New Issue
Block a user