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