From f026e18384473ee082027016eacc23fa3c149399 Mon Sep 17 00:00:00 2001 From: Bruno Pinto Date: Sat, 2 Mar 2013 02:41:22 -0300 Subject: [PATCH] Updating rvm scripts from rubycut/fish-inwater. --- plugins/rvm/cd.fish | 4 ++-- plugins/rvm/rvm.fish | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/rvm/cd.fish b/plugins/rvm/cd.fish index abad820..86d62c4 100644 --- a/plugins/rvm/cd.fish +++ b/plugins/rvm/cd.fish @@ -16,8 +16,8 @@ function cd --description "Change directory" end break else - if test -s ".rvmrc" - eval "rvm reload" > /dev/null + if begin ; test -s ".rvmrc" ; or test -s ".versions.conf" ; end + rvm reload 1>/dev/null 2>&1 break else set cwd (dirname "$cwd") diff --git a/plugins/rvm/rvm.fish b/plugins/rvm/rvm.fish index eaf39c5..60cc46c 100644 --- a/plugins/rvm/rvm.fish +++ b/plugins/rvm/rvm.fish @@ -1,10 +1,11 @@ function rvm -d 'Ruby enVironment Manager' # run RVM and capture the resulting environment set -l env_file (mktemp -t rvm.fish.XXXXXXXXXX) - bash -c 'source ~/.rvm/scripts/rvm; rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv + bash -c 'source ~/.rvm/scripts/rvm; cd .;rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv + + # apply rvm_* *PATH RUBY_* GEM_* variables from the captured environment + and eval (grep '^rvm\|^[^=]*PATH\|^RUBY_\|^GEM_' $env_file |grep -v _clr| sed '/^[^=]*PATH/y/:/ /; s/^/set -xg /; s/=/ /; s/$/ ;/; s/(//; s/)//') - # apply rvm_* and *PATH variables from the captured environment - and eval (grep '^rvm\|^[^=]*PATH' $env_file | sed '/^[^=]*PATH/y/:/ /; s/^/set -xg /; s/=/ /; s/$/ ;/; s/(//; s/)//') # clean up rm -f $env_file end