Skip to content

Instantly share code, notes, and snippets.

@drnic
Forked from raggi/validate_local_cache.sh
Last active December 11, 2015 23:39
Show Gist options
  • Save drnic/4678214 to your computer and use it in GitHub Desktop.
Save drnic/4678214 to your computer and use it in GitHub Desktop.
Version of validate_local_cache.sh for OS X
#!/usr/bin/env sh
# http://raamdev.com/2008/howto-install-md5sum-sha1sum-on-mac-os-x/
if ! which md5 > /dev/null; then
echo "md5 should be on your OS X"
exit 1
fi
if ! which curl > /dev/null; then
echo Install curl
exit 1
fi
home=$(gem env GEM_HOME)
cache=$home/cache
echo This will take a while...
for gem in $cache/*.gem; do
gemfile=$(basename $gem)
local=$(md5 -r $gem | awk '{print $1}')
remote=$(curl -s -D - -X HEAD -H 'Connection:close' http://production.cf.rubygems.org/gems/$gemfile | grep 'ETag' | cut -d '"' -f 2)
if [[ ! $local = $remote ]]; then
echo $gemfile mismatch. local: $local, remote: $remote
fi
done
echo All done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment