Created
February 29, 2016 20:01
-
-
Save ricardotealdi/e3fd1aef9bf5f9c0ff70 to your computer and use it in GitHub Desktop.
Update outdated gems
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
clear; bundle outdated --strict 3>&1 1>&2 2>&3 | | |
grep '*' | | |
grep -v -E "(test|development)" | | |
awk '{ print $2 }' 3>&1 1>&2 2>&3 | | |
while read gem | |
do | |
echo -e "\nUpdating $gem...\n" | |
bundle update $gem | |
bundle exec rspec --fail-fast | |
test_exit_status=$? | |
if [[ $test_exit_status == 0 ]] | |
then | |
git add Gemfile.lock | |
git commit -m "Update \`$gem\`" | |
echo "Gem $gem updated" > gem_update_success | |
else | |
git checkout Gemfile.lock | |
echo "Tests failed. $gem was not updated" > gem_update_failed | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment