You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
oh-my-fish/plugins/rvm/rvm.fish

17 lines
706 B
Fish

12 years ago
function rvm -d 'Ruby enVironment Manager'
12 years ago
# run RVM and capture the resulting environment
set -l env_file (mktemp -t rvm.fish.XXXXXXXXXX)
bash -c '[ -e ~/.rvm/scripts/rvm ] && source ~/.rvm/scripts/rvm || source /usr/local/rvm/scripts/rvm; rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv
# grep the rvm_* *PATH RUBY_* GEM_* variables from the captured environment
# exclude lines with _clr and _debug
# apply rvm_* *PATH RUBY_* GEM_* variables from the captured environment
and eval (grep '^rvm\|^[^=]*PATH\|^RUBY_\|^GEM_' $env_file |grep -v _clr |grep -v _debug| sed '/^[^=]*PATH/y/:/ /; s/^/set -xg /; s/=/ /; s/$/ ;/; s/(//; s/)//')
12 years ago
# clean up
rm -f $env_file
12 years ago
end