Skip to content
This repository
branch: bugs/restore_e…
Fetching contributors…

Cannot retrieve contributors at this time

executable file 56 lines (45 sloc) 1.512 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#!/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

export rvm_path
if [[ -z "${rvm_path:-}" ]]
then
  if (( 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

[[ -s "$rvm_environments_path/default" ]] && source "$rvm_environments_path/default"

rvm_promptless=1 rvm rvmrc load > /dev/null 2>&1

exec ruby "$@"
Something went wrong with that request. Please try again.