Commit 83cfe149 authored by Bruno's avatar Bruno

Merge pull request #360 from felipero/master

Fixing 'RVM is not a function, selecting rubies with 'rvm use ...' will not work.'
parents 77fbeb21 d8fb61b9
function rvm -d 'Ruby enVironment Manager' function rvm -d 'Ruby enVironment Manager'
# run RVM and capture the resulting environment # run RVM and capture the resulting environment
set -l env_file (mktemp -t rvm.fish.XXXXXXXXXX) 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; cd .;rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv
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 # grep the rvm_* *PATH RUBY_* GEM_* variables from the captured environment
# exclude lines with _clr and _debug # exclude lines with _clr and _debug
# apply rvm_* *PATH RUBY_* GEM_* variables from the captured environment # 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/)//') 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/)//')
# clean up # clean up
rm -f $env_file rm -f $env_file
end end
...@@ -13,7 +13,8 @@ function __check_rvm --on-variable PWD --description 'Setup rvm on directory cha ...@@ -13,7 +13,8 @@ function __check_rvm --on-variable PWD --description 'Setup rvm on directory cha
break break
else else
if begin ; test -s ".rvmrc" ; or test -s ".ruby-version" ; or test -s ".ruby-gemset" ; or test -s ".versions.conf" ; end if begin ; test -s ".rvmrc" ; or test -s ".ruby-version" ; or test -s ".ruby-gemset" ; or test -s ".versions.conf" ; end
rvm reload 1>/dev/null 2>&1 rvm reload 1> /dev/null 2>&1
rvm rvmrc load 1>/dev/null 2>&1
break break
else else
set cwd (dirname "$cwd") set cwd (dirname "$cwd")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment