Created
March 6, 2015 06:51
-
-
Save kevinrutherford/a5cbfce754156b2fa00c to your computer and use it in GitHub Desktop.
Sometimes I need to figure out which gem update broke my build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# | |
GEMFILE=Gemfile.lock | |
[ $# -lt 1 ] && { echo "Usage: $0 cmd" >&2; return 1; } | |
[ -r $GEMFILE ] || { echo "Cannot find $GEMFILE" >&2; return 1; } | |
cmd="$@" | |
eval $cmd || { echo "\`$*\` fails!" >&2; return 1; } | |
gems=`cat $GEMFILE | sed -n '/specs\:/,/^$/p' | sed 1d | awk '{print $1}' | sort | uniq` | |
num_gems=`echo $gems | wc -w` | |
[ $num_gems -gt 5 ] && { echo; echo "$(tput setaf 3)You have $num_gems gems; this may take a while!$(tput sgr 0)"; echo; } | |
for gem in $gems; do | |
echo "Trying $gem ..." | |
bundle update $gem && { | |
eval $cmd || bad_gems="$bad_gems $gem" | |
} | |
git checkout $GEMFILE | |
done | |
if [ z$bad_gems -eq z ]; then | |
echo "$(tput setaf 2)All of your gems update ok$(tput sgr 0)" | |
else | |
echo "$(tput setaf 1)The following gems fail: $bad_gems$(tput sgr 0)" | |
return 2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment