redis requires Ruby version >= 2.2.2.

后端开发   发布日期:2025年06月28日   浏览次数:100

安装RVM

 

无法在服务器使用curl命令访问https域名,原因是nss版本有点旧了,yum -y update nss更新一下

yum -y update nss

新建rvm-installer.sh

chmod +x rvm-installer.sh

./rvm-installer.sh

安装一个ruby版本
rvm install 2.3.3

使用一个ruby版本
rvm use 2.3.3

  1. #!/usr/bin/env bash
  2. shopt -s extglob
  3. set -o errtrace
  4. set -o errexit
  5. rvm_install_initialize()
  6. {
  7. DEFAULT_SOURCES=(github.com/rvm/rvm bitbucket.org/mpapis/rvm)
  8. BASH_MIN_VERSION="3.2.25"
  9. if
  10. [[ -n "${BASH_VERSION:-}" &&
  11. "$(\printf "%b" "${BASH_VERSION:-}\n${BASH_MIN_VERSION}\n" | LC_ALL=C \sort -t"." -k1,1n -k2,2n -k3,3n | \head -n1)" != "${BASH_MIN_VERSION}"
  12. ]]
  13. then
  14. echo "BASH ${BASH_MIN_VERSION} required (you have $BASH_VERSION)"
  15. exit 1
  16. fi
  17. export HOME PS4
  18. export rvm_trace_flag rvm_debug_flag rvm_user_install_flag rvm_ignore_rvmrc rvm_prefix rvm_path
  19. PS4="+ \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
  20. }
  21. log() { printf "%b\n" "$*"; }
  22. debug(){ [[ ${rvm_debug_flag:-0} -eq 0 ]] || printf "%b\n" "Running($#): $*"; }
  23. fail() { log "\nERROR: $*\n" ; exit 1 ; }
  24. rvm_install_commands_setup()
  25. {
  26. \which which >/dev/null 2>&1 || fail "Could not find 'which' command, make sure it's available first before continuing installation."
  27. if
  28. [[ -z "${rvm_tar_command:-}" ]] && builtin command -v gtar >/dev/null
  29. then
  30. rvm_tar_command=gtar
  31. elif
  32. ${rvm_tar_command:-tar} --help 2>&1 | GREP_OPTIONS="" \grep -- --strip-components >/dev/null
  33. then
  34. rvm_tar_command="${rvm_tar_command:-tar}"
  35. else
  36. case "$(uname)" in
  37. (OpenBSD)
  38. log "Trying to install GNU version of tar, might require sudo password"
  39. if (( UID ))
  40. then sudo pkg_add -z gtar-1
  41. else pkg_add -z gtar-1
  42. fi
  43. rvm_tar_command=gtar
  44. ;;
  45. (Darwin|FreeBSD|DragonFly) # it's not possible to autodetect on OSX, the help/man does not mention all flags
  46. rvm_tar_command=tar
  47. ;;
  48. (SunOS)
  49. case "$(uname -r)" in
  50. (5.10)
  51. log "Trying to install GNU version of tar, might require sudo password"
  52. if (( UID ))
  53. then
  54. if \which sudo >/dev/null 2>&1
  55. then sudo_10=sudo
  56. elif \which /opt/csw/bin/sudo >/dev/null 2>&1
  57. then sudo_10=/opt/csw/bin/sudo
  58. else fail "sudo is required but not found. You may install sudo from OpenCSW repository (http://opencsw.org/about)"
  59. fi
  60. pkginfo -q CSWpkgutil || $sudo_10 pkgadd -a $rvm_path/config/solaris/noask -d http://get.opencsw.org/now CSWpkgutil
  61. sudo /opt/csw/bin/pkgutil -iy CSWgtar -t http://mirror.opencsw.org/opencsw/unstable
  62. else
  63. pkginfo -q CSWpkgutil || pkgadd -a $rvm_path/config/solaris/noask -d http://get.opencsw.org/now CSWpkgutil
  64. /opt/csw/bin/pkgutil -iy CSWgtar -t http://mirror.opencsw.org/opencsw/unstable
  65. fi
  66. rvm_tar_command=/opt/csw/bin/gtar
  67. ;;
  68. (*)
  69. rvm_tar_command=tar
  70. ;;
  71. esac
  72. esac
  73. builtin command -v ${rvm_tar_command:-gtar} >/dev/null ||
  74. fail "Could not find GNU compatible version of 'tar' command, make sure it's available first before continuing installation."
  75. fi
  76. if
  77. [[ " ${rvm_tar_options:-} " != *" --no-same-owner "* ]] &&
  78. $rvm_tar_command --help 2>&1 | GREP_OPTIONS="" \grep -- --no-same-owner >/dev/null
  79. then
  80. rvm_tar_options="${rvm_tar_options:-}${rvm_tar_options:+ }--no-same-owner"
  81. fi
  82. }
  83. usage()
  84. {
  85. printf "%b" "
  86. Usage
  87. rvm-installer [options] [action]
  88. Options
  89. [[--]version] <version>
  90. The version or tag to install. Valid values are:
  91. latest - The latest tagged version.
  92. latest-minor - The latest minor version of the current major version.
  93. latest-<x> - The latest minor version of version x.
  94. latest-<x>.<y> - The latest patch version of version x.y.
  95. <x>.<y>.<z> - Major version x, minor version y and patch z.
  96. [--]branch <branch>
  97. The name of the branch from which RVM is installed. This option can be used
  98. with the following formats for <branch>:
  99. <account>/
  100. If account is wayneeseguin or mpapis, installs from one of the following:
  101. https://github.com/rvm/rvm/archive/master.tar.gz
  102. https://bitbucket.org/mpapis/rvm/get/master.tar.gz
  103. Otherwise, installs from:
  104. https://github.com/<account>/rvm/archive/master.tar.gz
  105. <account>/<branch>
  106. If account is wayneeseguin or mpapis, installs from one of the following:
  107. https://github.com/rvm/rvm/archive/<branch>.tar.gz
  108. https://bitbucket.org/mpapis/rvm/get/<branch>.tar.gz
  109. Otherwise, installs from:
  110. https://github.com/<account>/rvm/archive/<branch>.tar.gz
  111. [/]<branch>
  112. Installs the branch from one of the following:
  113. https://github.com/rvm/rvm/archive/<branch>.tar.gz
  114. https://bitbucket.org/mpapis/rvm/get/<branch>.tar.gz
  115. [--]source <source>
  116. Defines the repository from which RVM is retrieved and installed in the format:
  117. <domain>/<account>/<repo>
  118. Where:
  119. <domain> - Is bitbucket.org, github.com or a github enterprise site serving
  120. an RVM repository.
  121. <account> - Is the user account in which the RVM repository resides.
  122. <repo> - Is the name of the RVM repository.
  123. Note that when using the [--]source option, one should only use the [/]branch format
  124. with the [--]branch option. Failure to do so will result in undefined behavior.
  125. --trace
  126. Provides debug logging for the installation script.
  127. Actions
  128. master - Installs RVM from the master branch at rvm/rvm on github or mpapis/rvm
  129. on bitbucket.org.
  130. stable - Installs RVM from the stable branch a rvm/rvm on github or mpapis/rvm
  131. on bitbucket.org.
  132. help - Displays this output.
  133. "
  134. }
  135. ## duplication marker 32fosjfjsznkjneuera48jae
  136. __rvm_curl_output_control()
  137. {
  138. if
  139. (( ${rvm_quiet_curl_flag:-0} == 1 ))
  140. then
  141. __flags+=( "--silent" "--show-error" )
  142. elif
  143. [[ " $*" == *" -s"* || " $*" == *" --silent"* ]]
  144. then
  145. # make sure --show-error is used with --silent
  146. [[ " $*" == *" -S"* || " $*" == *" -sS"* || " $*" == *" --show-error"* ]] ||
  147. {
  148. __flags+=( "--show-error" )
  149. }
  150. fi
  151. }
  152. ## duplication marker 32fosjfjsznkjneuera48jae
  153. # -S is automatically added to -s
  154. __rvm_curl()
  155. (
  156. __rvm_which curl >/dev/null ||
  157. {
  158. rvm_error "RVM requires 'curl'. Install 'curl' first and try again."
  159. return 200
  160. }
  161. typeset -a __flags
  162. __flags=( --fail --location --max-redirs 10 )
  163. [[ "$*" == *"--max-time"* ]] ||
  164. [[ "$*" == *"--connect-timeout"* ]] ||
  165. __flags+=( --connect-timeout 30 --retry-delay 2 --retry 3 )
  166. if [[ -n "${rvm_proxy:-}" ]]
  167. then __flags+=( --proxy "${rvm_proxy:-}" )
  168. fi
  169. __rvm_curl_output_control
  170. unset curl
  171. __rvm_debug_command \curl "${__flags[@]}" "$@" || return $?
  172. )
  173. rvm_error() { printf "ERROR: %b\n" "$*"; }
  174. __rvm_which(){ which "$@" || return $?; true; }
  175. __rvm_debug_command()
  176. {
  177. debug "Running($#): $*"
  178. "$@" || return $?
  179. true
  180. }
  181. rvm_is_a_shell_function()
  182. {
  183. [[ -t 0 && -t 1 ]] || return $?
  184. return ${rvm_is_not_a_shell_function:-0}
  185. }
  186. # Searches the tags for the highest available version matching a given pattern.
  187. # fetch_version (github.com/rvm/rvm bitbucket.org/mpapis/rvm) 1.10. -> 1.10.3
  188. # fetch_version (github.com/rvm/rvm bitbucket.org/mpapis/rvm) 1.10. -> 1.10.3
  189. # fetch_version (github.com/rvm/rvm bitbucket.org/mpapis/rvm) 1. -> 1.11.0
  190. # fetch_version (github.com/rvm/rvm bitbucket.org/mpapis/rvm) "" -> 2.0.1
  191. fetch_version()
  192. {
  193. typeset _account _domain _pattern _repo _sources _values _version
  194. _sources=(${!1})
  195. _pattern=$2
  196. for _source in "${_sources[@]}"
  197. do
  198. IFS='/' read -r _domain _account _repo <<< "${_source}"
  199. _version="$(
  200. fetch_versions ${_domain} ${_account} ${_repo} |
  201. GREP_OPTIONS="" \grep "^${_pattern:-}" | tail -n 1
  202. )"
  203. if
  204. [[ -n ${_version} ]]
  205. then
  206. echo "${_version}"
  207. return 0
  208. fi
  209. done
  210. }
  211. # Returns a sorted list of all version tags from a repository
  212. fetch_versions()
  213. {
  214. typeset _account _domain _repo _url
  215. _domain=$1
  216. _account=$2
  217. _repo=$3
  218. case ${_domain} in
  219. (bitbucket.org)
  220. _url=https://${_domain}/api/1.0/repositories/${_account}/${_repo}/branches-tags
  221. ;;
  222. (github.com)
  223. _url=https://api.${_domain}/repos/${_account}/${_repo}/tags
  224. ;;
  225. (*)
  226. _url=https://${_domain}/api/v3/repos/${_account}/${_repo}/tags
  227. ;;
  228. esac
  229. __rvm_curl -s ${_url} |
  230. \awk -v RS=',' -v FS='"' '$2=="name"{print $4}' |
  231. sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n
  232. }
  233. install_release()
  234. {
  235. typeset _source _sources _url _version _verify_pgp
  236. _sources=(${!1})
  237. _version=$2
  238. debug "Downloading RVM version ${_version}"
  239. for _source in "${_sources[@]}"
  240. do
  241. case ${_source} in
  242. (bitbucket.org*)
  243. _url="https://${_source}/get/${_version}.tar.gz"
  244. _verify_pgp="https://${_source}/downloads/${_version}.tar.gz.asc"
  245. ;;
  246. (*)
  247. _url="https://${_source}/archive/${_version}.tar.gz"
  248. _verify_pgp="https://${_source}/releases/download/${_version}/${_version}.tar.gz.asc"
  249. ;;
  250. esac
  251. get_and_unpack "${_url}" "rvm-${_version}.tgz" "$_verify_pgp" && return
  252. done
  253. return $?
  254. }
  255. install_head()
  256. {
  257. typeset _branch _source _sources _url
  258. _sources=(${!1})
  259. _branch=$2
  260. debug "Selected RVM branch ${_branch}"
  261. for _source in "${_sources[@]}"
  262. do
  263. case ${_source} in
  264. (bitbucket.org*)
  265. _url=https://${_source}/get/${_branch}.tar.gz
  266. ;;
  267. (*)
  268. _url=https://${_source}/archive/${_branch}.tar.gz
  269. ;;
  270. esac
  271. get_and_unpack "${_url}" "rvm-${_branch//\//_}.tgz" && return
  272. done
  273. return $?
  274. }
  275. # duplication marker dfkjdjngdfjngjcszncv
  276. # Drop in cd which _doesn't_ respect cdpath
  277. __rvm_cd()
  278. {
  279. typeset old_cdpath ret
  280. ret=0
  281. old_cdpath="${CDPATH}"
  282. CDPATH="."
  283. chpwd_functions="" builtin cd "$@" || ret=$?
  284. CDPATH="${old_cdpath}"
  285. return $ret
  286. }
  287. get_package()
  288. {
  289. typeset _url _file
  290. _url="$1"
  291. _file="$2"
  292. log "Downloading ${_url}"
  293. __rvm_curl -sS ${_url} -o ${rvm_archives_path}/${_file} ||
  294. {
  295. _return=$?
  296. case $_return in
  297. # duplication marker lfdgzkngdkjvnfjknkjvcnbjkncvjxbn
  298. (60)
  299. log "
  300. Could not download '${_url}', you can read more about it here:
  301. https://rvm.io/support/fixing-broken-ssl-certificates/
  302. To continue in insecure mode run 'echo insecure >> ~/.curlrc'.
  303. "
  304. ;;
  305. # duplication marker lfdgzkngdkjvnfjknkjvcnbjkncvjxbn
  306. (77)
  307. log "
  308. It looks like you have old certificates, you can read more about it here:
  309. https://rvm.io/support/fixing-broken-ssl-certificates/
  310. "
  311. ;;
  312. # duplication marker lfdgzkngdkjvnfjknkjvcnbjkncvjxbn
  313. (141)
  314. log "
  315. Curl returned 141 - it is result of a segfault which means it's Curls fault.
  316. Try again and if it crashes more than a couple of times you either need to
  317. reinstall Curl or consult with your distribution manual and contact support.
  318. "
  319. ;;
  320. (*)
  321. log "
  322. Could not download '${_url}'.
  323. curl returned status '$_return'.
  324. "
  325. ;;
  326. esac
  327. return $_return
  328. }
  329. }
  330. # duplication marker flnglfdjkngjndkfjhsbdjgfghdsgfklgg
  331. rvm_install_gpg_setup()
  332. {
  333. export rvm_gpg_command
  334. {
  335. rvm_gpg_command="$( \which gpg2 2>/dev/null )" &&
  336. [[ ${rvm_gpg_command} != "/cygdrive/"* ]]
  337. } ||
  338. rvm_gpg_command="$( \which gpg 2>/dev/null )" ||
  339. rvm_gpg_command=""
  340. debug "Detected GPG program: '$rvm_gpg_command'"
  341. [[ -n "$rvm_gpg_command" ]] || return $?
  342. }
  343. # duplication marker rdjgndfnghdfnhgfdhbghdbfhgbfdhbn
  344. verify_package_pgp()
  345. {
  346. if
  347. "${rvm_gpg_command}" --verify "$2" "$1"
  348. then
  349. log "GPG verified '$1'"
  350. else
  351. typeset _ret=$?
  352. log "\
  353. Warning, RVM 1.26.0 introduces signed releases and \
  354. automated check of signatures when GPG software found.
  355. Assuming you trust Michal Papis import the mpapis public \
  356. key (downloading the signatures).
  357. GPG signature verification failed for '$1' - '$3'!
  358. try downloading the signatures:
  359. ${SUDO_USER:+sudo }${rvm_gpg_command##*/} --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
  360. or if it fails:
  361. command curl -sSL https://rvm.io/mpapis.asc | ${SUDO_USER:+sudo }${rvm_gpg_command##*/} --import -
  362. the key can be compared with:
  363. https://rvm.io/mpapis.asc
  364. https://keybase.io/mpapis
  365. "
  366. exit $_ret
  367. fi
  368. }
  369. verify_pgp()
  370. {
  371. [[ -n "${1:-}" ]] ||
  372. {
  373. debug "No PGP url given, skipping."
  374. return 0
  375. }
  376. get_package "$1" "$2.asc" ||
  377. {
  378. debug "PGP url given but does not exist: '$1'"
  379. return 0
  380. }
  381. rvm_install_gpg_setup ||
  382. {
  383. log "Found PGP signature at: '$1',
  384. but no GPG software exists to validate it, skipping."
  385. return 0
  386. }
  387. verify_package_pgp "${rvm_archives_path}/$2" "${rvm_archives_path}/$2.asc" "$1"
  388. }
  389. get_and_unpack()
  390. {
  391. typeset _url _file _patern _return _verify_pgp
  392. _url="$1"
  393. _file="$2"
  394. _verify_pgp="$3"
  395. get_package "$_url" "$_file" || return $?
  396. verify_pgp "$_verify_pgp" "$_file" || return $?
  397. [[ -d "${rvm_src_path}/rvm" ]] || \mkdir -p "${rvm_src_path}/rvm"
  398. __rvm_cd "${rvm_src_path}/rvm" ||
  399. {
  400. _return=$?
  401. log "Could not change directory '${rvm_src_path}/rvm'."
  402. return $_return
  403. }
  404. rm -rf ${rvm_src_path}/rvm/*
  405. __rvm_debug_command $rvm_tar_command xzf ${rvm_archives_path}/${_file} ${rvm_tar_options:-} --strip-components 1 ||
  406. {
  407. _return=$?
  408. log "Could not extract RVM sources."
  409. return $_return
  410. }
  411. }
  412. rvm_install_default_settings()
  413. {
  414. # Tracing, if asked for.
  415. if
  416. [[ "$*" == *--trace* ]] || (( ${rvm_trace_flag:-0} > 0 ))
  417. then
  418. set -o xtrace
  419. rvm_trace_flag=1
  420. fi
  421. # Variable initialization, remove trailing slashes if they exist on HOME
  422. true \
  423. ${rvm_trace_flag:=0} ${rvm_debug_flag:=0}\
  424. ${rvm_ignore_rvmrc:=0} HOME="${HOME%%+(\/)}"
  425. if
  426. (( rvm_ignore_rvmrc == 0 ))
  427. then
  428. for rvmrc in /etc/rvmrc "$HOME/.rvmrc"
  429. do
  430. if
  431. [[ -s "$rvmrc" ]]
  432. then
  433. if
  434. GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
  435. then
  436. printf "%b" "
  437. Error: $rvmrc is for rvm settings only.
  438. rvm CLI may NOT be called from within $rvmrc.
  439. Skipping the loading of $rvmrc
  440. "
  441. exit 1
  442. else
  443. source "$rvmrc"
  444. fi
  445. fi
  446. done
  447. fi
  448. if
  449. [[ -z "${rvm_path:-}" ]]
  450. then
  451. if
  452. (( UID == 0 ))
  453. then
  454. rvm_user_install_flag=0
  455. rvm_prefix="/usr/local"
  456. rvm_path="${rvm_prefix}/rvm"
  457. else
  458. rvm_user_install_flag=1
  459. rvm_prefix="$HOME"
  460. rvm_path="${rvm_prefix}/.rvm"
  461. fi
  462. fi
  463. if [[ -z "${rvm_prefix}" ]]
  464. then rvm_prefix=$( dirname $rvm_path )
  465. fi
  466. # duplication marker kkdfkgnjfndgjkndfjkgnkfjdgn
  467. [[ -n "${rvm_user_install_flag:-}" ]] ||
  468. case "$rvm_path" in
  469. (/usr/local/rvm) rvm_user_install_flag=0 ;;
  470. ($HOME/*|/${USER// /_}*) rvm_user_install_flag=1 ;;
  471. (*) rvm_user_install_flag=0 ;;
  472. esac
  473. }
  474. rvm_install_parse_params()
  475. {
  476. install_rubies=()
  477. install_gems=()
  478. flags=( ./scripts/install )
  479. forwarded_flags=()
  480. while
  481. (( $# > 0 ))
  482. do
  483. token="$1"
  484. shift
  485. case "$token" in
  486. (--trace)
  487. set -o xtrace
  488. rvm_trace_flag=1
  489. flags=( -x "${flags[@]}" "$token" )
  490. forwarded_flags+=( "$token" )
  491. ;;
  492. (--debug|--quiet-curl)
  493. flags+=( "$token" )
  494. forwarded_flags+=( "$token" )
  495. token=${token#--}
  496. token=${token//-/_}
  497. export "rvm_${token}_flag"=1
  498. printf "%b" "Turning on ${token/_/ } mode.\n"
  499. ;;
  500. (--path)
  501. if [[ -n "${1:-}" ]]
  502. then
  503. rvm_path="$1"
  504. shift
  505. else
  506. fail "--path must be followed by a path."
  507. fi
  508. ;;
  509. (--branch|branch) # Install RVM from a given branch
  510. if [[ -n "${1:-}" ]]
  511. then
  512. case "$1" in
  513. (/*)
  514. branch=${1#/}
  515. ;;
  516. (*/)
  517. branch=master
  518. if [[ "${1%/}" -ne wayneeseguin ]] && [[ "${1%/}" -ne mpapis ]]
  519. then sources=(github.com/${1%/}/rvm)
  520. fi
  521. ;;
  522. (*/*)
  523. branch=${1#*/}
  524. if [[ "${1%%/*}" -ne wayneeseguin ]] && [[ "${1%%/*}" -ne mpapis ]]
  525. then sources=(github.com/${1%%/*}/rvm)
  526. fi
  527. ;;
  528. (*)
  529. branch="$1"
  530. ;;
  531. esac
  532. shift
  533. else
  534. fail "--branch must be followed by a branchname."
  535. fi
  536. ;;
  537. (--source|source)
  538. if [[ -n "${1:-}" ]]
  539. then
  540. if [[ "$1" = */*/* ]]
  541. then
  542. sources=($1)
  543. shift
  544. else
  545. fail "--source must be in the format <domain>/<account>/<repo>."
  546. fi
  547. else
  548. fail "--source must be followed by a source."
  549. fi
  550. ;;
  551. (--user-install|--ignore-dotfiles)
  552. token=${token#--}
  553. token=${token//-/_}
  554. export "rvm_${token}_flag"=1
  555. printf "%b" "Turning on ${token/_/ } mode.\n"
  556. ;;
  557. (--auto-dotfiles)
  558. flags+=( "$token" )
  559. export "rvm_auto_dotfiles_flag"=1
  560. printf "%b" "Turning on auto dotfiles mode.\n"
  561. ;;
  562. (--auto)
  563. export "rvm_auto_dotfiles_flag"=1
  564. printf "%b" "Warning, --auto is deprecated in favor of --auto-dotfiles.\n"
  565. ;;
  566. (--verify-downloads)
  567. if [[ -n "${1:-}" ]]
  568. then
  569. export rvm_verify_downloads_flag="$1"
  570. forwarded_flags+=( "$token" "$1" )
  571. shift
  572. else
  573. fail "--verify-downloads must be followed by level(0|1|2)."
  574. fi
  575. ;;
  576. (--autolibs=*)
  577. flags+=( "$token" )
  578. export rvm_autolibs_flag="${token#--autolibs=}"
  579. forwarded_flags+=( "$token" )
  580. ;;
  581. (--without-gems=*|--with-gems=*|--with-default-gems=*)
  582. flags+=( "$token" )
  583. value="${token#*=}"
  584. token="${token%%=*}"
  585. token="${token#--}"
  586. token="${token//-/_}"
  587. export "rvm_${token}"="${value}"
  588. printf "%b" "Installing RVM ${token/_/ }: ${value}.\n"
  589. ;;
  590. (--version|version)
  591. version="$1"
  592. shift
  593. ;;
  594. (head|master)
  595. version="head"
  596. branch="master"
  597. ;;
  598. (stable)
  599. version="latest"
  600. ;;
  601. (latest|latest-*|+([[:digit:]]).+([[:digit:]]).+([[:digit:]]))
  602. version="$token"
  603. ;;
  604. (--ruby)
  605. install_rubies+=( ruby )
  606. ;;
  607. (--ruby=*)
  608. token=${token#--ruby=}
  609. install_rubies+=( ${token//,/ } )
  610. ;;
  611. (--rails)
  612. install_gems+=( rails )
  613. ;;
  614. (--gems=*)
  615. token=${token#--gems=}
  616. install_gems+=( ${token//,/ } )
  617. ;;
  618. (--add-to-rvm-group)
  619. export rvm_add_users_to_rvm_group="$1"
  620. shift
  621. ;;
  622. (help|usage)
  623. usage
  624. exit 0
  625. ;;
  626. (*)
  627. usage
  628. exit 1
  629. ;;
  630. esac
  631. done
  632. if (( ${#install_gems[@]} > 0 && ${#install_rubies[@]} == 0 ))
  633. then install_rubies=( ruby )
  634. fi
  635. true "${version:=head}"
  636. true "${branch:=master}"
  637. if [[ -z "${sources[@]}" ]]
  638. then sources=("${DEFAULT_SOURCES[@]}")
  639. fi
  640. rvm_src_path="$rvm_path/src"
  641. rvm_archives_path="$rvm_path/archives"
  642. rvm_releases_url="https://rvm.io/releases"
  643. }
  644. rvm_install_validate_rvm_path()
  645. {
  646. case "$rvm_path" in
  647. (*[[:space:]]*)
  648. printf "%b" "
  649. It looks you are one of the happy *space* users(in home dir name),
  650. RVM is not yet fully ready for it, use this trick to fix it:
  651. sudo mkdir -p /${USER// /_}.rvm
  652. sudo chown -R \"$USER:\" /${USER// /_}.rvm
  653. echo \"export rvm_path=/${USER// /_}.rvm\" >> \"$HOME/.rvmrc\"
  654. and start installing again.
  655. "
  656. exit 2
  657. ;;
  658. (/usr/share/ruby-rvm)
  659. printf "%b" "
  660. It looks you are one of the happy Ubuntu users,
  661. RVM packaged by Ubuntu is old and broken,
  662. follow this link for details how to fix:
  663. http://stackoverflow.com/a/9056395/497756
  664. "
  665. [[ "${rvm_uses_broken_ubuntu_path:-no}" == "yes" ]] || exit 3
  666. ;;
  667. esac
  668. if [[ "$rvm_path" != "/"* ]]
  669. then fail "The rvm install path must be fully qualified. Tried $rvm_path"
  670. fi
  671. }
  672. rvm_install_select_and_get_version()
  673. {
  674. typeset _version_release
  675. for dir in "$rvm_src_path" "$rvm_archives_path"
  676. do
  677. [[ -d "$dir" ]] || mkdir -p "$dir"
  678. done
  679. _version_release="${version}"
  680. case "${version}" in
  681. (head)
  682. _version_release="${branch}"
  683. install_head sources[@] ${branch:-master} || exit $?
  684. ;;
  685. (latest)
  686. install_release sources[@] $(fetch_version sources[@]) || exit $?
  687. ;;
  688. (latest-minor)
  689. version="$(\cat "$rvm_path/VERSION")"
  690. install_release sources[@] $(fetch_version sources[@] ${version%.*}) || exit $?
  691. ;;
  692. (latest-*)
  693. install_release sources[@] $(fetch_version sources[@] ${version#latest-}) || exit $?
  694. ;;
  695. (+([[:digit:]]).+([[:digit:]]).+([[:digit:]])) # x.y.z
  696. install_release sources[@] ${version} || exit $?
  697. ;;
  698. (*)
  699. fail "Something went wrong, unrecognized version '$version'"
  700. ;;
  701. esac
  702. echo "${_version_release}" > "$rvm_path/RELEASE"
  703. }
  704. rvm_install_main()
  705. {
  706. [[ -f ./scripts/install ]] ||
  707. {
  708. log "'./scripts/install' can not be found for installation, something went wrong, it usally means your 'tar' is broken, please report it here: https://github.com/rvm/rvm/issues"
  709. return 127
  710. }
  711. # required flag - path to install
  712. flags+=( --path "$rvm_path" )
  713. \command bash "${flags[@]}"
  714. }
  715. rvm_install_ruby_and_gems()
  716. (
  717. if
  718. (( ${#install_rubies[@]} > 0 ))
  719. then
  720. source ${rvm_scripts_path:-${rvm_path}/scripts}/rvm
  721. source ${rvm_scripts_path:-${rvm_path}/scripts}/version
  722. __rvm_version
  723. for _ruby in ${install_rubies[@]}
  724. do command rvm "${forwarded_flags[@]}" install ${_ruby} -j 2
  725. done
  726. # set the first one as default, skip rest
  727. for _ruby in ${install_rubies[@]}
  728. do
  729. rvm "${forwarded_flags[@]}" alias create default ${_ruby}
  730. break
  731. done
  732. for _gem in ${install_gems[@]}
  733. do rvm "${forwarded_flags[@]}" all do gem install ${_gem}
  734. done
  735. printf "%b" "
  736. * To start using RVM you need to run \`source $rvm_path/scripts/rvm\`
  737. in all your open shell windows, in rare cases you need to reopen all shell windows.
  738. "
  739. if
  740. [[ "${install_gems[*]}" == *"rails"* ]]
  741. then
  742. printf "%b" "
  743. * To start using rails you need to run \`rails new <project_dir>\`.
  744. "
  745. fi
  746. fi
  747. )
  748. rvm_install()
  749. {
  750. rvm_install_initialize
  751. rvm_install_commands_setup
  752. rvm_install_default_settings
  753. rvm_install_parse_params "$@"
  754. rvm_install_validate_rvm_path
  755. rvm_install_select_and_get_version
  756. rvm_install_main
  757. rvm_install_ruby_and_gems
  758. }
  759. rvm_install "$@"

  

以上就是redis requires Ruby version >= 2.2.2.的详细内容,更多关于redis requires Ruby version >= 2.2.2.的资料请关注九品源码其它相关文章!