Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add ruby version upgrade

  • Loading branch information...
commit 2320a80e4fdf4850e44ab62736391fd5d84f50e9 1 parent 96bc6c7
@ZhangBanger authored
Showing with 13 additions and 2 deletions.
  1. +13 −2 mass_update.sh
View
15 mass_update.sh
@@ -28,9 +28,20 @@ mass_update() {
rvm get head &> /dev/null
echo "RVM is now version $(echo `rvm -v`| sed 's/rvm \(\S\+\).*/\1/')"
- # TODO Check if Ruby version needs upgrade
+ # Check if Ruby version needs upgrade
+ CURRENT_RUBY_VERSION=$(ruby -v | sed -r 's/ruby (\S+)(p\w+).*/\1-\2/')
+ NEWEST_STABLE_RUBY=$(rvm list known | tr '\n' ',' | sed -r 's/.+[0-9],.+\](.+)\[(.+[0-9])\],.+([0-9].)+head.+/\1\2\n/')
- echo "Upgrading rubies"
+ if [ $CURRENT_RUBY_VERSION != $NEWEST_STABLE_RUBY ]
+ then
+ echo "Upgrading Ruby MRI"
+ rvm upgrade $CURRENT_RUBY_VERSION $NEWEST_STABLE_RUBY
+ echo "Upgraded to Ruby version $NEWEST_STABLE_RUBY"
+ else
+ echo "Ruby version $CURRENT_RUBY_VERSION already up to date."
+ fi
+
+ # Upgrade gems
gem update --system
gem update
echo "Ruby version $(ruby -v)"
Please sign in to comment.
Something went wrong with that request. Please try again.