#!/bin/bash --login # USE THIS SCRIPT WHEN UPGRADING RUBY if [[ $CRYPTUM_ROOT == '' ]]; then if [[ ! -d '/opt/cryptum' ]]; then cryptum_root=$(pwd) else cryptum_root='/opt/cryptum' fi else cryptum_root="${CRYPTUM_ROOT}" fi function usage() { echo $"Usage: $0 " exit 1 } if [[ -f '/etc/profile.d/rvm.sh' ]]; then source /etc/profile.d/rvm.sh fi new_ruby_version=$1 if [[ $2 != '' ]]; then old_ruby_version=$2 else old_ruby_version=`cat ${cryptum_root}/.ruby-version` fi ruby_gemset=`cat ${cryptum_root}/.ruby-gemset` if [[ $# < 1 ]]; then usage fi # Upgrade RVM export rvmsudo_secure_path=1 rvmsudo rvm get head rvm reload # Install New Version of RubyGems & Ruby cd $cryptum_root && ./upgrade_gem.sh rvmsudo rvm install ruby-$new_ruby_version echo $new_ruby_version > $cryptum_root/.ruby-version cd $cryptum_root && rvm use $new_ruby_version@$ruby_gemset && ./build_cryptum_gem.sh