mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-05 00:59:42 +00:00
fix cmpignore for #137
This commit is contained in:
@@ -66,14 +66,14 @@ class Comparator:
|
||||
ret = []
|
||||
comp = filecmp.dircmp(left, right)
|
||||
|
||||
# handle files only in deployed file
|
||||
# handle files only in deployed dir
|
||||
for i in comp.left_only:
|
||||
if utils.must_ignore([os.path.join(left, i)],
|
||||
ignore, debug=self.debug):
|
||||
continue
|
||||
ret.append('=> \"{}\" does not exist on local\n'.format(i))
|
||||
|
||||
# handle files only in dotpath file
|
||||
# handle files only in dotpath dir
|
||||
for i in comp.right_only:
|
||||
if utils.must_ignore([os.path.join(right, i)],
|
||||
ignore, debug=self.debug):
|
||||
@@ -85,6 +85,9 @@ class Comparator:
|
||||
for i in funny:
|
||||
lfile = os.path.join(left, i)
|
||||
rfile = os.path.join(right, i)
|
||||
if utils.must_ignore([lfile, rfile],
|
||||
ignore, debug=self.debug):
|
||||
continue
|
||||
short = os.path.basename(lfile)
|
||||
# file vs dir
|
||||
ret.append('=> different type: \"{}\"\n'.format(short))
|
||||
@@ -96,6 +99,9 @@ class Comparator:
|
||||
for i in funny:
|
||||
lfile = os.path.join(left, i)
|
||||
rfile = os.path.join(right, i)
|
||||
if utils.must_ignore([lfile, rfile],
|
||||
ignore, debug=self.debug):
|
||||
continue
|
||||
diff = self._diff(lfile, rfile, header=True)
|
||||
ret.append(diff)
|
||||
|
||||
|
||||
@@ -57,6 +57,9 @@ tmpd=`mktemp -d --suffix='-dotdrop-tests'`
|
||||
mkdir -p ${tmpd}/{program,config}
|
||||
touch ${tmpd}/program/a
|
||||
touch ${tmpd}/config/a
|
||||
mkdir ${tmpd}/vscode
|
||||
touch ${tmpd}/vscode/extensions.txt
|
||||
touch ${tmpd}/vscode/keybindings.json
|
||||
|
||||
# create the config file
|
||||
cfg="${basedir}/config.yaml"
|
||||
@@ -66,6 +69,7 @@ create_conf ${cfg} # sets token
|
||||
echo "[+] import"
|
||||
cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/program
|
||||
cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/config
|
||||
cd ${ddpath} | ${bin} import -c ${cfg} ${tmpd}/vscode
|
||||
|
||||
# add files
|
||||
echo "[+] add files"
|
||||
@@ -131,6 +135,23 @@ cd ${ddpath} | ${bin} compare -c ${cfg2} --verbose
|
||||
[ "$?" != "0" ] && exit 1
|
||||
set -e
|
||||
|
||||
# update files
|
||||
echo touched > ${tmpd}/vscode/extensions.txt
|
||||
echo touched > ${tmpd}/vscode/keybindings.json
|
||||
|
||||
# expect two diffs
|
||||
set +e
|
||||
cd ${ddpath} | ${bin} compare -c ${cfg} --verbose -C ${tmpd}/vscode
|
||||
[ "$?" = "0" ] && exit 1
|
||||
set -e
|
||||
|
||||
# expects no diff
|
||||
sed '/d_vscode:/a \ \ \ \ cmpignore:\n\ \ \ \ - "*extensions.txt"\n\ \ \ \ - "*keybindings.json"' ${cfg} > ${cfg2}
|
||||
set +e
|
||||
cd ${ddpath} | ${bin} compare -c ${cfg2} --verbose -C ${tmpd}/vscode
|
||||
[ "$?" != "0" ] && exit 1
|
||||
set -e
|
||||
|
||||
## CLEANING
|
||||
rm -rf ${basedir} ${tmpd}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user