Skip to content

Instantly share code, notes, and snippets.

@ricardotealdi
Created February 29, 2016 20:01
Show Gist options
  • Save ricardotealdi/e3fd1aef9bf5f9c0ff70 to your computer and use it in GitHub Desktop.
Save ricardotealdi/e3fd1aef9bf5f9c0ff70 to your computer and use it in GitHub Desktop.
Update outdated gems
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