Skip to content

Instantly share code, notes, and snippets.

@IanVaughan
Created March 25, 2016 00:25
Show Gist options
  • Save IanVaughan/2816d3260e43d2535d11 to your computer and use it in GitHub Desktop.
Save IanVaughan/2816d3260e43d2535d11 to your computer and use it in GitHub Desktop.
Update all outdated gems
#!/bin/sh -x
# Run this in your ruby/rails project to get a list from of gems from "bundle outdated"
# then itterate over each one, updating it and commiting the Gemfile and lock and pushing to CI
# That way any gem update that breaks CI can be isoltated, fixed or removed.
FILE=../outdated_gemlist.txt
touch $FILE
gem_list=$(cat $FILE)
echo $gem_list
if [[ ! $gem_list ]]; then
echo "Getting gem list..."
gem_list=$(bundle outdated | grep "*" | cut -f 4 -d " ")
echo $gem_list > $FILE
fi
for gem_name in $gem_list; do
echo "Updating ${gem_name}..."
bundle update $gem_name
git ci -am "Update ${gem_name}" --no-verify
git push
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment