public
Created

TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT

  • Download Gist
track_spree
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
#!/usr/bin/env zsh
 
# 1304046900 TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT
 
# To be placed at the root of your app.
 
old_commit="29e3d4f707bdb047a6fabc2543247139027b06fb"
 
parts=(
core/app/views
core/config/locales/en.yml
core/lib/generators/spree/install/templates
)
 
# Exit on failure
#
set -e
 
git clone git://github.com/spree/spree.git tmp/spree_check
cd tmp/spree_check
 
if output=$(git diff --exit-code --name-status "$old_commit" HEAD -- "${parts[@]}"); then
echo "No changes"
else
 
# Group name statuses
#
while read -r line; do
case $line in
(M*) modified+=("$line") ;;
(A*) added+=("$line") ;;
(D*) deleted+=("$line") ;;
esac
done <<< "$output"
 
# Display groups
#
if [[ -n $modified ]]; then
print -l -- "${modified[@]}"
echo
fi
if [[ -n $added ]]; then
print -l -- "${added[@]}"
echo
fi
if [[ -n $deleted ]]; then
print -l -- "${deleted[@]}"
echo
fi
echo "You are now at: $(git rev-parse HEAD)"
fi
 
cd ../../
rm -r tmp/spree_check

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.