#!/usr/bin/env bash # # gemsync - Standalone gemsync utility. # # Example: # gemsync --from 1.8.6 -m foo --to 1.9.1 -m bar # source ~/.bash_profile # load rvm from_string=`echo "$@" | sed 's/--/;/g' | tr ';' "\n" | awk '/from/ {print}' | sed 's/from//'` to_string=`echo "$@" | sed 's/--/;/g' | tr ';' "\n" | awk '/to/ {print}' | sed 's/to//'` if [ -z "$from_string" ] ; then echo "Invalid arguments. Missing --from " ; exit 1 ; fi if [ -z "$to_string" ] ; then echo "Invalid arguments. Missing --to " ; exit 1 ; fi # first we use where we want. rvm $to_string # Then we sync from the source. rvm sync $from_string