diff --git a/binscripts/rvm-installer b/binscripts/rvm-installer index 9b2fc5ce6c..a7cf6db39f 100755 --- a/binscripts/rvm-installer +++ b/binscripts/rvm-installer @@ -473,17 +473,9 @@ then source ${rvm_scripts_path:-${rvm_path}/scripts}/version __rvm_version - { - echo "Ruby (and needed base gems) for your selection will be installed shortly." - echo "Before it happens, please read and execute the instructions below." - echo "Please use a separate terminal to execute any additional commands." - echo "(use keyboard arrows to navigate)" - echo "Press 'q' to continue." - } | less - for _ruby in ${install_rubies[@]} do - command rvm install ${_ruby} -j 2 + rvm install ${_ruby} -j 2 done for _ruby in ${install_rubies[@]} do diff --git a/scripts/cli b/scripts/cli index dc53b70c60..d8f10c34c5 100755 --- a/scripts/cli +++ b/scripts/cli @@ -212,7 +212,7 @@ __rvm_parse_args() rvm_error_message="Please note that \`rvm $rvm_token ...\` was removed, try \`$rvm_token $next_token $*\` or \`rvm all do $rvm_token $next_token $*\` instead." ;; - fetch|version|srcdir|reset|debug|reload|update|monitor|notes|implode|seppuku|question|answer|env|unexport|requirements|automount|prepare) + fetch|version|srcdir|reset|debug|reload|update|monitor|notes|implode|seppuku|question|answer|env|unexport|automount|prepare) rvm_action=$rvm_token ;; @@ -241,7 +241,7 @@ __rvm_parse_args() rvm_remove_flag=1 ;; - rtfm|RTFM|rvmrc|usage|help|inspect|list|ls|info|strings|get|current|docs|alias|rubygems|cleanup|tools|disk-usage|snapshot|repair|migrate|upgrade|cron|group|switch|which|config-get) + rtfm|RTFM|rvmrc|usage|help|inspect|list|ls|info|strings|get|current|docs|alias|rubygems|cleanup|tools|disk-usage|snapshot|repair|migrate|upgrade|cron|group|switch|which|config-get|requirements) case "$rvm_token" in (ls) rvm_action="list" ;; (usage) rvm_action="help" ;; @@ -1080,14 +1080,7 @@ To reinstall use: [[ $(find $rvm_rubies_path -maxdepth 1 -mindepth 1 -type d 2>/dev/null | wc -l) -eq 0 ]] && rvm_is_a_shell_function no_warning then - { - echo "Ruby (and needed base gems) for your selection will be installed shortly." - echo "Before it happens, please read and execute the instructions below." - echo "Please use a separate terminal to execute any additional commands." - echo "(use keyboard arrows to navigate)" - "$rvm_scripts_path"/requirements - echo "Press 'q' to continue." - } | less + "$rvm_scripts_path"/requirements run fi __rvm_manage_wrapper install "${rvm_ruby_strings}" fi diff --git a/scripts/functions/requirements/arch b/scripts/functions/requirements/arch new file mode 100755 index 0000000000..c0641f5539 --- /dev/null +++ b/scripts/functions/requirements/arch @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +set -e + +function requirements_arch() +{ + typeset -a command_to_run command_flags + command_to_run=() + command_flags=() + + while + (( $# )) + do + case "$1" in + (echo) + command_to_run+=( $1 ) + shift + ;; + (run) + shift + ;; + (force) + command_flags+=( --noconfirm ) + shift + ;; + (*) + break + ;; + esac + done + + (( UID == 0 )) || command_to_run+=( sudo ) + + while + (( $# )) + do + case "$1" in + (update-system) + true + ;; + (rvm) + "${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" bash curl git patch + ;; + (jruby*head) + "${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" jdk7-openjdk jre7-openjdk curl apache-ant + ;; + (jruby*) + "${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" jdk7-openjdk jre7-openjdk curl + ;; + (ir*) + "${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" mono + ;; + (opal) + "${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" nodejs + ;; + (*) + "${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" gcc patch curl zlib readline libxml2 libxslt git autoconf automake diffutils make libtool bison subversion + ;; + esac + shift + done +} + +requirements_arch "$@" diff --git a/scripts/functions/requirements/centos b/scripts/functions/requirements/centos new file mode 100755 index 0000000000..6407f77ef9 --- /dev/null +++ b/scripts/functions/requirements/centos @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +set -e + +function requirements_yum() +{ + typeset -a command_to_run command_flags + command_to_run=() + command_flags=() + + while + (( $# )) + do + case "$1" in + (echo) + command_to_run+=( $1 ) + shift + ;; + (run) + shift + ;; + (force) + command_flags+=( -y ) + shift + ;; + (*) + break + ;; + esac + done + + (( UID == 0 )) || command_to_run+=( sudo ) + + while + (( $# )) + do + case "$1" in + (update-system) + true + ;; + (rvm) + "${command_to_run[@]}" yum install "${command_flags[@]}" bash curl git patch + ;; + (jruby*) + "${command_to_run[@]}" yum install "${command_flags[@]}" java + ;; + (ir*) + true # not that easy + ;; + (opal) + true # not that easy + ;; + (*) + "${command_to_run[@]}" yum install "${command_flags[@]}" gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel + ;; + esac + shift + done +} + +requirements_yum "$@" diff --git a/scripts/functions/requirements/debian b/scripts/functions/requirements/debian new file mode 120000 index 0000000000..7d13753d73 --- /dev/null +++ b/scripts/functions/requirements/debian @@ -0,0 +1 @@ +ubuntu \ No newline at end of file diff --git a/scripts/functions/requirements/fedora b/scripts/functions/requirements/fedora new file mode 120000 index 0000000000..95e1895490 --- /dev/null +++ b/scripts/functions/requirements/fedora @@ -0,0 +1 @@ +centos \ No newline at end of file diff --git a/scripts/functions/requirements/gentoo b/scripts/functions/requirements/gentoo new file mode 100755 index 0000000000..ff0a80eec1 --- /dev/null +++ b/scripts/functions/requirements/gentoo @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +set -e + +function requirements_gentoo() +{ + typeset -a command_to_run command_flags + command_to_run=() + command_flags=() + + while + (( $# )) + do + case "$1" in + (echo) + command_to_run+=( $1 ) + shift + ;; + (force|run) + shift + ;; + (*) + break + ;; + esac + done + + (( UID == 0 )) || command_to_run+=( sudo ) + + while + (( $# )) + do + case "$1" in + (update-system) + "${command_to_run[@]}" emerge --sync + ;; + (rvm) + "${command_to_run[@]}" emerge bash curl git patch + ;; + (jruby*) + "${command_to_run[@]}" emerge dev-java/sun-jdk dev-java/sun-jre-bin + ;; + (ir*) + "${command_to_run[@]}" emerge dev-lang/mono + ;; + (opal) + "${command_to_run[@]}" emerge nodejs + ;; + (*) + "${command_to_run[@]}" emerge libiconv readline zlib openssl curl git libyaml sqlite libxslt libtool gcc autoconf automake bison m4 + ;; + esac + shift + done +} + +requirements_gentoo "$@" diff --git a/scripts/functions/requirements/openbsd b/scripts/functions/requirements/openbsd new file mode 100755 index 0000000000..b759351429 --- /dev/null +++ b/scripts/functions/requirements/openbsd @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +set -e + +function requirements_gentoo() +{ + typeset -a command_to_run __ctr_sudo + typeset __ctr_echo + command_to_run=() + __ctr_sudo=() + __ctr_echo=0 + + while + (( $# )) + do + case "$1" in + (echo) + command_to_run+=( $1 ) + __ctr_echo=1 + shift + ;; + (force) + shift + ;; + (*) + break + ;; + esac + done + + (( UID == 0 )) || + { + command_to_run+=( sudo ) + __ctr_sudo+=( sudo ) + } + + while + (( $# )) + do + case "$1" in + (update-system) + [[ -d /usr/ports ]] || + { + if (( __ctr_echo )) + then echo "curl ftp://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/ports.tar.gz | ${__ctr_sudo[$@]} tar -C /usr -zx" + else curl ftp://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/ports.tar.gz | ${__ctr_sudo[$@]} tar -C /usr -zx + fi + } + ;; + (rvm) + "${command_to_run[@]}" pkg_add bash curl git patch + ;; + (jruby-head*) + "${command_to_run[@]}" pkg_add jdk apache-ant + ;; + (jruby*) + "${command_to_run[@]}" pkg_add jdk + ;; + (ir*) + "${command_to_run[@]}" pkg_add mono + ;; + (opal) + "${command_to_run[@]}" make -C /usr/ports/www/node install clean + ;; + (*) + "${command_to_run[@]}" pkg_add gcc readline libxml2 libxslt autoconf automake diffutils make libtool bison + ;; + esac + shift + done +} + +requirements_gentoo "$@" diff --git a/scripts/functions/requirements/openindiana b/scripts/functions/requirements/openindiana new file mode 100755 index 0000000000..746f854ff4 --- /dev/null +++ b/scripts/functions/requirements/openindiana @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +set -e + +function requirements_gentoo() +{ + typeset -a command_to_run command_flags + command_to_run=() + command_flags=() + + while + (( $# )) + do + case "$1" in + (echo) + command_to_run+=( $1 ) + shift + ;; + (force|run) + shift + ;; + (*) + break + ;; + esac + done + + (( UID == 0 )) || command_to_run+=( sudo ) + + while + (( $# )) + do + case "$1" in + (update-system) + true + ;; + (rvm) + "${command_to_run[@]}" pkg install bash curl git patch + ;; + (jruby-head*) + "${command_to_run[@]}" pkg install jdk apache-ant + ;; + (jruby*) + "${command_to_run[@]}" pkg install jdk + ;; + (ir*) + "${command_to_run[@]}" pkg install mono + ;; + (opal) + "${command_to_run[@]}" pkg install node-devel + ;; + (*) + "${command_to_run[@]}" pkg install text/gnu-patch runtime/gcc developer/library/lint system/header system/library/math/header-math file/gnu-coreutils + ;; + esac + shift + done +} + +requirements_gentoo "$@" diff --git a/scripts/functions/requirements/opensuse b/scripts/functions/requirements/opensuse new file mode 100755 index 0000000000..eb53073a52 --- /dev/null +++ b/scripts/functions/requirements/opensuse @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +set -e + +function requirements_zypper() +{ + typeset -a command_to_run command_flags + command_to_run=() + command_flags=() + + while + (( $# )) + do + case "$1" in + (echo) + command_to_run+=( $1 ) + shift + ;; + (run) + shift + ;; + (force) + command_flags+=( -y ) + shift + ;; + (*) + break + ;; + esac + done + + (( UID == 0 )) || command_to_run+=( sudo ) + + while + (( $# )) + do + case "$1" in + (update-system) + true + ;; + (rvm) + "${command_to_run[@]}" zypper install "${command_flags[@]}" bash curl git patch + ;; + (jruby*) + "${command_to_run[@]}" zypper install "${command_flags[@]}" java + ;; + (ir*) + "${command_to_run[@]}" zypper install "${command_flags[@]}" mono + ;; + (opal) + "${command_to_run[@]}" zypper install "${command_flags[@]}" nodejs + ;; + (*) + "${command_to_run[@]}" zypper install "${command_flags[@]}" patterns-openSUSE-devel_basis gcc-c++ bzip2 readline-devel zlib-devel libxml2-devel libxslt-devel libyaml-devel libopenssl-devel libffi-devel libtool bison + ;; + esac + shift + done +} + +requirements_zypper "$@" diff --git a/scripts/functions/requirements/osx b/scripts/functions/requirements/osx new file mode 100755 index 0000000000..dfc39b1279 --- /dev/null +++ b/scripts/functions/requirements/osx @@ -0,0 +1,118 @@ +#!/usr/bin/env bash + +set -e + +function requirements_brew() +{ + typeset -a command_to_run command_flags + command_to_run=() + command_flags=() + + while + (( $# )) + do + case "$1" in + (echo) + command_to_run+=( $1 ) + shift + ;; + (force|run) + shift + ;; + (*) + break + ;; + esac + done + + (( UID == 0 )) || command_to_run+=( sudo ) + + while + (( $# )) + do + case "$1" in + (update-system) + "${command_to_run[@]}" brew update + "${command_to_run[@]}" brew tap homebrew/dupes + ;; + (rvm) + "${command_to_run[@]}" brew install bash curl git + ;; + (jruby*) + which java >/dev/null 2>&1 || return $? + ;; + (ir*) + which mono >/dev/null 2>&1 || return $? + ;; + (opal) + "${command_to_run[@]}" brew install node + ;; + (*) + "${command_to_run[@]}" brew install autoconf automake apple-gcc42 libtool pkg-config openssl readline libyaml sqlite libxml2 libxslt libksba + ;; + esac + shift + done +} + +# TODO it's the same as unknown +function requirements_osx_show() +{ + typeset -a command_to_run + command_to_run=( echo ) + + while + (( $# )) + do + case "$1" in + (echo) + shift + ;; + (force) + shift + ;; + (*) + break + ;; + esac + done + + while + (( $# )) + do + case "$1" in + (update-system) + "${command_to_run[@]}" "Always update your system first!" + ;; + (rvm) + "${command_to_run[@]}" "Install: bash curl git patch" + ;; + (jruby*) + "${command_to_run[@]}" "Install: openjdk ant" + ;; + (ir*) + "${command_to_run[@]}" "Install: mono" + ;; + (opal) + "${command_to_run[@]}" "Install: nodejs npm" + ;; + (*) + "${command_to_run[@]}" "Install: osx-gcc-installer libksba openssl libreadline git zlib1g libyaml libsqlite3 sqlite3 libxml2 libxslt autoconf libc6 libgdbm ncurses automake libtool bison pkg-config" + ;; + esac + shift + done +} + +requirements_osx() +{ + if + \which brew >/dev/null 2>&1 + then + requirements_brew "$@" + else + requirements_osx_show "$@" + fi +} + +requirements_osx "$@" diff --git a/scripts/functions/requirements/redhat b/scripts/functions/requirements/redhat new file mode 120000 index 0000000000..95e1895490 --- /dev/null +++ b/scripts/functions/requirements/redhat @@ -0,0 +1 @@ +centos \ No newline at end of file diff --git a/scripts/functions/requirements/smartos b/scripts/functions/requirements/smartos new file mode 100755 index 0000000000..dd0767228b --- /dev/null +++ b/scripts/functions/requirements/smartos @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +set -e + +function requirements_gentoo() +{ + typeset -a command_to_run command_flags + command_to_run=() + command_flags=() + + while + (( $# )) + do + case "$1" in + (echo) + command_to_run+=( $1 ) + shift + ;; + (force|run) + shift + ;; + (*) + break + ;; + esac + done + + (( UID == 0 )) || command_to_run+=( sudo ) + + while + (( $# )) + do + case "$1" in + (update-system) + true + ;; + (rvm) + "${command_to_run[@]}" pkgin bash curl git patch + ;; + (jruby-head*) + "${command_to_run[@]}" pkgin jdk apache-ant + ;; + (jruby*) + "${command_to_run[@]}" pkgin jdk + ;; + (ir*) + "${command_to_run[@]}" pkgin mono + ;; + (opal) + "${command_to_run[@]}" pkgin node-devel + ;; + (*) + "${command_to_run[@]}" pkgin coreutils gcc47 gmake readline scmgit-base sqlite3 libxml2 libxslt ncurses autoconf automake + ;; + esac + shift + done +} + +requirements_gentoo "$@" diff --git a/scripts/functions/requirements/solaris b/scripts/functions/requirements/solaris new file mode 100755 index 0000000000..28b2cbb6aa --- /dev/null +++ b/scripts/functions/requirements/solaris @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +set -e + +function requirements_gentoo() +{ + typeset -a command_to_run command_flags + command_to_run=() + command_flags=() + + while + (( $# )) + do + case "$1" in + (echo) + command_to_run+=( $1 ) + shift + ;; + (force|run) + shift + ;; + (*) + break + ;; + esac + done + + (( UID == 0 )) || command_to_run+=( sudo ) + + while + (( $# )) + do + case "$1" in + (update-system) + true + ;; + (rvm) + "${command_to_run[@]}" pkg install bash curl git patch + ;; + (jruby-head*) + "${command_to_run[@]}" pkg install jdk apache-ant + ;; + (jruby*) + "${command_to_run[@]}" pkg install jdk + ;; + (ir*) + "${command_to_run[@]}" pkg install mono + ;; + (opal) + "${command_to_run[@]}" pkg install node-devel + ;; + (*) + "${command_to_run[@]}" pkg install text/gnu-patch developer/gcc-45 developer/library/lint system/header system/library/math/header-math file/gnu-coreutils + ;; + esac + shift + done +} + +requirements_gentoo "$@" diff --git a/scripts/functions/requirements/ubuntu b/scripts/functions/requirements/ubuntu new file mode 100755 index 0000000000..265287fb05 --- /dev/null +++ b/scripts/functions/requirements/ubuntu @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +set -e + +function requirements_apt() +{ + typeset -a command_to_run command_flags + command_to_run=() + command_flags=() + + while + (( $# )) + do + case "$1" in + (echo) + command_to_run+=( $1 ) + shift + ;; + (run) + shift + ;; + (force) + command_flags+=( --quiet --yes ) + shift + ;; + (*) + break + ;; + esac + done + + (( UID == 0 )) || command_to_run+=( sudo ) + + while + (( $# )) + do + case "$1" in + (update-system) + "${command_to_run[@]}" apt-get "${command_flags[@]}" update + ;; + (rvm) + "${command_to_run[@]}" apt-get --no-install-recommends "${command_flags[@]}" install bash curl git patch + ;; + (jruby*head) + "${command_to_run[@]}" apt-get --no-install-recommends "${command_flags[@]}" install ant openjdk-6-jdk + ;; + (jruby*) + "${command_to_run[@]}" apt-get --no-install-recommends "${command_flags[@]}" install curl g++ openjdk-6-jre-headless + ;; + (ir*) + "${command_to_run[@]}" apt-get --no-install-recommends "${command_flags[@]}" install curl mono-2.0-devel + ;; + (opal) + "${command_to_run[@]}" apt-get --no-install-recommends "${command_flags[@]}" install nodejs npm + ;; + (*) + "${command_to_run[@]}" apt-get --no-install-recommends "${command_flags[@]}" install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config + ;; + esac + shift + done +} + +requirements_apt "$@" diff --git a/scripts/functions/requirements/unknown b/scripts/functions/requirements/unknown new file mode 100755 index 0000000000..46b2eaa075 --- /dev/null +++ b/scripts/functions/requirements/unknown @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +set -e + +function requirements_unknown() +{ + typeset -a command_to_run + command_to_run=( echo ) + + while + (( $# )) + do + case "$1" in + (echo|run) + shift + ;; + (force) + shift + ;; + (*) + break + ;; + esac + done + + while + (( $# )) + do + case "$1" in + (update-system) + "${command_to_run[@]}" "Always update your system first!" + ;; + (rvm) + "${command_to_run[@]}" "Install: bash curl git patch" + ;; + (jruby*) + "${command_to_run[@]}" "Install: openjdk ant" + ;; + (ir*) + "${command_to_run[@]}" "Install: mono" + ;; + (opal) + "${command_to_run[@]}" "Install: nodejs npm" + ;; + (*) + "${command_to_run[@]}" "Install: build-essential openssl libreadline git zlib1g libyaml libsqlite3 sqlite3 libxml2 libxslt autoconf libc6 libgdbm ncurses automake libtool bison pkg-config" + ;; + esac + shift + done +} + +requirements_unknown "$@" diff --git a/scripts/functions/utility b/scripts/functions/utility index 0602354aeb..79890f495e 100644 --- a/scripts/functions/utility +++ b/scripts/functions/utility @@ -411,11 +411,10 @@ __rvm_detect_system() _system_type="unknown" _system_name="unknown" _system_version="unknown" - _system_arch="unknown" + _system_arch="$(uname -m)" case "$(uname)" in (Linux) - #TODO: add support for arm?? - _system_arch="$(uname -m | awk '{if($0~"^i[34567]86") print "i386"; else print;}')" + _system_type="linux" if [[ -f /etc/lsb-release ]] && GREP_OPTIONS="" \grep "DISTRIB_ID=Ubuntu" /etc/lsb-release >/dev/null @@ -462,25 +461,30 @@ __rvm_detect_system() ;; (SunOS) _system_type="sunos" + _system_name="solaris" _system_version="$(uname -v)" if - __rvm_string_match "$(uname -v)" "+([[:digit:]]).+([[:digit:]])*" + __rvm_string_match "${_system_version}" "joyent*" then - _system_name="solaris" + _system_name="smartos" + _system_version="${_system_version#* }" elif - __rvm_string_match "$(uname -v)" "oi*" + __rvm_string_match "${_system_version}" "oi*" then _system_name="openindiana" - else - return 3 + _system_version="${_system_version#* }" fi ;; + (OpenBSD) + _system_type="bsd" + _system_name="openbsd" + _system_version="$(uname -r)" + ;; (Darwin) _system_type="darwin" _system_name="osx" _system_version="$(sw_vers -productVersion)" _system_version="${_system_version%.*}" # only major.minor - teeny is ignored - _system_arch="$(uname -m | awk '{if($0~"^i[34567]86") print "i386"; else print;}')" ;; (*) return 1 @@ -490,6 +494,8 @@ __rvm_detect_system() _system_name="${_system_name//[ \/]/_}" _system_version="${_system_version//[ \/]/_}" _system_arch="${_system_arch//[ \/]/_}" + _system_arch="${_system_arch/amd64/x86_64}" + _system_arch="${_system_arch/i[123456789]86/i386}" } # params: [printf_if=-] [suffix] diff --git a/scripts/requirements b/scripts/requirements index d3766fe811..df4fb4ef91 100755 --- a/scripts/requirements +++ b/scripts/requirements @@ -1,369 +1,52 @@ #!/usr/bin/env bash -( # wrap color reseting -if ! typeset -f rvm_pretty_print >/dev/null 2>&1 -then source "${rvm_scripts_path:-"$rvm_path/scripts"}/functions/logging" +if ! typeset -f __rvm_detect_system >/dev/null 2>&1 +then source "${rvm_scripts_path:-"$rvm_path/scripts"}/functions/utility" fi -rvm_pretty_print stdout || unset rvm_error_clr rvm_warn_clr rvm_debug_clr rvm_notify_clr rvm_reset_clr -system="$(uname)" - -if [[ "Linux" == "$system" ]] || [[ "$(uname|tr a-z A-Z)" =~ "BSD" ]] -then - if - [[ -f /etc/lsb-release ]] && release="$( grep "^DISTRIB_DESCRIPTION=" /etc/lsb-release )" - then - release="${release#*=}" - elif - [[ -f /etc/os-release ]] && release="$( grep "^PRETTY_NAME=" /etc/os-release )" - then - release="${release#*=}" - elif - [[ -f /etc/debian_version ]] - then - release="Debian $(cat /etc/debian_version)" - else - for file in /etc/*-release - do - [[ -r $file ]] || continue - release="( $(cat $file) )" +__rvm_detect_system + +command_to_run=( echo ) +command_flags=() + +while + (( $# )) +do + case "$1" in + (echo|run) + command_to_run=( $1 ) + shift + ;; + (force) + command_flags+=( $1 ) + shift + ;; + (*) break - done - fi - printf "%b" " -Requirements for ${system} $release -" + ;; + esac +done - rvm_apt_binary="$( builtin command -v apt-get )" - rvm_emerge_binary="$( builtin command -v emerge )" - rvm_pacman_binary="$( builtin command -v pacman )" - rvm_yum_binary="$( builtin command -v yum )" - rvm_zypper_binary="$( builtin command -v zypper )" - rvm_pkg_add_binary="$( builtin command -v pkg_add )" - - printf "%b" " +case ${1:-echo} in + (echo) + printf "%b" "Requirements for $_system_name/$_system_version/$_system_arch\n" + printf "%b" " NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X) This is the *original* / standard Ruby Language Interpreter 'ree' represents Ruby Enterprise Edition 'rbx' represents Rubinius -bash >= 4.1 required -curl is required -git is required (>= 1.7 for ruby-head) -patch is required (for 1.8 rubies and some ruby-head's). - -To install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head), -then you must install and use rvm 1.8.7 first. -" - - if [[ -n "$rvm_apt_binary" ]] - then - printf "%b" " -Make sure to update system: sudo apt-get update - -Additional Dependencies: -# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: - ruby: sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config - -# optionally for dbm support: sudo apt-get install libgdbm-dev - -# For JRuby, install the following: - jruby: sudo apt-get install curl g++ openjdk-6-jre-headless - jruby-head: sudo apt-get install ant openjdk-6-jdk - -# For IronRuby, install the following: - ironruby: sudo apt-get install curl mono-2.0-devel - -# For Opal, install the following: - opal: sudo apt-get install nodejs npm -" - - elif [[ -n "$rvm_emerge_binary" ]] - then - printf "%b" " -Additional Dependencies: -# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: - ruby|ruby-head: emerge libiconv readline zlib openssl curl git libyaml sqlite libxslt libtool gcc autoconf automake bison m4 - -# For JRuby, install the following: - jruby: emerge dev-java/sun-jdk dev-java/sun-jre-bin - -# For IronRuby, install the following: - ironruby: emerge dev-lang/mono - -# For Opal, install the following: - opal: emerge nodejs - " - - elif [[ -n "$rvm_pacman_binary" ]] - then - printf "%b" " -Additional Dependencies: -# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: - ruby: pacman -Sy --noconfirm gcc patch curl zlib readline libxml2 libxslt git autoconf automake diffutils make libtool bison subversion - -# For JRuby, install the following: - jruby: pacman -Sy --noconfirm jdk7-openjdk jre7-openjdk curl - jruby-head: pacman -Sy apache-ant - -# For IronRuby, install the following: - ironruby: pacman -Sy --noconfirm mono - -# For Opal, install the following: - opal: pacman -S nodejs -" - - elif [[ -n "$rvm_yum_binary" ]] - then - printf "%b" " -Additional Dependencies: -# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: - ruby: yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel ## NOTE: For centos >= 5.4 iconv-devel is provided by glibc - -# For JRuby, install the following: - jruby: yum install -y java -" - - elif [[ -n "$rvm_zypper_binary" ]] - then - printf "%b" " Additional Dependencies: -# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: - ruby: sudo zypper install -y patterns-openSUSE-devel_basis gcc-c++ bzip2 readline-devel zlib-devel - libxml2-devel libxslt-devel libyaml-devel libopenssl-devel libffi45-devel - libtool bison - -# For JRuby, install the following: - jruby: sudo zypper install -y java-1_6_0-sun # Non-Oss repository required -" - - elif [[ -n "$rvm_pkg_add_binary" ]] - then - printf "%b" " -Additional dependencies: -# Ruby / Ruby HEAD (MRI, Rubinius, & REE) -# -# 'patch' and 'zlib' is already in base -# - ruby: pkg_add gcc curl readline libxml2 libxslt git autoconf automake diffutils make libtool bison subversion - -# JRuby -# - jruby: pkg_add jdk curl - jruby-head: pkg_add apache-ant - -# IronRuby -# - ironruby: pkg_add mono - -# Opal -# - opal: pkg_add -r node-devel " - else - printf "%b" " -Additional Dependencies: -# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following with development headers: - ruby: # gcc-c++ patch readline zlib libyaml iconv libxml2 libxslt libtool bison - -# For JRuby, install the following: - jruby: # The SUN java runtime environment and development kit. - -# For IronRuby, install the following: - ironruby: #The Mono Runtime and Development Platform (version 2.6 or greater is recommended). - -# For Opal, install the following: - opal: # Nodejs with NPM (version 0.8 or greater is recommended) -" - fi -elif [[ "SunOS" == "$system" ]] -then - version="$(uname -v)" - if [[ "11.0" == "$version" ]] - then - # looks like Solaris 11 - printf "%b" " -RVM requirements for Solaris 11: - -# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: - ruby: pkg install text/gnu-patch developer/gcc-45 developer/library/lint system/header \\ - system/library/math/header-math file/gnu-coreutils - -# For JRuby, install the following: - jruby: # The Oracle java runtime environment and development kit. - -# For Opal, install the following: - opal: # Nodejs with NPM (version 0.8 or greater is recommended) -" - elif [[ "$version" =~ ^oi ]] - then - # looks like OpenIndiana - printf "%b" " -RVM requirements for OpenIndiana - -# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: - ruby: pkg install text/gnu-patch runtime/gcc developer/library/lint system/header \\ - system/library/math/header-math file/gnu-coreutils - -# For JRuby, install the following: - jruby: # The Oracle java runtime environment and development kit. - -# For Opal, install the following: -opal: # Nodejs with NPM (version 0.8 or greater is recommended) -" - elif [[ "$version" =~ ^joyent ]] - then - # looks like SmartOS - printf "%b" " -RVM requirements for SmartOS - -# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: - ruby: sudo pkgin install coreutils patch gcc47 gmake readline curl scmgit-base sqlite3 \\ - libxml2 libxslt ncurses autoconf automake - -# For JRuby, install the following: - jruby: sudo pkgin install sun-jdk6 -" - else - printf "%b" " -RVM requirements for unrecognised Solaris system. - -# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: - ruby: you will need to install: gcc, gnu-patch, lint library, system header, system - math header and gnu-coreutils. - - Check you package publisher(s) for installing these. - -# For JRuby, install the following: - jruby: # The Oracle java runtime environment and development kit. -" - fi -elif [[ "$MACHTYPE" == *darwin* ]] -then - - if ! typeset -f __rvm_detect_xcode_version > /dev/null 2>&1 - then source $rvm_path/scripts/functions/utility - fi - - release="$( sw_vers -productName )" - version="$( sw_vers -productVersion )" - xcode_version="$( __rvm_detect_xcode_version 2>&1 )" - : ${xcode_version:=0} - - printf "%b" " - Notes for ${release} ${version}" - if __rvm_version_compare "$xcode_version" -eq 0 - then - printf "%b" ", No Xcode. -" - else - printf "%b" ", Xcode $xcode_version. -" - fi - - if __rvm_version_compare "$xcode_version" -ge 4.2 - then - printf "%b" " -For MacRuby: Install LLVM first. -" - fi - printf "%b" " -For JRuby: Install the JDK. See http://developer.apple.com/java/download/ # Current Java version \"1.6.0_26\" -For IronRuby: Install Mono >= 2.6 -For Ruby 1.9.3: Install libksba # If using Homebrew, 'brew install libksba' -For Opal: Install Nodejs with NPM. See http://nodejs.org/download/ - -To use an RVM installed Ruby as default, instead of the system ruby: - - rvm install 1.8.7 # installs patch 357: closest supported version - rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system.gems # migrate your gems - rvm alias create default 1.8.7 - -And reopen your terminal windows. -" - - if __rvm_version_compare "$xcode_version" -gt 0 && __rvm_version_compare "$xcode_version" -lt 4.1 - then - printf "%b" " -** Please note that Xcode 3.x will *not* work on OS X Lion. For notes about Xcode 4.1 and later, see below: -" - fi - - printf "%b" " -${rvm_error_clr:-}Xcode and gcc${rvm_reset_clr:-}: - -Right now Ruby requires gcc to compile, but Xcode 4.2 and later no longer ship with gcc. Instead they ship with llvm-gcc (to which gcc is a symlink) and clang, neither of which are supported for building Ruby. Xcode 4.1 was the last version to ship gcc, which was /usr/bin/gcc-4.2. - -${rvm_notify_clr:-}Xcode 4.1${rvm_reset_clr:-} and earlier: -- Ruby will build fine. - -${rvm_error_clr:-}Xcode 4.2${rvm_reset_clr:-} and later (including Command Line Tools for Xcode): -- If you have gcc-4.2 (and friends) from an earlier Xcode version, Ruby will build fine. -- If you don't have gcc-4.2, you have two options to get it: - * Install apple-gcc42 from Homebrew - * Install osx-gcc-installer - - ${rvm_notify_clr:-}Homebrew${rvm_reset_clr:-}: - - If you are using Homebrew, you can install the apple-gcc42 and required libraries from homebrew/dupes: - - brew update - brew tap homebrew/dupes - brew install autoconf automake apple-gcc42 - rvm pkg install openssl - - Xcode 4.2+ install or/and Command Line Tools for Xcode is required to provide make and other tools. - - ${rvm_notify_clr:-}osx-gcc-installer${rvm_reset_clr:-}: - - If you don't use Homebrew, you can download and install osx-gcc-installer: https://github.com/kennethreitz/osx-gcc-installer. - - ${rvm_error_clr:-}Warning${rvm_reset_clr:-}: Installing osx-gcc-installer on top of a recent Xcode is known to cause problems, so you must uninstall Xcode before installing osx-gcc-installer. Afterwards you may install Xcode 4.2+ or Command Line Tools for Xcode if you desire. - - ** NOTE: Currently, Node.js is having issues building with osx-gcc-installer. The only fix is to install Xcode over osx-gcc-installer. -" - - if (( UID == 0 )) || [[ "$rvm_path" == "/usr/local/rvm" ]] - then - printf "%b" " -${rvm_notify_clr:-}RVM Group Membership Management${rvm_reset_clr:-} - With Multi-User installations, the RVM installer automatically -creates an 'rvm' group which, as the RVM documentation explains, administrators must add the users they wish -to let use the RVM installation to. The call is made in the installer as: - - ${rvm_notify_clr:-}sudo dscl . -create /Groups/\$rvm_group_name gid \$gid${rvm_reset_clr:-} - -wherein RVM creates the gid by checking for the last assigned gid and adding 1. To physicially add a user to -the group, administrators must use: - - ${rvm_notify_clr:-}sudo dscl localhost -append /Local/Default/Groups/rvm GroupMembership \$user_name${rvm_notify_clr:-} - -To check on group membership to the RVM group, administrators would execute the following: - - ${rvm_notify_clr:-}rvmsudo dscl localhost -read /Local/Default/Groups/rvm${rvm_reset_clr:-} - -Pay attention to the GroupMembership and PrimaryGroupID lines. This tells you who is in it, and the GID for the RVM group. -Afterwards, should administrators wish to remove users from the group, they would execute: - - ${rvm_notify_clr:-}sudo dscl localhost -delete /Local/Default/Groups/rvm GroupMembership \$user_name${rvm_reset_clr:-} - ${rvm_notify_clr:-}sudo dsmemberutil flushcache${rvm_reset_clr:-} - -This will keep the 'rvm' group, but remove the listed user from it. They can directly delete the rvm group with: - - ${rvm_notify_clr:-}sudo dscl . -delete /Groups/rvm && sudo dsmemberutil flushcache${rvm_reset_clr:-} - -without previously deleting users from the group, as well. This will completely remove the 'rvm' group from the system. -Please note, the call to 'dsmemberutil flushcache' is required on both removal of the user from the group, and/or -removal of the group directly because that membership is still cached locally until either reboot or sync with -Directory Services. Allowing the group membership to stay in the user's 'groups' output does not mean the user is -automatically re-added to the 'rvm' group should the group be subsequently be re-added. This means the user(s) end up -erroneously showing they are part of the 'rvm' group even though they actually are not, if the call to 'dsmemberutil' -is not made. By this we mean the 'groups' command will still show them a part of the 'rvm' group, even if the user -logs out and then back in, due to caching. This applies to Tiger, Leopard, Snow Leopard, and Lion. Previous versions of -the OS such as Cheetah/Puma, and Jaguar used 'nicl', a.k.a NetInfo, and not 'dscl'. -" - fi -fi - -printf "%b" "\n" - -) # Finish color resetting block + for _type in update-system rvm ruby jruby + do + printf "%b" "# For $_type:\n" + bash "${rvm_scripts_path:-"$rvm_path/scripts"}/functions/requirements/$_system_name" "${command_to_run[@]}" "${command_flags[@]}" $_type + printf "%b" "\n" + done + ;; + (run) + printf "%b" "Installing requirements for $_system_name/$_system_version/$_system_arch\n" + bash "${rvm_scripts_path:-"$rvm_path/scripts"}/functions/requirements/$_system_name" "${command_to_run[@]}" force update-system rvm ${1:-ruby} + ;; +esac