initialize 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #!/usr/bin/env bash
  2. # Set shell options that RVM cannot live without,
  3. # see __rvm_setup and __rvm_teardown for further settings.
  4. if
  5. [[ -n "${BASH_VERSION:-}" ]]
  6. then
  7. shopt -s extglob
  8. elif
  9. [[ -n "${ZSH_VERSION:-}" ]]
  10. then
  11. setopt extendedglob
  12. setopt kshglob
  13. setopt no_glob_subst
  14. elif
  15. [[ -n "${KSH_VERSION:-}" ]]
  16. then
  17. true # mksh
  18. else
  19. printf "%b" "What the heck kind of shell are you running here???\n"
  20. fi
  21. # duplication marker jkdfkdfngjdjkfngjkdfngjkd
  22. if
  23. (( ${rvm_trace_flag:-0} == 1 ))
  24. then
  25. if [[ -n "${BASH_VERSION:-}" ]]
  26. then export PS4="+ \$(__rvm_date \"+%s.%N\" 2>/dev/null) \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
  27. elif [[ -n "${ZSH_VERSION:-}" ]]
  28. then export PS4="+ %* %F{red}%x:%I %F{green}%N:%i%F{white} %_"
  29. fi
  30. set -o xtrace
  31. fi
  32. export __rvm_env_loaded
  33. # set env loaded flag if not yet set
  34. : __rvm_env_loaded:${__rvm_env_loaded:=0}:
  35. # increase load count counter
  36. : __rvm_env_loaded:$(( __rvm_env_loaded+=1 )):
  37. # load only if not yet loaded or first time loading
  38. if [[ -z "${rvm_tmp_path:-}" ]] || (( __rvm_env_loaded == 1 ))
  39. then
  40. if
  41. \typeset -f __rvm_cleanse_variables >/dev/null 2>&1
  42. then
  43. __rvm_cleanse_variables ||
  44. if [[ -n "${ZSH_VERSION:-}" ]]
  45. then rvm_error "ZSH Error, run \`rm -f ~/.zcompdump\` and try again."
  46. fi
  47. fi
  48. # Ensure that /etc/rvmrc and $HOME/.rvmrc values take precedence.
  49. if (( ${rvm_ignore_rvmrc:=0} == 0 ))
  50. then
  51. [[ -n "${rvm_stored_umask:-}" ]] || export rvm_stored_umask=$(umask)
  52. rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
  53. if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
  54. then rvm_rvmrc_files+=( "${rvm_prefix}/.rvmrc" )
  55. fi
  56. for rvmrc in "${rvm_rvmrc_files[@]}"
  57. do
  58. if [[ -f "$rvmrc" ]]
  59. then
  60. if GREP_OPTIONS="" \command \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
  61. then
  62. printf "%b" "
  63. Error:
  64. $rvmrc is for rvm settings only.
  65. rvm CLI may NOT be called from within $rvmrc.
  66. Skipping the loading of $rvmrc"
  67. return 1
  68. else
  69. source "$rvmrc"
  70. fi
  71. fi
  72. done
  73. unset rvm_rvmrc_files
  74. fi
  75. # duplication marker jdgkjnfnkjdngjkfnd4fd
  76. export rvm_path
  77. if [[ -z "${rvm_path:-}" ]]
  78. then
  79. if [[ -n "${BASH_SOURCE:-$_}" && -f "${BASH_SOURCE:-$_}" ]]
  80. then
  81. rvm_path="${BASH_SOURCE:-$_}"
  82. rvm_path="$( \command \cd "${rvm_path%/scripts/initialize}">/dev/null; pwd )"
  83. elif (( UID == 0 )) && [[ -d "/usr/local/rvm" ]]
  84. then rvm_path="/usr/local/rvm"
  85. elif [[ -d "${HOME}/.rvm" ]]
  86. then rvm_path="${HOME}/.rvm"
  87. elif [[ -d "/usr/local/rvm" ]]
  88. then rvm_path="/usr/local/rvm"
  89. else echo "Can't find rvm install!" 1>&2 ; exit 1
  90. fi
  91. fi
  92. true ${rvm_scripts_path:="$rvm_path/scripts"}
  93. #
  94. # Setup RVM Environment variables. Each RVM internal path is intended to be
  95. # configurable by the end users for whatever their needs may be.
  96. # They should be set in /etc/rvmrc and then $HOME/.rvmrc
  97. #
  98. # duplication marker kkdfkgnjfndgjkndfjkgnkfjdgn
  99. [[ -n "${rvm_user_install_flag:-}" ]] ||
  100. case "$rvm_path" in
  101. (/usr/local/rvm) rvm_user_install_flag=0 ;;
  102. ($HOME/*|/${USER// /_}*) rvm_user_install_flag=1 ;;
  103. (*) rvm_user_install_flag=0 ;;
  104. esac
  105. export rvm_user_install_flag
  106. : \
  107. rvm_bin_path:${rvm_bin_path:="$rvm_path/bin"} \
  108. rvm_man_path:${rvm_man_path:="$rvm_path/share/man"} \
  109. rvm_archives_path:${rvm_archives_path:="$rvm_path/archives"} \
  110. rvm_docs_path:${rvm_docs_path:="$rvm_path/docs"} \
  111. rvm_environments_path:${rvm_environments_path:="$rvm_path/environments"} \
  112. rvm_examples_path:${rvm_examples_path:="$rvm_path/examples"} \
  113. rvm_gems_path:${rvm_gems_path:="$rvm_path/gems"} \
  114. rvm_gemsets_path:${rvm_gemsets_path:="$rvm_path/gemsets"} \
  115. rvm_help_path:${rvm_help_path:="$rvm_path/help"} \
  116. rvm_docs_path:${rvm_docs_path:="$rvm_path/docs"} \
  117. rvm_hooks_path:${rvm_hooks_path:="$rvm_path/hooks"} \
  118. rvm_lib_path:${rvm_lib_path:="$rvm_path/lib"} \
  119. rvm_log_path:${rvm_log_path:="$rvm_path/log"} \
  120. rvm_patches_path:${rvm_patches_path:="$rvm_path/patches"} \
  121. rvm_repos_path:${rvm_repos_path:="$rvm_path/repos"} \
  122. rvm_rubies_path:${rvm_rubies_path:="$rvm_path/rubies"} \
  123. rvm_rubygems_path:${rvm_rubygems_path:="$rvm_path/rubygems"} \
  124. rvm_src_path:${rvm_src_path:="$rvm_path/src"} \
  125. rvm_tmp_path:${rvm_tmp_path:="$rvm_path/tmp"} \
  126. rvm_user_path:${rvm_user_path:="$rvm_path/user"} \
  127. rvm_usr_path:${rvm_usr_path:="$rvm_path/usr"} \
  128. rvm_wrappers_path:${rvm_wrappers_path:="$rvm_path/wrappers"} \
  129. rvm_verbose_flag:${rvm_verbose_flag:=0} \
  130. rvm_debug_flag:${rvm_debug_flag:=0} \
  131. rvm_gems_cache_path:${rvm_gems_cache_path:=${rvm_gems_path:-"$rvm_path/gems"}/cache}
  132. export rvm_action rvm_alias_expanded rvm_archive_extension rvm_archives_path rvm_bin_flag rvm_bin_path rvm_debug_flag rvm_default_flag rvm_delete_flag rvm_docs_path rvm_docs_type rvm_dump_environment_flag rvm_environments_path rvm_error_message rvm_examples_path rvm_expanding_aliases rvm_file_name rvm_gemdir_flag rvm_gems_cache_path rvm_gems_path rvm_gemset_name rvm_gemset_separator rvm_gemsets_path rvm_gemstone_package_file rvm_gemstone_url rvm_head_flag rvm_help_path rvm_docs_path rvm_hook rvm_hooks_path rvm_install_on_use_flag rvm_lib_path rvm_llvm_flag rvm_loaded_flag rvm_log_path rvm_niceness rvm_nightly_flag rvm_only_path_flag rvm_parse_break rvm_patch_original_pwd rvm_patches_path rvm_path rvm_pretty_print_flag rvm_proxy rvm_quiet_flag rvm_reload_flag rvm_remove_flag rvm_repos_path rvm_rubies_path rvm_ruby_alias rvm_ruby_args rvm_ruby_binary rvm_ruby_bits rvm_ruby_configure rvm_ruby_file rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_global_gems_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_make rvm_ruby_make_install rvm_ruby_minor_version rvm_ruby_mode rvm_ruby_name rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_patch rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_sha rvm_ruby_string rvm_ruby_strings rvm_ruby_tag rvm_ruby_url rvm_ruby_user_tag rvm_ruby_version rvm_script_name rvm_scripts_path rvm_sdk rvm_user_install_flag rvm_silent_flag rvm_src_path rvm_sticky_flag rvm_system_flag rvm_tmp_path rvm_token rvm_trace_flag rvm_use_flag rvm_user_flag rvm_user_path rvm_usr_path rvm_verbose_flag rvm_wrappers_path rvm_ruby_repo_branch rvm_man_path rvm_remote_flag rvm_ruby_repo_tag
  133. fi # if [[ -z "${rvm_tmp_path:-}" ]] || (( __rvm_env_loaded == 1 ))