Skip to content

Instantly share code, notes, and snippets.

@Olical
Last active February 6, 2017 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Olical/984b1b092dbc4cb048842b18f72c8773 to your computer and use it in GitHub Desktop.
Save Olical/984b1b092dbc4cb048842b18f72c8773 to your computer and use it in GitHub Desktop.
Changes to rvm.fish so it doesn't make spacemacs error.
function rvm --description='Ruby enVironment Manager'
# run RVM and capture the resulting environment
set --local env_file (mktemp -t rvm.fish.XXXXXXXXXX)
bash -c 'source ~/.rvm/scripts/rvm; rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv > /dev/null 2>&1
# apply rvm_* and *PATH variables from the captured environment
and grep '^rvm\|^[^=]*PATH\|^GEM_HOME' $env_file | grep -v '_clr=' | sed '/^[^=]*PATH/s/:/" "/g; s/^/set -xg /; s/=/ "/; s/$/" ;/; s/(//; s/)//' | source
# needed under fish >= 2.2.0
and set -xg GEM_PATH (echo $GEM_PATH | sed 's/ /:/g')
# clean up
rm -f $env_file
end
function __handle_rvmrc_stuff --on-variable PWD
# Source a .rvmrc file in a directory after changing to it, if it exists.
# To disable this fature, set rvm_project_rvmrc=0 in $HOME/.rvmrc
if test "$rvm_project_rvmrc" != 0
set -l cwd $PWD
while true
if contains $cwd "" $HOME "/"
if test "$rvm_project_rvmrc_default" = 1
rvm default 1>/dev/null 2>&1
end
break
else
if test -e .rvmrc -o -e .ruby-version -o -e .ruby-gemset
echo "rvm reload" | source > /dev/null 2>&1
echo "rvm rvmrc load" | source >/dev/null 2>&1
break
else
set cwd (dirname "$cwd")
end
end
end
set -e cwd
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment