Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit b992c55

Browse files
chalinkwalrath
authored andcommitted
chore(cache): helper script enhancements (#2210)
1 parent 3baea41 commit b992c55

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Diff for: scripts/cache.sh

+16-6
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function cacheRefresh() {
4242
if [[ -e $srcPath ]]; then
4343
[[ -d "$destDir" ]] || (set -x; mkdir $destDir);
4444
case "$f" in
45-
($FILE_PATTERN)
45+
(*$FILE_PATTERN*)
4646
(set -x; cp $srcPath $destPath);;
4747
(*)
4848
echo "SKIPPED $f";;
@@ -56,11 +56,20 @@ function cacheRefresh() {
5656
[[ $allFound ]] || exit 1;
5757
}
5858

59-
function cacheDiff() {
59+
function cacheDiffSummary() {
6060
diff -qr -x "_*.*" "$CACHE/" "$LATEST/" | \
6161
grep -v "^Only in"
6262
}
6363

64+
function cacheDiff() {
65+
local FILES="*$1*"
66+
cd $CACHE;
67+
# List files
68+
find . -name "$FILES" ! -name "*~" -exec diff -q {} ../latest/{} \;
69+
# Show differences
70+
find . -name "$FILES" ! -name "*~" -exec diff {} ../latest/{} \;
71+
}
72+
6473
function usage() {
6574
echo "Usage: cache.sh [-d | -l | -r pattern]"
6675
echo " -d diff cache and latest subdirectories"
@@ -69,8 +78,9 @@ function usage() {
6978
}
7079

7180
case "$1" in
72-
(-r) shift; cacheRefresh $@;;
73-
(-d) shift; cacheDiff $@;;
74-
(-l) shift; printf "$FILES\n\n";;
75-
(*) usage;
81+
(-r|--refresh) shift; cacheRefresh $@;;
82+
(-ds|--diff-summary) shift; cacheDiffSummary $@;;
83+
(-d|--diff) shift; cacheDiff $@;;
84+
(-l) shift; printf "$FILES\n\n";;
85+
(*) usage;
7686
esac

0 commit comments

Comments
 (0)