selector 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. #!/usr/bin/env bash
  2. source "${rvm_scripts_path}/functions/selector_gemsets"
  3. source "${rvm_scripts_path}/functions/selector_late"
  4. source "${rvm_scripts_path}/functions/selector_parse"
  5. source "${rvm_scripts_path}/functions/selector_interpreters"
  6. __rvm_select_set_variable_defaults()
  7. {
  8. export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
  9. export rvm_env_string rvm_action rvm_alias_expanded rvm_archive_extension rvm_bin_flag rvm_bin_path rvm_debug_flag rvm_default_flag rvm_delete_flag rvm_docs_type rvm_dump_environment_flag rvm_error_message rvm_expanding_aliases rvm_file_name rvm_gemdir_flag rvm_gemset_name rvm_gemstone_package_file rvm_gemstone_url rvm_head_flag rvm_hook rvm_install_on_use_flag rvm_llvm_flag rvm_loaded_flag rvm_niceness rvm_nightly_flag rvm_only_path_flag rvm_parse_break rvm_patch_original_pwd rvm_pretty_print_flag rvm_proxy rvm_quiet_flag rvm_reload_flag rvm_remove_flag 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_sdk rvm_silent_flag rvm_sticky_flag rvm_system_flag rvm_token rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_ruby_repo_tag
  10. }
  11. __rvm_select_detect_ruby_string()
  12. {
  13. rvm_ruby_string="${1:-${rvm_ruby_string:-${rvm_env_string:-}}}"
  14. if
  15. [[ -z "${rvm_ruby_string:-}" ]]
  16. then
  17. rvm_ruby_string="${rvm_ruby_interpreter:-}"
  18. rvm_ruby_string="${rvm_ruby_string:-}${rvm_ruby_version:+-}${rvm_ruby_version:-}"
  19. rvm_ruby_string="${rvm_ruby_string:-}${rvm_ruby_patch_level:+-}${rvm_ruby_patch_level:-}"
  20. rvm_ruby_string="${rvm_ruby_string:-}${rvm_ruby_revision:+-}${rvm_ruby_revision:-}"
  21. if [[ -n "${rvm_ruby_name:-}" ]]
  22. then rvm_ruby_name="$rvm_ruby_string-$rvm_ruby_name"
  23. fi
  24. fi
  25. }
  26. __rvm_select_interpreter_variables()
  27. {
  28. rvm_archive_extension="tar.gz"
  29. if [[ -z "${rvm_ruby_interpreter:-}" ]]
  30. then rvm_ruby_interpreter="${rvm_ruby_string//-*/}"
  31. fi
  32. rvm_ruby_interpreter="${rvm_ruby_interpreter:-missing}"
  33. if
  34. is_a_function __rvm_select_interpreter_${rvm_ruby_interpreter}
  35. then
  36. __rvm_select_interpreter_${rvm_ruby_interpreter} || return $?
  37. elif
  38. [[ -n "${MY_RUBY_HOME:-""}" ]]
  39. then
  40. __rvm_select "${MY_RUBY_HOME##*/}" || return $?
  41. elif
  42. [[ -z "${rvm_ruby_string:-""}" ]]
  43. then
  44. rvm_error "Ruby implementation '$rvm_ruby_interpreter' is not known."
  45. return 1
  46. fi
  47. }
  48. __rvm_select_version_variables()
  49. {
  50. case "$rvm_ruby_version" in
  51. (+([0-9]).+([0-9]).+([0-9]))
  52. rvm_ruby_release_version="${rvm_ruby_version/.*/}"
  53. rvm_ruby_major_version=${rvm_ruby_version%.*}
  54. rvm_ruby_major_version=${rvm_ruby_major_version#*.}
  55. rvm_ruby_minor_version="${rvm_ruby_version//*.}"
  56. ;;
  57. (+([0-9]).+([0-9]))
  58. rvm_ruby_release_version="${rvm_ruby_version/.*/}"
  59. rvm_ruby_major_version="${rvm_ruby_version#*.}"
  60. rvm_ruby_minor_version=""
  61. ;;
  62. esac
  63. }
  64. __rvm_select_default_variables()
  65. {
  66. if [[ "${rvm_ruby_interpreter}" != ext ]]
  67. then rvm_ruby_package_name="${rvm_ruby_package_name:-${rvm_ruby_string//-n*}}"
  68. fi
  69. rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_string"
  70. rvm_ruby_binary="$rvm_ruby_home/bin/ruby"
  71. rvm_ruby_irbrc="$rvm_ruby_home/.irbrc"
  72. }
  73. # __rvm_select implementation-version-patch_level
  74. __rvm_select()
  75. {
  76. true ${rvm_gemset_name:=}
  77. __rvm_select_set_variable_defaults &&
  78. __rvm_select_detect_ruby_string "${1:-}" &&
  79. __rvm_ruby_string &&
  80. __rvm_select_after_parse ||
  81. return $?
  82. }
  83. __rvm_select_after_parse()
  84. {
  85. __rvm_select_interpreter_variables &&
  86. __rvm_select_version_variables &&
  87. __rvm_select_default_variables ||
  88. return $?
  89. [[ "system" == "$rvm_ruby_interpreter" ]] || __rvm_gemset_select ||
  90. return $result
  91. rvm_ruby_selected_flag=1
  92. }
  93. __rvm_use_system() {
  94. unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
  95. if
  96. [[ -s "$rvm_path/config/system" ]]
  97. then
  98. if
  99. __rvm_grep "MY_RUBY_HOME='$rvm_rubies_path" "$rvm_path/config/system" > /dev/null
  100. then
  101. # 'system' should *not* point to an rvm ruby.
  102. if [[ -f "$rvm_path/config/system" ]]
  103. then \command \rm -f "$rvm_path/config/system"
  104. fi
  105. else
  106. source "$rvm_path/config/system"
  107. fi
  108. fi
  109. if
  110. (( ${rvm_default_flag:=0} == 1 ))
  111. then
  112. "$rvm_scripts_path/alias" delete default &> /dev/null
  113. __rvm_find "${rvm_bin_path}" -maxdepth 0 -name 'default_*' -exec rm '{}' \;
  114. \command \rm -f "$rvm_path/config/default"
  115. \command \rm -f "$rvm_environments_path/default"
  116. __rvm_rm_rf "$rvm_wrappers_path/default"
  117. fi
  118. rvm_verbose_log "Now using system ruby."
  119. __path_prefix=""
  120. __path_suffix="${rvm_bin_path}"
  121. export rvm_ruby_string="system"
  122. }
  123. __rvm_use()
  124. {
  125. \typeset binary full_binary_path rvm_ruby_gem_home __path_prefix __path_suffix
  126. __rvm_select "$@" || return $?
  127. if [[ "system" == ${rvm_ruby_interpreter:="system"} ]]
  128. then __rvm_use_system
  129. else __rvm_use_ || return $?
  130. fi
  131. __rvm_use_common
  132. }
  133. __rvm_use_()
  134. {
  135. rvm_ruby_home="${rvm_ruby_home%%@*}"
  136. if
  137. [[ ! -d "$rvm_ruby_home" ]]
  138. then
  139. if
  140. [[ ${rvm_install_on_use_flag:-0} -eq 1 ]]
  141. then
  142. rvm_warn "Required $rvm_ruby_string is not installed - installing."
  143. __rvm_run_wrapper manage "install" "$rvm_ruby_string"
  144. else
  145. rvm_error "Required $rvm_ruby_string is not installed."
  146. rvm_log "To install do: 'rvm install \"$rvm_ruby_string\"'"
  147. export rvm_recommended_ruby="rvm install $rvm_ruby_string"
  148. return 1
  149. fi
  150. fi
  151. __rvm_gemset_use_ensure || return $?
  152. export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
  153. GEM_HOME="$rvm_ruby_gem_home"
  154. GEM_PATH="$rvm_ruby_gem_path"
  155. MY_RUBY_HOME="$rvm_ruby_home"
  156. RUBY_VERSION="$rvm_ruby_string"
  157. IRBRC="$rvm_ruby_irbrc"
  158. unset BUNDLE_PATH # Ensure that BUNDLE_PATH is not set!
  159. # Handle MagLev pre-installed gems
  160. if [[ "maglev" == "$rvm_ruby_interpreter" ]]
  161. then GEM_PATH="$GEM_PATH:$MAGLEV_HOME/lib/maglev/gems/1.8/"
  162. fi
  163. [[ -n "${IRBRC:-}" ]] || unset IRBRC
  164. if
  165. (( ${rvm_use_flag:-1} >= 2 && ${rvm_internal_use_flag:-0} == 0 )) ||
  166. (( ${rvm_use_flag:-1} == 1 && ${rvm_verbose_flag:-0} == 1 ))
  167. then
  168. rvm_log "Using ${GEM_HOME/${rvm_gemset_separator:-'@'}/ with gemset }"
  169. fi
  170. if [[ "$GEM_HOME" != "$rvm_ruby_global_gems_path" ]]
  171. then __path_prefix="$GEM_HOME/bin:$rvm_ruby_global_gems_path/bin:${rvm_ruby_binary%/*}:${rvm_bin_path}"
  172. else __path_prefix="$GEM_HOME/bin:${rvm_ruby_binary%/*}:${rvm_bin_path}"
  173. fi
  174. __path_suffix=""
  175. }
  176. __rvm_use_common()
  177. {
  178. [[ -z "${rvm_ruby_string:-}" ]] || export rvm_ruby_string
  179. [[ -z "${rvm_gemset_name:-}" ]] || export rvm_gemset_name
  180. \typeset __save_PATH
  181. __rvm_remove_rvm_from_path
  182. __save_PATH=$PATH
  183. if
  184. [[ -n "${_OLD_VIRTUAL_PATH}" ]]
  185. then
  186. # _OLD_VIRTUAL_PATH means we deal with virtualenv - see #2585,
  187. # PATH is saved in __save_PATH, use __rvm_remove_rvm_from_path to
  188. # clean _OLD_VIRTUAL_PATH via PATH ... a trick so we can transform
  189. # _OLD_VIRTUAL_PATH the same way like PATH for new ruby, from now on
  190. # any virtualenv operations will be aware of rvm
  191. PATH="${_OLD_VIRTUAL_PATH}"
  192. __rvm_remove_rvm_from_path
  193. _OLD_VIRTUAL_PATH="${__path_prefix:-}${__path_prefix:+:}${PATH}${__path_suffix:+:}${__path_suffix:-}"
  194. fi
  195. PATH="${__path_prefix:-}${__path_prefix:+:}$__save_PATH${__path_suffix:+:}${__path_suffix:-}"
  196. export PATH
  197. builtin hash -r
  198. if
  199. [[ "$rvm_ruby_string" != "system" ]]
  200. then
  201. case "${rvm_rvmrc_flag:-0}" in
  202. (rvmrc|versions_conf|ruby_version) __rvm_set_${rvm_rvmrc_flag} ;;
  203. esac
  204. \typeset environment_id
  205. environment_id="$(__rvm_env_string)"
  206. if
  207. (( ${rvm_default_flag:=0} == 1 )) &&
  208. [[ "default" != "${rvm_ruby_interpreter:-}" ]] &&
  209. [[ "system" != "${rvm_ruby_interpreter:-}" ]]
  210. then
  211. # Switch the default alias to the new environment id
  212. "$rvm_scripts_path/alias" delete default &> /dev/null
  213. "$rvm_scripts_path/alias" create default "$environment_id" >& /dev/null
  214. fi
  215. rvm_default_flag=0
  216. if
  217. [[ -n "${rvm_ruby_alias:-}" ]]
  218. then
  219. rvm_log "Attempting to alias $environment_id to $rvm_ruby_alias"
  220. "$rvm_scripts_path/alias" delete "$rvm_ruby_alias" > /dev/null 2>&1
  221. rvm_alias_expanded=1 "$rvm_scripts_path/alias" create "$rvm_ruby_alias" "$environment_id" > /dev/null 2>&1
  222. ruby_alias="" ; rvm_ruby_alias=""
  223. fi
  224. else
  225. if
  226. (( ${rvm_default_flag:=0} == 1 ))
  227. then
  228. builtin command -v __rvm_reset >> /dev/null 2>&1 || source "$rvm_scripts_path/functions/reset"
  229. __rvm_reset
  230. fi
  231. fi
  232. rvm_hook="after_use"
  233. source "$rvm_scripts_path/hook"
  234. return 0
  235. }
  236. __rvm_ruby_string_installed()
  237. {
  238. \typeset __ruby_inst_dir="$rvm_rubies_path/${rvm_ruby_string}"
  239. if [[ -n "${rvm_ruby_name:-}" && ! "${rvm_ruby_string}" == *"-${rvm_ruby_name}" ]]
  240. then __ruby_inst_dir="${__ruby_inst_dir}-${rvm_ruby_name}"
  241. fi
  242. [[ -n "$rvm_ruby_interpreter" && -n "${rvm_ruby_string}" &&
  243. -d "${__ruby_inst_dir}"
  244. ]] &&
  245. [[ -z "${rvm_gemset_name}" || ${rvm_create_flag:-0} -eq 1 ||
  246. -d "${__ruby_inst_dir}${rvm_gemset_separator}${rvm_gemset_name}"
  247. ]]
  248. }
  249. __rvm_ruby_string_remotely_available()
  250. {
  251. (( ${rvm_remote_flag:-0} == 1 )) &&
  252. [[ -n "$rvm_ruby_interpreter" && -n "${rvm_ruby_string}" ]] &&
  253. __rvm_remote_server_path "${rvm_ruby_string}" >/dev/null
  254. }
  255. __rvm_ruby_string()
  256. {
  257. # rvm_ruby_string may designate any of the following items:
  258. # * rvm_gemset_name
  259. # * rvm_ruby_interpreter
  260. # * rvm_ruby_version
  261. # * rvm_ruby_patch_level
  262. # * rvm_ruby_revision
  263. # * rvm_ruby_tag
  264. true ${rvm_head_flag:=0} ${rvm_delete_flag:=0}
  265. rvm_expanding_aliases=''
  266. true \
  267. "${rvm_ruby_version:=}" "${rvm_gemset_name:=}" "${rvm_ruby_interpreter:=}"\
  268. "${rvm_ruby_version:=}" "${rvm_ruby_tag:=}" "${rvm_ruby_patch_level:=}"\
  269. "${rvm_ruby_revision:=}" ${rvm_gemset_separator:="@"} "${rvm_ruby_string:=}"\
  270. ${rvm_expanding_aliases:=0} ${rvm_head_flag:=0}
  271. if
  272. [[ "$rvm_ruby_string" == *"${rvm_gemset_separator}"* ]]
  273. then
  274. rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator}/}"
  275. rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator}*/}"
  276. fi
  277. # known ruby aliases
  278. if
  279. (( rvm_expanding_aliases == 0 )) &&
  280. [[ -n "${rvm_ruby_string}" && "$rvm_ruby_string" != "system" ]]
  281. then
  282. if
  283. [[ -f "$rvm_path/config/known_aliases" && -s "$rvm_path/config/known_aliases" ]] &&
  284. expanded_alias_name="$(__rvm_db_ "$rvm_path/config/known_aliases" "$rvm_ruby_string")" &&
  285. [[ -n "$expanded_alias_name" ]]
  286. then
  287. rvm_ruby_string="$expanded_alias_name"
  288. fi
  289. fi
  290. # Alias'd rubies
  291. if
  292. (( rvm_expanding_aliases == 0 )) &&
  293. [[ -n "${rvm_ruby_string}" && "$rvm_ruby_string" != "system" ]]
  294. then
  295. if
  296. [[ -f "$rvm_path/config/alias" && -s "$rvm_path/config/alias" ]] &&
  297. expanded_alias_name="$(__rvm_db_ "$rvm_path/config/alias" "$rvm_ruby_string")" &&
  298. [[ -n "$expanded_alias_name" ]]
  299. then
  300. rvm_ruby_string="$expanded_alias_name"
  301. elif
  302. [[ "$rvm_ruby_string" == default ]]
  303. then
  304. # Default is not a known value. Instead, we need to therefore set it to system.
  305. rvm_ruby_string="system"
  306. fi
  307. if
  308. [[ "$rvm_ruby_string" == *"${rvm_gemset_separator}"* ]]
  309. then
  310. rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator}/}"
  311. rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator}*/}"
  312. fi
  313. fi
  314. if
  315. [[ -n "$gemset_name" ]]
  316. then
  317. rvm_gemset_name="$gemset_name"
  318. rvm_sticky_flag=1 # <- not sold on this.
  319. fi
  320. __rvm_ruby_string_parse || return $?
  321. __rvm_ruby_string_find
  322. # record the name for validation of -n option
  323. detected_rvm_ruby_name="${rvm_ruby_name:-}"
  324. # clean the name so it is not added again (rbx -n install problem)
  325. rvm_ruby_name=""
  326. true
  327. }
  328. __rvm_ruby_string_find()
  329. {
  330. if
  331. __rvm_ruby_string_installed
  332. then
  333. true # use the selected/detected rvm_ruby_string
  334. elif
  335. __rvm_ruby_string_remotely_available
  336. then
  337. true # use the selected/detected rvm_ruby_string
  338. else
  339. __rvm_ruby_string_autodetect
  340. case "${rvm_ruby_string}" in
  341. (ruby-+([1-9])|ruby-+([1-9]).+([0-9])|ruby-1.+([1-9]).+([0-9])|jruby-[19]*)
  342. __rvm_ruby_string_latest &&
  343. __rvm_ruby_string_parse_ ||
  344. return $?
  345. ;;
  346. esac
  347. fi
  348. if [[ -n "${rvm_ruby_name:-}" && ! "${rvm_ruby_string}" == *"-${rvm_ruby_name}" ]]
  349. then rvm_ruby_string="${rvm_ruby_string}${rvm_ruby_name:+-}${rvm_ruby_name:-}"
  350. fi
  351. }
  352. __rvm_ruby_string_autodetect()
  353. {
  354. if
  355. [[ -z "${rvm_ruby_version:-}" &&
  356. "${rvm_ruby_interpreter}" != "ext" &&
  357. "${rvm_ruby_interpreter}" != "system"
  358. ]] &&
  359. (( ${rvm_head_flag:=0} == 0 ))
  360. then
  361. if
  362. (( ${rvm_fuzzy_flag:-0} == 1 ))
  363. then
  364. rvm_ruby_version="$(
  365. __rvm_list_strings |
  366. __rvm_grep "^${rvm_ruby_interpreter}-.*${rvm_ruby_name:-}" |
  367. __rvm_awk -F- '{print $2}' |
  368. __rvm_version_sort |
  369. __rvm_tail -n 1
  370. )"
  371. fi
  372. rvm_ruby_version="${rvm_ruby_version:-"$(
  373. __rvm_db "${rvm_ruby_interpreter}_version"
  374. )"}"
  375. fi
  376. if
  377. (( ${rvm_head_flag:=0} )) &&
  378. [[ "${rvm_ruby_interpreter}" == "ruby" ]] &&
  379. __rvm_version_compare "${rvm_ruby_version}" -ge 2.1
  380. then
  381. __rvm_take_n rvm_ruby_version 2 .
  382. fi
  383. rvm_ruby_string="${rvm_ruby_interpreter}${rvm_ruby_version:+-}${rvm_ruby_version:-}"
  384. if
  385. [[ "${rvm_ruby_interpreter}" == "ext" ]]
  386. then
  387. true # skip checking for external rubies
  388. elif
  389. [[ "${rvm_head_flag:=0}" == "1" || -n "${rvm_ruby_sha:-}" || -n "${rvm_ruby_tag:-}" || -n "${rvm_ruby_repo_tag:-}" ]]
  390. then
  391. if [[ "${rvm_head_flag:=0}" == "1" ]]
  392. then rvm_ruby_string="${rvm_ruby_string}-head"
  393. fi
  394. if [[ -n "${rvm_ruby_sha:-}" ]]
  395. then rvm_ruby_string="${rvm_ruby_string}-s${rvm_ruby_sha}"
  396. elif [[ -n "${rvm_ruby_repo_tag:-}" ]]
  397. then rvm_ruby_string="${rvm_ruby_string}-tag${rvm_ruby_repo_tag}"
  398. elif [[ -n "${rvm_ruby_tag:-}" ]]
  399. then rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_tag}"
  400. fi
  401. if
  402. [[ ! -d "${rvm_rubies_path}/${rvm_ruby_string}" ]] &&
  403. (( ${rvm_fuzzy_flag:-0} == 1 ))
  404. then
  405. \typeset new_ruby_string
  406. new_ruby_string="$(
  407. __rvm_list_strings |
  408. __rvm_grep "^${rvm_ruby_string}.*${rvm_ruby_name:-}" |
  409. __rvm_version_sort |
  410. __rvm_tail -n 1
  411. )"
  412. rvm_ruby_string="${new_ruby_string:-$rvm_ruby_string}"
  413. fi
  414. elif
  415. [[ -n "${rvm_ruby_revision:-}" ]]
  416. then
  417. rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_revision}"
  418. elif
  419. [[ -n "${rvm_ruby_patch_level:-}" ]]
  420. then
  421. rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
  422. elif
  423. [[ -n "${rvm_ruby_user_tag:-}" ]]
  424. then
  425. rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_user_tag}"
  426. else
  427. if
  428. (( ${rvm_fuzzy_flag:-0} == 1 )) &&
  429. [[ "${rvm_ruby_interpreter}" == "ruby" || "${rvm_ruby_interpreter}" == "ree" ]]
  430. then
  431. rvm_ruby_patch_level="$(
  432. __rvm_list_strings |
  433. __rvm_grep "^${rvm_ruby_interpreter}-${rvm_ruby_version}-.*${rvm_ruby_name:-}" |
  434. __rvm_awk -F- '{print $3}' |
  435. __rvm_version_sort |
  436. __rvm_tail -n 1
  437. )"
  438. fi
  439. [[ -n "${rvm_ruby_patch_level:-""}" ]] ||
  440. __rvm_db_system \
  441. "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level" \
  442. rvm_ruby_patch_level
  443. if [[ -n "${rvm_ruby_patch_level:-""}" ]]
  444. then rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
  445. fi
  446. fi
  447. true # OSX --trace FIX
  448. }
  449. __rvm_ruby_strings_exist()
  450. {
  451. for rvm_ruby_string in ${@//,/ }
  452. do
  453. rvm_gemset_name=""
  454. rvm_verbose_flag=0 __rvm_use "${rvm_ruby_string}" >/dev/null 2>&1 || return $?
  455. true rvm_gemset_name:${rvm_gemset_name:=${rvm_expected_gemset_name}}
  456. printf "%b" "${rvm_ruby_string}${rvm_gemset_name:+@}${rvm_gemset_name:-}\n"
  457. done
  458. unset rvm_ruby_string
  459. }