#!/usr/bin/env bash export HOME="${HOME%%+(\/)}" # Remove trailing slashes if they exist on HOME if (( ${rvm_ignore_rvmrc:=0} == 0 )) then for rvmrc in /etc/rvmrc "$HOME/.rvmrc" do if [[ -f "$rvmrc" ]] then if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1 then printf "%b" "\nError: $rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc" return 1 else source "$rvmrc" fi fi done fi # duplication marker jdgkjnfnkjdngjkfnd4fd export rvm_path if [[ -z "${rvm_path:-}" ]] then if [[ -d "${0%/bin/rvm-auto-ruby}" ]] then rvm_path="$( \cd "${0%/bin/rvm-auto-ruby}">/dev/null; pwd )" elif (( UID == 0 )) && [[ -d "/usr/local/rvm" ]] then rvm_path="/usr/local/rvm" elif [[ -d "${HOME}/.rvm" ]] then rvm_path="${HOME}/.rvm" elif [[ -d "/usr/local/rvm" ]] then rvm_path="/usr/local/rvm" else echo "Can't find rvm install!" 1>&2 ; exit 1 fi fi true ${rvm_scripts_path:="$rvm_path/scripts"} true ${rvm_environments_path:="$rvm_path/environments"} if [[ -n "$rvm_path" && -s "$rvm_scripts_path/rvm" ]] then source "$rvm_scripts_path/rvm" > /dev/null 2>&1 elif [[ -s "$HOME/.rvm/scripts/rvm" ]] then source "$HOME/.rvm/scripts/rvm" > /dev/null 2>&1 elif [[ -s "/usr/local/rvm/scripts/rvm" ]] then source "/usr/local/rvm/scripts/rvm" > /dev/null 2>&1 else echo "Unable to detect rvm, please manually set the rvm_path env variable." >&2 exit 1 fi typeset -f rvm >/dev/null 2>&1 || { echo "RVM not loaded, aborting." >&2 exit 1 } case $0 in (*rvm-shebang-ruby) rvm_promptless=1 rvm rvmrc load "$(dirname "$(which "$1")")" > /dev/null 2>&1 ;; (*) rvm_promptless=1 rvm rvmrc load > /dev/null 2>&1 ;; esac exec ruby "$@"