Created
February 23, 2013 05:12
-
-
Save Nyoho/5018563 to your computer and use it in GitHub Desktop.
rbenv で新しいバージョンをインストールしてついでに gem もごっそり移行する。zsh の補完も効くようにしてみた。.zshrc の compinit に後に。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## completion for gem transition of rbenv | |
function gem-transition { | |
local tmpfile=/tmp/current_gem_list | |
if [ $# -ne 2 ]; then | |
echo "usage: command version1 version2" | |
return | |
fi | |
rbenv install $2 | |
rbenv global $1 | |
rbenv rehash | |
rehash | |
gem list | awk '{print $1}' > $tmpfile | |
rbenv global $2 | |
rbenv rehash | |
rehash | |
gem i `cat $TMP_FILE` | |
rm $tmpfile | |
} | |
function _gem-transition { | |
local -a _oldversions _newversions | |
_oldversions=( $(rbenv completions uninstall) ) | |
_newversions=( $(rbenv completions install) ) | |
_arguments \ | |
':old:($_oldversions)' \ | |
':new:($_newversions)' && return 0 | |
return 1; | |
} | |
compdef _gem-transition gem-transition |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ABI がどこまで同一なのかよくわからんので、いれなおしたほうがはやいと思っているクラスタ