Created
May 27, 2016 11:30
-
-
Save awakia/39b9017222b54b09c17566124b829e47 to your computer and use it in GitHub Desktop.
This file contains 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/bash | |
# | |
# To resolve https://github.com/wercker/support/issues/125 | |
# At first, this script tries to run `bundle install` using cache. | |
# If it fails, run again after cleaning up cache. | |
# | |
# Usage: | |
# script/ci-bundle-install | |
# | |
BUNDLER_CACHE_DIR=$WERCKER_CACHE_DIR/bundle-install/ | |
MAX_RETRY_COUNT=3 | |
bundle check --path $BUNDLER_CACHE_DIR | |
exit_code=$? | |
if [ $exit_code -eq 0 ]; then | |
echo "=====> All dependencies are already installed!" | |
exit 0 | |
fi | |
retry_count=1 | |
while [ $retry_count -le $MAX_RETRY_COUNT ]; do | |
bundle install -j4 --path $BUNDLER_CACHE_DIR | |
exit_code=$? | |
if [ $exit_code -eq 0 ]; then | |
echo "=====> bundle install has been successfully completed!" | |
exit 0 | |
fi | |
echo "=====> Clear cache..." | |
rm -rf $BUNDLER_CACHE_DIR | |
echo "=====> Retry bundle install..." | |
retry_count=$(expr $retry_count + 1) | |
done | |
echo "=====> bundle install has been failed." | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment