blob: a186cae064a4aa90e645cff4eb49d3b88978e1cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
function rvm -d 'Ruby enVironment Manager'
# 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 grep '^rvm\|^[^=]*PATH\|^RUBY_\|^GEM_' $env_file | \
grep -v _clr | grep -v _debug | \
sed '/^PATH/y/:/ /; s/^/set -xg /; s/=/ /; s/$/ ;/; s/(//; s/)//' | \
source
# clean up
rm -f $env_file
end
|