init 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env bash
  2. __rvm_load_rvmrc()
  3. {
  4. \typeset _file
  5. \typeset -a rvm_rvmrc_files
  6. if (( ${rvm_ignore_rvmrc:=0} == 1 ))
  7. then
  8. return 0
  9. fi
  10. [[ -n "${rvm_stored_umask:-}" ]] || export rvm_stored_umask=$(umask)
  11. rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
  12. if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
  13. then rvm_rvmrc_files+=( "${rvm_prefix}/.rvmrc" )
  14. fi
  15. for _file in "${rvm_rvmrc_files[@]}"
  16. do
  17. if [[ -s "$_file" ]]
  18. then
  19. if __rvm_grep '^\s*rvm .*$' "$_file" >/dev/null 2>&1
  20. then
  21. rvm_error "
  22. $_file is for rvm settings only.
  23. rvm CLI may NOT be called from within $_file.
  24. Skipping the loading of $_file
  25. "
  26. return 1
  27. else
  28. source "$_file"
  29. fi
  30. fi
  31. done
  32. return 0
  33. }
  34. # Initialize rvm, ensuring that the path and directories are as expected.
  35. __rvm_initialize()
  36. {
  37. true ${rvm_scripts_path:="$rvm_path/scripts"}
  38. export rvm_scripts_path
  39. source "$rvm_scripts_path/base"
  40. __rvm_conditionally_add_bin_path
  41. export PATH
  42. [[ -d "${rvm_tmp_path:-/tmp}" ]] || command mkdir -p "${rvm_tmp_path}"
  43. return 0
  44. }