Skip to content

Instantly share code, notes, and snippets.

@mabonyi
Created May 4, 2012 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mabonyi/2591552 to your computer and use it in GitHub Desktop.
Save mabonyi/2591552 to your computer and use it in GitHub Desktop.
( export 'PS4=+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > ' ; set -v ; rvm --trace info rvm )
03:41:37 rug@leviathan:~ ruby-1.9.3-p194
$ ( export 'PS4=+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > ' ; set -v ; rvm --trace info rvm )
rvm_project_rvmrc=1
rvm_trust_rvmrcs_flag=1
rvm_gem_options="--no-rdoc --no-ri"
rvm_path=/usr/local/rvm
rvm_pretty_print_flag=1
rvm_auto_reload_flag=1
rvm_ps1=1
#rvm_stored_umask=0000
umask g+w
cat "$rvm_path/VERSION"
cat "$rvm_path/RELEASE" 2>/dev/null
#!/usr/bin/env bash
# Base is a collection of general files + commonly included setup functions.
: rvm_trace_flag:${rvm_trace_flag:=0}
if (( rvm_trace_flag > 0 ))
then
set -o xtrace
# set -o errexit
if [[ -z "${ZSH_VERSION:-}" ]]
then
# set -o errtrace
# set -o pipefail
export PS4
PS4="+ \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
fi
elif [[ ${rvm_debug_flag:-0} > 0 ]]
then
rvm_debug_flag=0
fi
export __array_start rvm_path >/dev/null
#
# Setup environment parameters.
#
if [[ -n "${ZSH_VERSION:-}" ]]
then
__array_start=1
else
__array_start=0
fi
if (( ${rvm_ignore_rvmrc:=0} == 0 ))
then
: rvm_stored_umask:${rvm_stored_umask:=$(umask)}
for rvmrc in /etc/rvmrc "$HOME/.rvmrc"
do
if [[ -f "$rvmrc" ]]
then
if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "%b" "
Error:
$rvmrc is for rvm settings only.
rvm CLI may NOT be called from within $rvmrc.
Skipping the loading of $rvmrc"
return 1
else
source "$rvmrc"
fi
fi
done
fi
rvm_project_rvmrc=1
rvm_trust_rvmrcs_flag=1
rvm_gem_options="--no-rdoc --no-ri"
rvm_path=/usr/local/rvm
rvm_pretty_print_flag=1
rvm_auto_reload_flag=1
rvm_ps1=1
#rvm_stored_umask=0000
umask g+w
export rvm_path
if [[ -z "${rvm_path:-}" ]]
then
if (( UID == 0 )) && [[ -d "/usr/local/rvm" ]]
then rvm_path="/usr/local/rvm"
elif [[ -d "${HOME}/.rvm" ]]
then rvm_path="${HOME}/.rvm"
elif [[ -d "/usr/local/rvm" ]]
then rvm_path="/usr/local/rvm"
else echo "Can't find rvm install!" 1>&2 ; exit 1
fi
fi
true ${rvm_scripts_path:="$rvm_path/scripts"}
# Initialize all main RVM variables.
source "$rvm_scripts_path/initialize"
#!/usr/bin/env bash
: rvm_trace_flag:${rvm_trace_flag:=0}
if (( rvm_trace_flag > 0 ))
then
set -o xtrace
# set -o errexit
if [[ -z "${ZSH_VERSION:-}" ]]
then
# set -o errtrace
# set -o pipefail
export PS4
PS4="+ \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
fi
elif [[ ${rvm_debug_flag:-0} > 0 ]]
then
rvm_debug_flag=0
fi
# Set shell options that RVM cannot live without,
# see __rvm_setup and __rvm_teardown for further settings.
if [[ -n "${BASH_VERSION:-}" ]]
then
shopt -s extglob
elif [[ -n "${ZSH_VERSION:-}" ]]
then
setopt extendedglob
setopt kshglob
setopt no_glob_subst
else
printf "%b" "What the heck kind of shell are you running here???\n"
fi
export __rvm_env_loaded
# set env loaded flag if not yet set
: __rvm_env_loaded:${__rvm_env_loaded:=0}:
# increase load count counter
: __rvm_env_loaded:$(( __rvm_env_loaded+=1 )):
# load only if not yet loaded or first time loading
if [[ -z "${rvm_tmp_path:-}" ]] || (( __rvm_env_loaded == 1 ))
then
if typeset -f __rvm_cleanse_variables >/dev/null 2>&1
then
__rvm_cleanse_variables
fi
# Ensure that /etc/rvmrc and $HOME/.rvmrc values take precedence.
if (( ${rvm_ignore_rvmrc:=0} == 0 ))
then
: rvm_stored_umask:${rvm_stored_umask:=$(umask)}
for rvmrc in /etc/rvmrc "$HOME/.rvmrc"
do
if [[ -f "$rvmrc" ]]
then
if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "%b" "
Error:
$rvmrc is for rvm settings only.
rvm CLI may NOT be called from within $rvmrc.
Skipping the loading of $rvmrc"
return 1
else
source "$rvmrc"
fi
fi
done
fi
export rvm_path
if [[ -z "${rvm_path:-}" ]]
then
if (( UID == 0 )) && [[ -d "/usr/local/rvm" ]]
then rvm_path="/usr/local/rvm"
elif [[ -d "${HOME}/.rvm" ]]
then rvm_path="${HOME}/.rvm"
elif [[ -d "/usr/local/rvm" ]]
then rvm_path="/usr/local/rvm"
else echo "Can't find rvm install!" 1>&2 ; exit 1
fi
fi
true ${rvm_scripts_path:="$rvm_path/scripts"}
#
# Setup RVM Environment variables. Each RVM internal path is intended to be
# configurable by the end users for whatever their needs may be.
# They should be set in /etc/rvmrc and then $HOME/.rvmrc
#
if [[ -z "${rvm_user_install_flag:-}" ]]
then
export rvm_user_install_flag rvm_man_path
if (( UID == 0 )) ||
[[ -n "${rvm_prefix:-}" && "${rvm_prefix:-}" != "${HOME}" ]]
then
true "${rvm_man_path:="${rvm_prefix}/share/man"}"
rvm_user_install_flag=0
else
rvm_user_install_flag=1
fi
fi
: \
rvm_bin_path:${rvm_bin_path:="$rvm_path/bin"} \
rvm_man_path:${rvm_man_path:="$rvm_path/man"} \
rvm_archives_path:${rvm_archives_path:="$rvm_path/archives"} \
rvm_docs_path:${rvm_docs_path:="$rvm_path/docs"} \
rvm_environments_path:${rvm_environments_path:="$rvm_path/environments"} \
rvm_examples_path:${rvm_examples_path:="$rvm_path/examples"} \
rvm_gems_path:${rvm_gems_path:="$rvm_path/gems"} \
rvm_gemsets_path:${rvm_gemsets_path:="$rvm_path/gemsets"} \
rvm_help_path:${rvm_help_path:="$rvm_path/help"} \
rvm_hooks_path:${rvm_hooks_path:="$rvm_path/hooks"} \
rvm_lib_path:${rvm_lib_path:="$rvm_path/lib"} \
rvm_log_path:${rvm_log_path:="$rvm_path/log"} \
rvm_patches_path:${rvm_patches_path:="$rvm_path/patches"} \
rvm_repos_path:${rvm_repos_path:="$rvm_path/repos"} \
rvm_rubies_path:${rvm_rubies_path:="$rvm_path/rubies"} \
rvm_externals_path:${rvm_externals_path:="$rvm_path/externals"} \
rvm_rubygems_path:${rvm_rubygems_path:="$rvm_path/rubygems"} \
rvm_src_path:${rvm_src_path:="$rvm_path/src"} \
rvm_tmp_path:${rvm_tmp_path:="$rvm_path/tmp"} \
rvm_user_path:${rvm_user_path:="$rvm_path/user"} \
rvm_usr_path:${rvm_usr_path:="$rvm_path/usr"} \
rvm_wrappers_path:${rvm_wrappers_path:="$rvm_path/wrappers"} \
rvm_verbose_flag:${rvm_verbose_flag:=0} \
rvm_debug_flag:${rvm_debug_flag:=0} \
rvm_gems_cache_path:${rvm_gems_cache_path:=${rvm_gems_path:-"$rvm_path/gems"}/cache}
export rvm_action rvm_alias_expanded rvm_archive_extension rvm_archives_path rvm_bin_flag rvm_bin_path rvm_configure_flags 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_hook rvm_hooks_path rvm_install_args rvm_install_on_use_flag rvm_lib_path rvm_llvm_flag rvm_loaded_flag rvm_log_path rvm_make_flags rvm_niceness rvm_nightly_flag rvm_only_path_flag rvm_parse_break rvm_patch_names rvm_patch_original_pwd rvm_patches_path rvm_path rvm_pretty_print_flag rvm_proxy rvm_quiet_flag rvm_ree_options rvm_reload_flag rvm_remove_flag rvm_repos_path rvm_rubies_path rvm_ruby_alias rvm_ruby_aliases 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_load_path 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_require 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_wrapper_name rvm_wrappers_path rvm_ruby_repo_branch rvm_man_path rvm_architectures
fi # if [[ -z "${rvm_tmp_path:-}" ]] || (( __rvm_env_loaded == 1 ))
rvm_project_rvmrc=1
rvm_trust_rvmrcs_flag=1
rvm_gem_options="--no-rdoc --no-ri"
rvm_path=/usr/local/rvm
rvm_pretty_print_flag=1
rvm_auto_reload_flag=1
rvm_ps1=1
#rvm_stored_umask=0000
umask g+w
rvm_project_rvmrc=1
rvm_trust_rvmrcs_flag=1
rvm_gem_options="--no-rdoc --no-ri"
rvm_path=/usr/local/rvm
rvm_pretty_print_flag=1
rvm_auto_reload_flag=1
rvm_ps1=1
#rvm_stored_umask=0000
umask g+w
rvm_project_rvmrc=1
rvm_trust_rvmrcs_flag=1
rvm_gem_options="--no-rdoc --no-ri"
rvm_path=/usr/local/rvm
rvm_pretty_print_flag=1
rvm_auto_reload_flag=1
rvm_ps1=1
#rvm_stored_umask=0000
umask g+w
# Load the general scripts.
# Use rvm_base_except="selector", for example, to override the loading.
case " ${rvm_base_except:-} " in
(*[[:space:]]selector[[:space:]]*)
true # do not load.
;;
(*)
source "$rvm_scripts_path/selector"
source "$rvm_scripts_path/selector_gemsets"
;;
esac
#!/usr/bin/env bash
# __rvm_select implementation version patch_level
__rvm_select()
{
true ${rvm_gemset_name:=}
typeset _original_env_string
_original_env_string=${rvm_env_string}
# Set Variable Defaults
export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
export rvm_env_string rvm_action rvm_alias_expanded rvm_archive_extension rvm_bin_flag rvm_bin_path rvm_configure_flags 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_args rvm_install_on_use_flag rvm_llvm_flag rvm_loaded_flag rvm_make_flags rvm_niceness rvm_nightly_flag rvm_only_path_flag rvm_parse_break rvm_patch_names rvm_patch_original_pwd rvm_pretty_print_flag rvm_proxy rvm_quiet_flag rvm_ree_options rvm_reload_flag rvm_remove_flag rvm_ruby_alias rvm_ruby_aliases 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_load_path 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_require 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_wrapper_name rvm_architectures
if [[ -z "${rvm_ruby_string:-}" ]]
then # First we build rvm_ruby_string from components if it is empty.
if [[ -n "${rvm_ruby_interpreter:-}" ]]
then
rvm_ruby_string="$rvm_ruby_interpreter"
fi
if [[ -n "${rvm_ruby_version:-}" ]]
then
rvm_ruby_string="$rvm_ruby_string-$rvm_ruby_version"
fi
if [[ -n "${rvm_ruby_patch_level:-}" ]]
then
rvm_ruby_string="$rvm_ruby_string-$rvm_ruby_patch_level"
fi
if [[ -n "${rvm_ruby_revision:-}" ]]
then
rvm_ruby_string="$rvm_ruby_string-$rvm_ruby_revision"
fi
if [[ -n "${rvm_ruby_name:-}" ]]
then
rvm_ruby_name="$rvm_ruby_string-$rvm_ruby_name"
fi
fi
__rvm_ruby_string || return $?
rvm_archive_extension="tar.gz"
if [[ -z "${rvm_ruby_interpreter:-}" ]]
then
rvm_ruby_interpreter="${rvm_ruby_string//-*/}"
fi
case "$rvm_ruby_interpreter" in
macruby)
if [[ "Darwin" == "$(uname)" ]]
then
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
if (( ${rvm_head_flag:=0} == 1 ))
then
rvm_ruby_version="" ; rvm_ruby_tag=""
rvm_ruby_revision="head"
__rvm_db "macruby_repo_url" "rvm_ruby_repo_url"
rvm_ruby_url="$rvm_ruby_repo_url"
elif [[ "nightly" == "${rvm_ruby_version:-}" ]]
then
__rvm_db "macruby_nightly_url" "rvm_ruby_url"
rvm_ruby_package_name="${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}"
rvm_ruby_package_file="$rvm_ruby_package_name"
elif [[ -n "${rvm_ruby_version:-}" ]]
then
__rvm_db "macruby_url" "rvm_ruby_url"
rvm_ruby_package_name="MacRuby%20${rvm_ruby_version}.zip"
rvm_ruby_package_file="$rvm_ruby_package_name"
rvm_ruby_url="$rvm_ruby_url/$rvm_ruby_package_name"
else
__rvm_db "macruby_version" "rvm_ruby_version"
__rvm_db "macruby_url" "rvm_ruby_url"
rvm_ruby_package_name="MacRuby%20${rvm_ruby_version}.zip"
rvm_ruby_package_file="$rvm_ruby_package_name"
rvm_ruby_url="$rvm_ruby_url/$rvm_ruby_package_name"
fi
rvm_ruby_patch_level=""
else
rvm_error "MacRuby can only be installed on a Darwin OS."
fi
;;
rbx|rubinius)
rvm_archive_extension="tar.gz"
rvm_ruby_interpreter="rbx"
rvm_ruby_version=${rvm_ruby_version:-$(__rvm_db "rbx_version")}
rvm_ruby_repo_url=${rvm_rbx_repo_url:-$(__rvm_db "rubinius_repo_url")}
rbx_url=${rbx_url:-$(__rvm_db "rbx_url")}
rvm_ruby_patch_level=""
case "${rvm_ruby_version}" in
(2.0pre)
rvm_ruby_repo_branch="master" ;;
(2.0.testing)
rvm_ruby_repo_branch="${rvm_ruby_version}" ;;
esac
if (( ${rvm_head_flag:=0} == 0 ))
then
rvm_ruby_url="${rbx_url}"
rvm_ruby_package_file="rubinius-${rvm_ruby_version}.${rvm_archive_extension}"
rvm_ruby_url="$rvm_ruby_url/$rvm_ruby_package_file"
else
rvm_ruby_version="head"
fi
if [[ -n "${rvm_rbx_opt:-}" ]]
then
export RBXOPT="${RBXOPT:=${rvm_rbx_opt}}"
fi
;;
jruby)
rvm_ruby_patch_level=""
if (( ${rvm_head_flag:=0} == 1 ))
then
rvm_ruby_version="head"
rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
elif [[ -n ${rvm_configure_flags:-} ]]
then
rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "jruby_version")"}"
rvm_ruby_tag="${rvm_ruby_tag:-${rvm_ruby_version}}"
else
rvm_archive_extension="tar.gz"
rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "jruby_version")"}"
jruby_url="$(__rvm_db "jruby_url")"
rvm_ruby_package_file="${rvm_ruby_interpreter}-bin-${rvm_ruby_version}"
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
rvm_ruby_url="${jruby_url}/${rvm_ruby_version}/${rvm_ruby_package_file}.tar.gz"
jruby_url=""
fi
alias jruby_ng="jruby --ng"
alias jruby_ng_server="jruby --ng-server"
;;
maglev)
rvm_ruby_patch_level=""
maglev_url="$(__rvm_db "maglev_url")"
system="$(uname -s)"
if [[ "$MACHTYPE" == x86_64-apple-darwin* ]]
then
arch="i386" # Anyone else hear circus musik? ;)
else
arch="$(uname -m)"
fi
if (( ${rvm_head_flag:=0} == 1 )) || [[ "$rvm_ruby_version" == "head" ]]
then
rvm_head_flag=1
rvm_ruby_version="head"
rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "maglev_repo_url")}"
rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "maglev_repo_url")}"
rvm_gemstone_version=$(
command curl -s https://raw.github.com/MagLev/maglev/master/version.txt |
GREP_OPTIONS="" \grep ^GEMSTONE | cut -f2 -d-
)
rvm_gemstone_package_file="GemStone-${rvm_gemstone_version}.${system}-${arch}"
else
rvm_ruby_package_file="MagLev-${rvm_ruby_version}" # removed from 1.0: .${system}-${arch}
rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "maglev_version")"}"
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
rvm_ruby_url="${rvm_ruby_url:-"$maglev_url/${rvm_ruby_package_file}.${rvm_archive_extension}"}"
rvm_gemstone_version=$(
version_tag_commit=$(
command curl -s http://github.com/api/v2/yaml/repos/show/MagLev/maglev/tags |
awk '/MagLev-'${rvm_ruby_version}':/ {print $2 }'
)
command curl -s https://raw.github.com/MagLev/maglev/$version_tag_commit/version.txt |
GREP_OPTIONS="" \grep ^GEMSTONE | cut -f2 -d-
)
rvm_gemstone_package_file="GemStone-${rvm_gemstone_version}.${system}-${arch}"
export MAGLEV_HOME="$rvm_rubies_path/$rvm_ruby_string"
fi
rvm_gemstone_url="$maglev_url/${rvm_gemstone_package_file}.${rvm_archive_extension}"
;;
ironruby)
rvm_ruby_patch_level=""
if (( ${rvm_head_flag:=0} == 1 ))
then
rvm_ruby_version="head"
rvm_ruby_package_name="${rvm_ruby_string}"
rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
else
rvm_archive_extension="zip"
rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "ironruby_version")"}
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}.${rvm_archive_extension}"
rvm_ruby_url="$(__rvm_db "ironruby_${rvm_ruby_version}_url")${rvm_ruby_package_file}"
fi
export rvm_ruby_version rvm_ruby_string rvm_ruby_package_name rvm_ruby_repo_url rvm_ruby_url rvm_archive_extension
;;
ree)
rvm_ruby_interpreter=ree
rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "ree_version")"}
case "$rvm_ruby_version" in
1.8.*) true ;; # all good!
*) rvm_error "Unknown Ruby Enterprise Edition version: $rvm_ruby_version" ;;
esac
if [[ -n "${rvm_ruby_patch_level:-0}" ]]
then
rvm_ruby_patch_level="$(echo $rvm_ruby_patch_level | \sed 's#^p##')"
fi
rvm_ruby_package_file="ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level"
rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_${rvm_ruby_patch_level}_url")"
rvm_ruby_url="${rvm_ruby_url:-$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")}"
rvm_ruby_url="${rvm_ruby_url}/$rvm_ruby_package_file.tar.gz"
;;
kiji)
rvm_ruby_interpreter="kiji"
rvm_ruby_version="head"
rvm_head_flag=1
rvm_ruby_string="kiji-head"
rvm_ruby_patch_level=""
rvm_ruby_repo_url=${rvm_mput_repo_url:-"$(__rvm_db "kiji_repo_url")"}
rvm_ruby_url=$rvm_ruby_repo_url
rvm_ruby_configure="" ; rvm_ruby_make="" ; rvm_ruby_make_install=""
;;
goruby)
rvm_ruby_interpreter="goruby"
rvm_ruby_version="head"
rvm_ruby_string="goruby"
rvm_ruby_patch_level=""
rvm_ruby_repo_url=${rvm_mput_repo_url:-"$(__rvm_db "goruby_repo_url")"}
rvm_ruby_url=$rvm_ruby_repo_url
rvm_ruby_configure="" ; rvm_ruby_make="" ; rvm_ruby_make_install=""
;;
tcs)
rvm_ruby_interpreter="tcs"
rvm_ruby_version="head"
rvm_ruby_string="tcs"
rvm_ruby_patch_level=""
rvm_ruby_repo_url=${rvm_tcs_repo_url:-"$(__rvm_db "tcs_repo_url")"}
rvm_ruby_url=$rvm_ruby_repo_url
rvm_ruby_repo_branch="${rvm_ruby_repo_branch:-"$(__rvm_db "tcs_repo_branch")"}"
export rvm_head_flag=1
rvm_ruby_configure="" ; rvm_ruby_make="" ; rvm_ruby_make_install=""
;;
ruby)
if [[ -n "${rvm_ruby_patch_level}" ]]
then
rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}-${rvm_ruby_patch_level}"
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}-${rvm_ruby_patch_level}"
else
rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}"
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
fi
if [[ -z "${rvm_ruby_version:-""}" ]] && (( ${rvm_head_flag:=0} == 0 ))
then
rvm_error "Ruby version was not specified!"
else
rvm_ruby_repo_url="${rvm_ruby_repo_url:-"$(__rvm_db "ruby_repo_url")"}"
if (( ${rvm_head_flag:=0} == 0 ))
then
case "${rvm_ruby_version}" in
(1.8.4)
rvm_archive_extension="tar.gz"
;;
(*)
rvm_archive_extension="tar.bz2"
;;
esac
fi
fi
;;
ext)
if [[ -z "${rvm_ruby_name:-${detected_rvm_ruby_name:-}}" ]]
then
rvm_error "External ruby name was not specified!"
fi
;;
current)
ruby_binary="$(builtin command -v ruby)"
if (( $? == 0)) && match "$ruby_binary" "*rvm*"
then
rvm_ruby_string="$(dirname "$ruby_binary" | xargs dirname | xargs basename)"
else
rvm_ruby_interpreter="system"
fi
;;
default|system|user)
# no-op?
;;
*)
if [[ -n "${MY_RUBY_HOME:-""}" ]]
then
rvm_ruby_string=$(basename $MY_RUBY_HOME)
__rvm_select
else
if [[ -z "${rvm_ruby_string:-""}" ]]
then
rvm_error "Ruby implementation '$rvm_ruby_interpreter' is not known."
return 1
fi
fi
esac
if [[ -n "$rvm_ruby_version" ]]
then
case "$rvm_ruby_version" in
(+([[:digit:]]).+([[:digit:]]).+([[:digit:]]))
rvm_ruby_release_version="${rvm_ruby_version/.*/}"
rvm_ruby_major_version=${rvm_ruby_version%.*} ; rvm_ruby_major_version=${rvm_ruby_major_version#*.}
rvm_ruby_minor_version="${rvm_ruby_version//*.}"
;;
(+([[:digit:]]).+([[:digit:]]))
rvm_ruby_release_version="${rvm_ruby_version/.*/}"
rvm_ruby_major_version="${rvm_ruby_version#*.}"
rvm_ruby_minor_version=""
;;
esac
fi
if [[ "${rvm_ruby_interpreter}" == ext ]]
then
rvm_ruby_home="$rvm_externals_path/$rvm_ruby_string"
rvm_ruby_irbrc="$rvm_ruby_home/.irbrc"
rvm_ruby_binary="$( readlink $rvm_ruby_home/bin/ruby )"
else
rvm_ruby_package_name="${rvm_ruby_package_name:-${rvm_ruby_string//-n*}}"
rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_string"
rvm_ruby_irbrc="$rvm_ruby_home/.irbrc"
rvm_ruby_binary="$rvm_ruby_home/bin/ruby"
fi
# TODO is this right place to do this ?
if [[ "maglev" == "$rvm_ruby_interpreter" ]]
then
export MAGLEV_HOME="$rvm_ruby_home"
export GEMSTONE_GLOBAL_DIR=$MAGLEV_HOME
fi
if [[ "system" != "$rvm_ruby_interpreter" ]]
then
__rvm_gemset_select
case $? in
1|3|4)
return 1
;;
esac
fi
rvm_ruby_selected_flag=1
if [[ -d "${rvm_log_path}/$rvm_ruby_string" ]]
then
\mkdir -p "${rvm_log_path}/$rvm_ruby_string"
fi
rvm_ruby_interpreter="${rvm_ruby_interpreter:-system}"
}
__rvm_use_system() {
unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
new_path="$(__rvm_remove_rvm_from_path ; printf "%b" "$PATH"):${rvm_bin_path}"
if [[ -s "$rvm_path/config/system" ]]
then
if GREP_OPTIONS="" \grep "MY_RUBY_HOME='$rvm_rubies_path" "$rvm_path/config/system" > /dev/null
then
# 'system' should *not* point to an rvm ruby.
if [[ -f "$rvm_path/config/system" ]]
then
\rm -f "$rvm_path/config/system"
fi
else
source "$rvm_path/config/system"
fi
fi
if (( ${rvm_default_flag:=0} == 1 ))
then
"$rvm_scripts_path/alias" delete default &> /dev/null
\find "${rvm_bin_path}" -maxdepth 0 -name 'default_*' -delete
\rm -f "$rvm_path/config/default"
\rm -f "$rvm_environments_path/default"
__rvm_rm_rf "$rvm_wrappers_path/default"
fi
# Check binaries, remove under the condition they're symlinks.
if (( ${rvm_user_install_flag:=0} == 0 ))
then
for binary in ruby gem irb ri rdoc rake erb testrb
do
full_binary_path="${rvm_bin_path}/$binary"
if [[ -L "$full_binary_path" ]]
then
\rm -f "$full_binary_path"
fi
done
fi
if (( ${rvm_verbose_flag:=0} == 1 ))
then
rvm_log "Now using system ruby."
fi
__rvm_remove_rvm_from_path
new_path="$PATH:${rvm_bin_path}"
export rvm_ruby_string="system"
}
__rvm_use()
{
typeset new_path binary full_binary_path rvm_ruby_gem_home
__rvm_select "$@" || return $?
if [[ "system" == ${rvm_ruby_interpreter:="system"} ]]
then
__rvm_use_system
else
if [[ ! -d "$rvm_ruby_home" ]]
then
if [[ ${rvm_install_on_use_flag:-0} -eq 1 ]]
then
rvm_warn "$rvm_ruby_string is not installed."
"$rvm_scripts_path/manage" "install" "$rvm_ruby_string"
else
rvm_error "$rvm_ruby_string is not installed."
rvm_log "To install do: 'rvm install $rvm_ruby_string'"
return 1
fi
fi
if [[ ! -d "$rvm_ruby_gem_home" || -n "${rvm_expected_gemset_name}" ]]
then
if (( ${rvm_gemset_create_on_use_flag:=0} == 1 || ${rvm_create_flag:=0} == 1 ))
then
rvm_warn "gemset $rvm_gemset_name is not existing, creating."
"$rvm_scripts_path/gemsets" create "$rvm_gemset_name"
else
rvm_error "Gemset '${rvm_expected_gemset_name}' does not exist, 'rvm gemset create ${rvm_expected_gemset_name}' first, or append '--create'."
return 2
fi
fi
export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
GEM_HOME="$rvm_ruby_gem_home"
GEM_PATH="$rvm_ruby_gem_path"
MY_RUBY_HOME="$rvm_ruby_home"
RUBY_VERSION="$rvm_ruby_string"
IRBRC="$rvm_ruby_irbrc"
unset BUNDLE_PATH # Ensure that BUNDLE_PATH is not set!
# Handle MagLev pre-installed gems
if [[ "maglev" == "$rvm_ruby_interpreter" ]]
then
GEM_PATH="$GEM_PATH:$MAGLEV_HOME/lib/maglev/gems/1.8/"
fi
[[ -n "${IRBRC:-}" ]] || unset IRBRC
# Ensure the environment file for the selected ruby exists.
__rvm_ensure_has_environment_files
if (( ${rvm_verbose_flag:=0} == 1 ))
then
rvm_log "Using ${GEM_HOME/${rvm_gemset_separator:-'@'}/ with gemset }"
fi
if [[ "$GEM_HOME" != "$rvm_ruby_global_gems_path" ]]
then
new_path="$GEM_HOME/bin:$rvm_ruby_global_gems_path/bin:$MY_RUBY_HOME/bin:${rvm_bin_path}:$(__rvm_remove_rvm_from_path ;printf "%b" "$PATH")"
else
new_path="$GEM_HOME/bin:$MY_RUBY_HOME/bin:${rvm_bin_path}:$(__rvm_remove_rvm_from_path ;printf "%b" "$PATH")"
fi
fi
[[ -z "${rvm_ruby_string:-}" ]] || export rvm_ruby_string
[[ -z "${rvm_gemset_name:-}" ]] || export rvm_gemset_name
if [[ -n "$new_path" ]]
then
export PATH="$new_path"
unset new_path
builtin hash -r
fi
if [[ "$rvm_ruby_string" != "system" ]]
then
case "${rvm_rvmrc_flag:-0}" in
(rvmrc|versions_conf|ruby_version)
__rvm_set_${rvm_rvmrc_flag}
;;
esac
typeset environment_id
environment_id="$(__rvm_env_string)"
if (( ${rvm_default_flag:=0} == 1 )) &&
[[ "default" != "${rvm_ruby_interpreter:-}" ]] &&
[[ "system" != "${rvm_ruby_interpreter:-}" ]]
then
# Switch the default alias to the new environment id
"$rvm_scripts_path/alias" delete default &> /dev/null
"$rvm_scripts_path/alias" create default "$environment_id" >& /dev/null
fi
rvm_default_flag=0
if [[ -n "${rvm_wrapper_name:-}" ]]
then
"$rvm_scripts_path/wrapper" "$environment_id" "$rvm_wrapper_name" > /dev/null 2>&1
rvm_wrapper_name=""
fi
if [[ -n "${rvm_ruby_alias:-}" ]]
then
rvm_log "Attempting to alias $environment_id to $rvm_ruby_alias"
"$rvm_scripts_path/alias" delete "$rvm_ruby_alias" > /dev/null 2>&1
rvm_alias_expanded=1 "$rvm_scripts_path/alias" create "$rvm_ruby_alias" "$environment_id" > /dev/null 2>&1
ruby_alias="" ; rvm_ruby_alias=""
fi
if [[ "maglev" == "${rvm_ruby_interpreter:-""}" ]]
then
export MAGLEV_HOME="$rvm_ruby_home"
export GEMSTONE_GLOBAL_DIR=$MAGLEV_HOME
if [[ -x "$MAGLEV_HOME/gemstone/bin/gslist" ]]
then
"$MAGLEV_HOME/gemstone/bin/gslist" -clv > /dev/null 2>&1 ; result=$?
if (( result == 1 ))
then
"$rvm_ruby_home/bin/maglev" start
fi
fi
fi
else
if (( ${rvm_default_flag:=0} == 1 ))
then
if ! builtin command -v __rvm_reset >> /dev/null 2>&1
then
source "$rvm_scripts_path/functions/reset"
__rvm_reset
fi
fi
fi
rvm_hook="after_use"
source "$rvm_scripts_path/hook"
return 0
}
__rvm_ruby_string()
{
# rvm_ruby_string may designate any of the following items:
# * rvm_gemset_name
# * rvm_ruby_interpreter
# * rvm_ruby_version
# * rvm_ruby_patch_level
# * rvm_ruby_revision
# * rvm_ruby_tag
typeset ruby_string gemset_name expanded_alias_name repo_url branch_name ruby_name
__rvm_default_flags
rvm_expanding_aliases=
true \
"${rvm_ruby_version:=}" "${rvm_gemset_name:=}" "${rvm_ruby_interpreter:=}"\
"${rvm_ruby_version:=}" "${rvm_ruby_tag:=}" "${rvm_ruby_patch_level:=}"\
"${rvm_ruby_revision:=}" ${rvm_gemset_separator:="@"} "${rvm_ruby_string:=}"\
${rvm_expanding_aliases:=0} ${rvm_head_flag:=0}
if echo "$rvm_ruby_string" | GREP_OPTIONS="" \grep "${rvm_gemset_separator}" >/dev/null 2>&1
then
rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator}/}"
rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator}*/}"
fi
# Alias'd rubies
if (( rvm_expanding_aliases == 0 )) &&
[[ -n "${rvm_ruby_string}" && "$rvm_ruby_string" != "system" ]]
then
if expanded_alias_name="$("$rvm_scripts_path/alias" show "$rvm_ruby_string" 2>/dev/null)" \
&& [[ -n "$expanded_alias_name" ]]
then
rvm_ruby_string="$expanded_alias_name"
elif [[ "$rvm_ruby_string" == default ]]
then
# Default is not a known value. Instead, we need to therefore set it to system.
rvm_ruby_string="system"
fi
fi
if echo "$rvm_ruby_string" | GREP_OPTIONS="" \grep "${rvm_gemset_separator}" >/dev/null 2>&1 ; then
rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator}/}"
rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator}*/}"
fi
# Stash the ruby string.
ruby_string="${rvm_ruby_string:-}"
gemset_name="${rvm_gemset_name:-}"
repo_url="${rvm_ruby_repo_url:-}"
branch_name="${rvm_ruby_repo_branch:-}"
ruby_name="${rvm_ruby_name:-}"
__rvm_unset_ruby_variables
rvm_ruby_repo_url="${repo_url:-}"
rvm_ruby_repo_branch="${branch_name:-}"
rvm_ruby_name="$ruby_name"
if [[ -n "$gemset_name" ]]
then
rvm_gemset_name="$gemset_name"
rvm_sticky_flag=1 # <- not sold on this.
fi
strings=($(echo ${ruby_string//-/ }))
if (( ${#strings[@]} == 0 ))
then
if echo "${GEM_HOME:-}" | GREP_OPTIONS="" \grep "${rvm_path}" >/dev/null 2>&1
then
# Current Ruby
strings="${GEM_HOME##*\/}"
strings="${strings/%${rvm_gemset_separator:-"@"}*}"
rvm_ruby_string="$strings"
strings=( $(echo ${rvm_ruby_string//-/ }) )
else
strings=(system)
rvm_ruby_string="system"
fi
fi
for string in ${strings[@]}
do
case "$string" in
(head)
rvm_ruby_patch_level=""
rvm_ruby_revision=""
rvm_ruby_tag=""
export rvm_head_flag=1
;;
(system)
rvm_ruby_interpreter="system"
rvm_ruby_patch_level=""
rvm_ruby_tag=""
rvm_ruby_revision=""
rvm_ruby_version=""
rvm_gemset_name=""
rvm_head_flag=0
return 0
;;
(ext|external)
rvm_ruby_interpreter="ext"
rvm_ruby_patch_level=""
rvm_ruby_tag=""
rvm_ruby_revision=""
rvm_ruby_version=""
rvm_head_flag=0
unset strings[__array_start]
strings=( ${strings[@]} )
strings="${strings[*]}"
rvm_ruby_name="${strings// /-}"
break
;;
(nightly)
rvm_ruby_version="nightly"
rvm_nightly_flag=1
break
;;
(preview*)
rvm_ruby_patch_level="$string"
;;
(rc[[:digit:]]*)
rvm_ruby_patch_level="$string"
;;
([[:digit:]].[[:digit:]]*)
#TODO: use normal code for rbx!
if [[ "${rvm_ruby_interpreter}" == "rbx" ]]
then
if [[ -z "${rvm_ruby_version}" ]]
then
rvm_ruby_version="${string}"
elif [[ -z "${rvm_ruby_patch_level}" ]]
then
rvm_ruby_patch_level="${string}"
else
rvm_error "Unknown ruby interpreter string component: '$string'."
return 1
fi
else
case "$string" in
(0.+([[:digit:]])|0.+([[:digit:]]).+([[:digit:]])|1.+([[:digit:]]).+([[:digit:]])|2.+([[:digit:]]).+([[:digit:]])|1.+([[:digit:]]).+([[:digit:]]).+([[:digit:]])|1.+([[:digit:]]))
rvm_ruby_version="$string"
rvm_ruby_revision=""
rvm_ruby_tag=""
;;
(1.+([[:digit:]]).+([[:digit:]]).+([[:alnum:]]))
case "${rvm_ruby_interpreter:-""}" in
(jruby)
rvm_ruby_version="$string"
;;
(*)
rvm_error "Unknown ruby interpreter version: '$string'."
return 1
;;
esac
;;
(*)
rvm_error "Unknown ruby interpreter version: '$string'."
return 1
;;
esac
fi
;;
(p[[:digit:]]*)
rvm_ruby_patch_level="$string"
;;
([[:digit:]][[:digit:]]*)
case "${rvm_ruby_interpreter:-""}" in
(ree)
rvm_ruby_patch_level="$string"
rvm_ruby_revision=""
;;
(kiji)
rvm_ruby_patch_level="$string"
rvm_ruby_revision=""
;;
(rbx)
rvm_ruby_patch_level="$string"
;;
(maglev)
rvm_ruby_version="$string"
rvm_ruby_revision=""
rvm_ruby_patch_level=""
;;
(*)
rvm_ruby_revision="r$string"
;;
esac
;;
(r[[:digit:]]*)
rvm_ruby_patch_level=""
rvm_ruby_revision="$string"
;;
(s[[:alnum:]]*)
rvm_ruby_revision=""
rvm_ruby_sha="${string#s}"
;;
(tv[[:digit:]]*|t[[:digit:]]*)
rvm_ruby_patch_level="" ; rvm_ruby_revision=""
rvm_ruby_tag="$string"
;;
(m[[:digit:]]*)
rvm_ruby_mode="$string"
;;
(u[[:alnum:]]*)
rvm_ruby_patch_level="" ; rvm_ruby_revision="" ; rvm_ruby_tag="" ; rvm_ruby_patch=""
rvm_ruby_user_tag="$string"
;;
(a[[:digit:]][[:digit:]]*)
rvm_ruby_bits="$string" # Architecture
;;
(b[[:digit:]]*)
rvm_ruby_repo_branch="${string}"
rvm_head_flag=1
;;
(ruby|rbx|jruby|macruby|ree|kiji|rubinius|maglev|ironruby|goruby|tcs)
rvm_ruby_interpreter="$string"
;;
([[:alpha:]]*([[:alnum:]]|_))
rvm_ruby_name="$string"
;;
(*)
rvm_error "Unknown ruby interpreter string component: '$string'."
return 1
;;
esac
done
if [[ -z "${rvm_ruby_interpreter:-""}" ]]
then
# Detect interpreter based on version.
case "$rvm_ruby_version" in
(1.[8-9]*) rvm_ruby_interpreter="ruby" ;;
(0.[5-6]*) rvm_ruby_interpreter="macruby" ;;
(1.[0-4]*) rvm_ruby_interpreter="rbx" ;;
(1.[5-7]*) rvm_ruby_interpreter="jruby" ;;
(2.*)
rvm_error "Version '$rvm_ruby_version' is to confusing to select ruby interpreter."
return 2
;;
esac
fi
# Unspecified version
rvm_ruby_version="${rvm_ruby_version:-}"
if [[ -z "${rvm_ruby_version:-}" && "${rvm_ruby_interpreter}" != "ext" ]] && (( ${rvm_head_flag:=0} == 0 ))
then
rvm_ruby_version="${rvm_ruby_version:-"$(
__rvm_db "${rvm_ruby_interpreter}_version"
)"}"
fi
if [[ -z "${rvm_ruby_version:-}" ]]
then
rvm_ruby_string="${rvm_ruby_interpreter}"
else
rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}"
fi
if [[ "${rvm_ruby_interpreter}" == "ext" ]]
then
true # skip checking for external rubies
elif (( ${rvm_head_flag:=0} == 1 ))
then
rvm_ruby_string="${rvm_ruby_string}-head"
elif [[ -n "${rvm_ruby_revision:-}" ]]
then
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_revision}"
elif [[ -n "${rvm_ruby_sha:-}" ]]
then
rvm_ruby_string="${rvm_ruby_string}-s${rvm_ruby_sha}"
elif [[ -n "${rvm_ruby_tag:-}" ]]
then
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_tag}"
elif [[ -n "${rvm_ruby_patch_level:-}" ]]
then
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
elif [[ -n "${rvm_ruby_user_tag:-}" ]]
then
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_user_tag}"
else
patch_level="$(
__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level"
)"
if [[ -n "${patch_level:-""}" ]]
then
case "$rvm_ruby_interpreter" in
ree|kiji|rbx)
# REE, Kiji & Rubinius use dates for their patch levels.
rvm_ruby_patch_level="${patch_level}"
;;
*)
# MRI uses -pN+ to specify the patch level.
rvm_ruby_patch_level="p${patch_level}"
;;
esac
fi
if [[ -n "${rvm_ruby_patch_level:-""}" ]]
then
rvm_ruby_patch_level="${rvm_ruby_patch_level/#pp/p}"
rvm_ruby_patch_level="${rvm_ruby_patch_level/#prc/rc}"
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
case "$rvm_ruby_interpreter" in
(ree|kiji|rbx)
rvm_ruby_string="${rvm_ruby_string//-p*/-}"
;;
(*)
rvm_ruby_string="${rvm_ruby_string//-pp/-p}"
rvm_ruby_string="${rvm_ruby_string//-prc/-rc}"
;;
esac
fi
fi
if [[ -n "${rvm_ruby_name:-}" ]]
then
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_name}"
# record the name for validation of -n option
detected_rvm_ruby_name="${rvm_ruby_name}"
# clean the name so it is not added again (rbx -n install problem)
rvm_ruby_name=""
else
# record the no name for validation of -n option
detected_rvm_ruby_name=""
fi
}
__rvm_ruby_strings_exist()
{
for rvm_ruby_string in ${@//,/ }
do
rvm_verbose_flag=0 __rvm_use "${rvm_ruby_string}" >/dev/null 2>&1 || return $?
printf "%b" "${rvm_ruby_string}${rvm_gemset_name:+@}${rvm_gemset_name:-}\n"
done
unset rvm_ruby_string
}
#!/usr/bin/env bash
__rvm_gemset_handle_default()
{
rvm_gemset_name="@${rvm_gemset_name:-}@"
rvm_gemset_name="${rvm_gemset_name/@default@/@@}"
rvm_gemset_name="${rvm_gemset_name#@}"
rvm_gemset_name="${rvm_gemset_name%@}"
}
__rvm_gemset_select_cli_validation()
{
typeset orig_gemset
if ! builtin command -v gem > /dev/null
then
rvm_log "'gem' command not found, cannot select a gemset."
return 0
fi
orig_gemset="${rvm_gemset_name:-}"
__rvm_gemset_handle_default
# No longer defaulting to 'sticky' gem sets.
# Set 'rvm_sticky_flag=1' in ~/.rvmrc to enable.
if [[ -z "${rvm_gemset_name:-}" && "$orig_gemset" != "default" && ${rvm_sticky_flag:-0} -eq 1 ]]
then
if [[ -n "${rvm_ruby_gem_home:-}" ]]
then
rvm_gemset_name="$rvm_ruby_gem_home"
elif [[ -n "${GEM_HOME:-}" ]]
then
rvm_gemset_name="$GEM_HOME"
fi
rvm_gemset_name="${rvm_gemset_name##*/}"
rvm_gemset_name="${rvm_gemset_name#*${rvm_gemset_separator:-"@"}}"
fi
if [[ -z "${rvm_ruby_string:-}" && -n "${GEM_HOME:-}" && -n "${GEM_HOME%@*}" ]]
then
rvm_ruby_string="${GEM_HOME%@*}"
rvm_ruby_string="${rvm_ruby_string##*/}"
fi
if [[ -z "${rvm_ruby_string:-}" ]]
then
rvm_error "Gemsets can not be used with non rvm controlled rubies (currently)."
return 3
fi
}
__rvm_gemset_select_only()
{
rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/$rvm_ruby_string"
: rvm_ignore_gemsets_flag:${rvm_ignore_gemsets_flag:=0}:
if (( rvm_ignore_gemsets_flag ))
then
rvm_ruby_global_gems_path="${rvm_ruby_gem_home}"
rvm_ruby_gem_path="${rvm_ruby_gem_home}"
rvm_gemset_name=""
else
rvm_ruby_global_gems_path="${rvm_ruby_gem_home}${rvm_gemset_separator:-"@"}global"
__rvm_gemset_handle_default
[[ -z "$rvm_gemset_name" ]] ||
rvm_ruby_gem_home="${rvm_ruby_gem_home}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
if [[ "$rvm_gemset_name" == "global" ]]
then
rvm_ruby_gem_path="${rvm_ruby_gem_home}"
else
rvm_ruby_gem_path="${rvm_ruby_gem_home}:${rvm_ruby_global_gems_path}"
fi
fi
if [[ -n "${rvm_gemset_name}" ]]
then
rvm_env_string="${rvm_ruby_string}@${rvm_gemset_name}"
else
rvm_env_string=${rvm_ruby_string}
fi
}
__rvm_gemset_select_validation()
{
# If the gemset does not exist, then notify the user as such and abort the action.
if [[ ! -d "${rvm_ruby_gem_home}" ]]
then
if (( ${rvm_gemset_create_on_use_flag:=0} == 0 && ${rvm_create_flag:=0} == 0 && ${rvm_delete_flag:=0} == 0 ))
then
rvm_expected_gemset_name="${rvm_gemset_name}"
rvm_gemset_name=""
__rvm_gemset_select_only
return 2
fi
elif (( ${rvm_delete_flag:=0} == 1 ))
then
return 4
fi
}
__rvm_gemset_select_ensure()
{
\mkdir -p "$rvm_ruby_gem_home"
if __rvm_using_gemset_globalcache && [[ ! -L "$rvm_ruby_gem_home/cache" ]]
then
: rvm_gems_cache_path:${rvm_gems_cache_path:=${rvm_gems_path:-"$rvm_path/gems"}/cache}
\mv "$rvm_ruby_gem_home/cache/"*.gem "$rvm_gems_cache_path/" 2>/dev/null
__rvm_rm_rf "$rvm_ruby_gem_home/cache"
\ln -fs "$rvm_gems_cache_path" "$rvm_ruby_gem_home/cache"
fi
}
# Select a gemset based on CLI set options and environment.
__rvm_gemset_select_cli()
{
__rvm_gemset_select_cli_validation &&
__rvm_gemset_select
}
__rvm_gemset_select()
{
__rvm_gemset_select_only &&
__rvm_gemset_select_validation &&
__rvm_gemset_select_ensure
}
# Use a gemset specified by 'rvm_ruby_gem_home'
__rvm_gemset_use()
{
if __rvm_gemset_select_cli
then
rvm_log "Using $rvm_ruby_string with gemset ${rvm_gemset_name:-default}"
__rvm_use # Now ensure the selection takes effect for the environment.
else
if [[ ! -d "$rvm_ruby_gem_home" || -n "${rvm_expected_gemset_name}" ]]
then
if (( ${rvm_gemset_create_on_use_flag:=0} == 1 || ${rvm_create_flag:=0} == 1 ))
then
rvm_warn "gemset $rvm_gemset_name is not existing, creating."
"$rvm_scripts_path/gemsets" create "$rvm_gemset_name"
else
rvm_error "Gemset '${rvm_expected_gemset_name}' does not exist, 'rvm gemset create ${rvm_expected_gemset_name}' first, or append '--create'."
return 2
fi
else
rvm_error "Gemset was not given.\n Usage:\n rvm gemset use <gemsetname>\n"
return 1
fi
fi
}
__rvm_gemset_clear()
{
export rvm_gemset_name
rvm_gemset_name=""
__rvm_use # Now ensure the selection takes effect for the environment.
}
typeset -a scripts
scripts=(
logging utility init cleanup env rvmrc install environment gemset db bundler
)
for entry in ${scripts[@]} ; do
source "$rvm_scripts_path/functions/$entry"
done
#!/usr/bin/env bash
# Logging functions
# check if user wants colors and if output goes to terminal
# rvm_pretty_print_flag:
# - 0|no - disabled always
# - 1|auto - automatic depending if the output goes to terminal (default)
# - 2|force - forced always
# to select which terminal output should be checked use first param:
# - stdout - for stdout (default)
# - stderr - for stderr
# - number - for the given terminal fd
# - else - for both stdout and stderr
rvm_pretty_print()
{
case "${rvm_pretty_print_flag:=auto}" in
(0|no)
return 1
;;
(1|auto)
case "${TERM:-dumb}" in
(dumb|unknown) return 1 ;;
esac
case "$1" in
(stdout) [[ -t 1 ]] || return 1 ;;
(stderr) [[ -t 2 ]] || return 1 ;;
([[:digit:]]) [[ -t $1 ]] || return 1 ;;
(any) [[ -t 1 || -t 2 ]] || return 1 ;;
(*) [[ -t 1 && -t 2 ]] || return 1 ;;
esac
return 0
;;
(2|force)
return 0
;;
esac
}
case "${TERM:-dumb}" in
(dumb|unknown)
rvm_error_clr=""
rvm_warn_clr=""
rvm_debug_clr=""
rvm_notify_clr=""
rvm_reset_clr=""
;;
(*)
rvm_error_clr="$( "${rvm_scripts_path:-${rvm_pat}/scripts}/color" "${rvm_error_color:-red}" )"
rvm_warn_clr="$( "${rvm_scripts_path:-${rvm_pat}/scripts}/color" "${rvm_warn_color:-yellow}" )"
rvm_debug_clr="$( "${rvm_scripts_path:-${rvm_pat}/scripts}/color" "${rvm_debug_color:-magenta}" )"
rvm_notify_clr="$( "${rvm_scripts_path:-${rvm_pat}/scripts}/color" "${rvm_notify_color:-green}" )"
rvm_reset_clr="$( "${rvm_scripts_path:-${rvm_pat}/scripts}/color" "${rvm_reset_color:-reset}" )"
;;
esac
"${rvm_scripts_path:-${rvm_pat}/scripts}/color" "${rvm_error_color:-red}"
bash: __rvm_select: line 275: syntax error near unexpected token `('
bash: __rvm_select: line 275: ` +([[:digit:]]).+([[:digit:]]).+([[:digit:]]))'
bash: error importing function definition for `__rvm_select'
bash: __rvm_rm_rf: line 13: syntax error near unexpected token `('
bash: __rvm_rm_rf: line 13: ` *(/|.)@(|/Applications|/Developer|/Guides|/Information|/Library|/Network|/System|/User|/Users|/Volumes|/backups|/bdsm|/bin|/boot|/cores|/data|/dev|/etc|/home|/lib|/lib64|/mach_kernel|/media|/misc|/mnt|/net|/opt|/private|/proc|/root|/sbin|/selinux|/srv|/sys|/tmp|/usr|/var))'
bash: error importing function definition for `__rvm_rm_rf'
bash: __rvm_ruby_string: line 103: syntax error near unexpected token `('
bash: __rvm_ruby_string: line 103: ` 0.+([[:digit:]]) | 0.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]) | 2.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]))'
bash: error importing function definition for `__rvm_ruby_string'
bash: __rvm_parse_args: line 333: syntax error near unexpected token `('
bash: __rvm_parse_args: line 333: ` +([[:digit:]]).+([[:digit:]])*)'
bash: error importing function definition for `__rvm_parse_args'
"${rvm_scripts_path:-${rvm_pat}/scripts}/color" "${rvm_warn_color:-yellow}"
bash: __rvm_select: line 275: syntax error near unexpected token `('
bash: __rvm_select: line 275: ` +([[:digit:]]).+([[:digit:]]).+([[:digit:]]))'
bash: error importing function definition for `__rvm_select'
bash: __rvm_rm_rf: line 13: syntax error near unexpected token `('
bash: __rvm_rm_rf: line 13: ` *(/|.)@(|/Applications|/Developer|/Guides|/Information|/Library|/Network|/System|/User|/Users|/Volumes|/backups|/bdsm|/bin|/boot|/cores|/data|/dev|/etc|/home|/lib|/lib64|/mach_kernel|/media|/misc|/mnt|/net|/opt|/private|/proc|/root|/sbin|/selinux|/srv|/sys|/tmp|/usr|/var))'
bash: error importing function definition for `__rvm_rm_rf'
bash: __rvm_ruby_string: line 103: syntax error near unexpected token `('
bash: __rvm_ruby_string: line 103: ` 0.+([[:digit:]]) | 0.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]) | 2.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]))'
bash: error importing function definition for `__rvm_ruby_string'
bash: __rvm_parse_args: line 333: syntax error near unexpected token `('
bash: __rvm_parse_args: line 333: ` +([[:digit:]]).+([[:digit:]])*)'
bash: error importing function definition for `__rvm_parse_args'
"${rvm_scripts_path:-${rvm_pat}/scripts}/color" "${rvm_debug_color:-magenta}"
bash: __rvm_select: line 275: syntax error near unexpected token `('
bash: __rvm_select: line 275: ` +([[:digit:]]).+([[:digit:]]).+([[:digit:]]))'
bash: error importing function definition for `__rvm_select'
bash: __rvm_rm_rf: line 13: syntax error near unexpected token `('
bash: __rvm_rm_rf: line 13: ` *(/|.)@(|/Applications|/Developer|/Guides|/Information|/Library|/Network|/System|/User|/Users|/Volumes|/backups|/bdsm|/bin|/boot|/cores|/data|/dev|/etc|/home|/lib|/lib64|/mach_kernel|/media|/misc|/mnt|/net|/opt|/private|/proc|/root|/sbin|/selinux|/srv|/sys|/tmp|/usr|/var))'
bash: error importing function definition for `__rvm_rm_rf'
bash: __rvm_ruby_string: line 103: syntax error near unexpected token `('
bash: __rvm_ruby_string: line 103: ` 0.+([[:digit:]]) | 0.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]) | 2.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]))'
bash: error importing function definition for `__rvm_ruby_string'
bash: __rvm_parse_args: line 333: syntax error near unexpected token `('
bash: __rvm_parse_args: line 333: ` +([[:digit:]]).+([[:digit:]])*)'
bash: error importing function definition for `__rvm_parse_args'
"${rvm_scripts_path:-${rvm_pat}/scripts}/color" "${rvm_notify_color:-green}"
bash: __rvm_select: line 275: syntax error near unexpected token `('
bash: __rvm_select: line 275: ` +([[:digit:]]).+([[:digit:]]).+([[:digit:]]))'
bash: error importing function definition for `__rvm_select'
bash: __rvm_rm_rf: line 13: syntax error near unexpected token `('
bash: __rvm_rm_rf: line 13: ` *(/|.)@(|/Applications|/Developer|/Guides|/Information|/Library|/Network|/System|/User|/Users|/Volumes|/backups|/bdsm|/bin|/boot|/cores|/data|/dev|/etc|/home|/lib|/lib64|/mach_kernel|/media|/misc|/mnt|/net|/opt|/private|/proc|/root|/sbin|/selinux|/srv|/sys|/tmp|/usr|/var))'
bash: error importing function definition for `__rvm_rm_rf'
bash: __rvm_ruby_string: line 103: syntax error near unexpected token `('
bash: __rvm_ruby_string: line 103: ` 0.+([[:digit:]]) | 0.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]) | 2.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]))'
bash: error importing function definition for `__rvm_ruby_string'
bash: __rvm_parse_args: line 333: syntax error near unexpected token `('
bash: __rvm_parse_args: line 333: ` +([[:digit:]]).+([[:digit:]])*)'
bash: error importing function definition for `__rvm_parse_args'
"${rvm_scripts_path:-${rvm_pat}/scripts}/color" "${rvm_reset_color:-reset}"
bash: __rvm_select: line 275: syntax error near unexpected token `('
bash: __rvm_select: line 275: ` +([[:digit:]]).+([[:digit:]]).+([[:digit:]]))'
bash: error importing function definition for `__rvm_select'
bash: __rvm_rm_rf: line 13: syntax error near unexpected token `('
bash: __rvm_rm_rf: line 13: ` *(/|.)@(|/Applications|/Developer|/Guides|/Information|/Library|/Network|/System|/User|/Users|/Volumes|/backups|/bdsm|/bin|/boot|/cores|/data|/dev|/etc|/home|/lib|/lib64|/mach_kernel|/media|/misc|/mnt|/net|/opt|/private|/proc|/root|/sbin|/selinux|/srv|/sys|/tmp|/usr|/var))'
bash: error importing function definition for `__rvm_rm_rf'
bash: __rvm_ruby_string: line 103: syntax error near unexpected token `('
bash: __rvm_ruby_string: line 103: ` 0.+([[:digit:]]) | 0.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]) | 2.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]))'
bash: error importing function definition for `__rvm_ruby_string'
bash: __rvm_parse_args: line 333: syntax error near unexpected token `('
bash: __rvm_parse_args: line 333: ` +([[:digit:]]).+([[:digit:]])*)'
bash: error importing function definition for `__rvm_parse_args'
rvm_error()
{
if rvm_pretty_print stderr
then printf "%b" "${rvm_error_clr:-}$*${rvm_reset_clr:-}\n"
else printf "%b" "$*\n"
fi >&2
}
rvm_warn()
{
if rvm_pretty_print stdout
then printf "%b" "${rvm_warn_clr:-}$*${rvm_reset_clr:-}\n"
else printf "%b" "$*\n"
fi
}
rvm_debug()
{
if rvm_pretty_print stdout
then printf "%b" "${rvm_debug_clr:-}$*${rvm_reset_clr:-}\n"
else printf "%b" "$*\n"
fi
}
rvm_log()
{
if rvm_pretty_print stdout
then printf "%b" "${rvm_notify_clr:-}$*${rvm_reset_clr:-}\n"
else printf "%b" "$*\n"
fi
}
#!/usr/bin/env bash
if [[ -z "${rvm_tar_command:-}" ]] && builtin command -v gtar >/dev/null
then
rvm_tar_command=gtar
else
rvm_tar_command=tar
fi
if [[ ! " ${rvm_tar_options:-} " =~ " --no-same-owner " ]] && \
$rvm_tar_command --help | GREP_OPTIONS="" \grep -- --no-same-owner >/dev/null
then
rvm_tar_options="${rvm_tar_options:-} --no-same-owner"
rvm_tar_options="${rvm_tar_options## }"
fi
#
# Functions RVM is built on
#
# match <value> <string|glob>
match()
{
case "$1" in
$2) return 0 ;;
*) return 1 ;;
esac
}
printenv_null()
{
if printenv --null >/dev/null 2>/dev/null
then
printenv --null
else
# this messes with escape sequences but allows new lines in variables
printenv | sed '/=/ { s/=.*$//; p; }; d;' | while read name
do
zero="\0"
eval "eval \"printf '%b' '$name=\$$name$zero'\""
done
fi
}
is_a_function() {
typeset -f $1 >/dev/null 2>&1 || return $?
}
#
# RVM specific functions.
#
__rvm_warn_on_rubyopt()
{
if [[ -n "${RUBYOPT:-""}" ]]; then
rvm_warn \
"Please note: You have the RUBYOPT environment variable set and this \
may interfere with normal rvm operations. We sugges unsetting it."
return 1
else
return 0
fi
}
__rvm_strings()
{
typeset strings ruby_strings
ruby_strings=($(echo ${rvm_ruby_args:-$rvm_ruby_string}))
for rvm_ruby_string in "${ruby_strings[@]}" ; do
strings="$strings $(__rvm_select ; echo $rvm_ruby_string)"
done
echo $strings
return 0
}
# Return a list of directories under a given base path.
# Derived from rvm_ruby_string.
__rvm_ruby_string_paths_under()
{
typeset path part parts
path="${1%/}" # Strip off any trailing slash
parts=(${rvm_ruby_string//-/ }) # Strip white space.
echo "$path"
for part in "${parts[@]}"
do
path="$path/$part"
echo "$path"
done
return 0
}
# Run a specified command and log it.
__rvm_run()
{
typeset name log temp_log_path _command message
true ${rvm_debug_flag:=0} ${rvm_niceness:=0}
name="${1:-}"
_command="${2:-}"
message="${3:-}"
if [[ -n "$message" ]]
then
rvm_log "$message"
fi
if (( rvm_debug_flag > 0 ))
then
rvm_debug "Executing: $_command"
fi
if [[ -n "${rvm_ruby_string:-}" ]]
then
temp_log_path="${rvm_log_path}/$rvm_ruby_string"
else
temp_log_path="${rvm_log_path}"
fi
log="$temp_log_path/$name.log"
if [[ ! -d "${log%\/*}" ]]
then
\mkdir -p "${log%\/*}"
fi
if [[ ! -f "$log" ]]
then
\touch "$log" # for zsh :(
fi
# TODO: Allow an 'append_flag' setting?
printf "%b" "[$(date +'%Y-%m-%d %H:%M:%S')] $_command\n" > "$log"
if (( rvm_niceness > 0 ))
then
_command="nice -n $rvm_niceness $_command"
fi
eval "$_command" >> "$log" 2>&1
result=$?
if (( result > 0 ))
then
rvm_error "Error running '$_command', please read $log"
fi
return ${result}
}
# Output the current ruby's rvm source path.
__rvm_source_dir()
{
if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]]
then __rvm_select
fi
if [[ -z "$rvm_ruby_src_path" ]]
then
rvm_error "No source directory exists for the default implementation."
else
echo "$rvm_ruby_src_path"
fi
return 0
}
# Output an inspection of selected 'binary' scripts, based on CLI selection.
__rvm_inspect()
{
for binary in $rvm_ruby_args
do
actual_file="$(unset -f gem ; builtin command -v gem )"
rvm_log "$actual_file:"
if [[ ${rvm_shebang_flag:-0} -eq 1 ]]
then
\head -n 1 < "$actual_file"
fi
if [[ ${rvm_env_flag:-0} -eq 1 ]]
then
\awk '/ENV/' < "$actual_file"
fi
if [[ ${rvm_path_flag:-0} -eq 1 ]]
then
\awk '/PATH/' < "$actual_file"
fi
if [[ ${rvm_head_flag:-0} -eq 1 ]]
then
\head -n 5 < "$actual_file"
fi
if [[ ${rvm_tail_flag:-0} -eq 1 ]]
then
\tail -n 5 < "$actual_file"
fi
if [[ ${rvm_all_flag:-0} -eq 1 ]]
then
\cat $actual_file
fi
done
return 0
}
# Strip whitespace and normalize it all.
__rvm_strip()
{
\sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]]\{1,\}/ /g'
return $?
}
__rvm_remove_from_path()
{
export PATH
PATH=":$PATH:"
PATH="${PATH//:$1:/:}"
PATH="${PATH//::/:}"
PATH="${PATH%:}"
PATH="${PATH#:}"
}
__rvm_add_to_path()
{
export PATH
if (( $# != 2 )) || [[ -z "$2" ]]
then
rvm_error "__rvm_add_to_path requires two parameters"
return 1
fi
__rvm_remove_from_path "$2"
case "$1" in
prepend) PATH="$2:$PATH" ;;
append) PATH="$PATH:$2" ;;
#*) anything else will just remove it from PATH - not adding back
esac
if [[ -n "${rvm_user_path_prefix:-}" ]]
then
__rvm_remove_from_path "${rvm_user_path_prefix}"
PATH="${rvm_user_path_prefix}:$PATH"
fi
builtin hash -r
}
is_parent_of()
{
typeset name pid ppid pname
name=$1
pid=$2
while [[ -n "$pid" && "$pid" != "0" ]]
do
read ppid pname < <(ps -p $pid -o ppid= -o comm=)
if [[ -n "$ppid" && -n "$pname" ]]
then
if [[ "$pname" == "$name" ]]
then
echo $pid
return 0
else
pid=$ppid
fi
else
break
fi
done
return 1
}
rvm_is_a_shell_function()
{
if (( ${rvm_is_not_a_shell_function:-0} > 0 )) && [[ "${1:-}" != "no_warning" ]]
then
if rvm_pretty_print stderr
then
printf "%b" "\n${rvm_notify_clr:-}RVM is not a function, selecting rubies with '${rvm_error_clr:-}rvm use ...${rvm_notify_clr:-}' will not work.${rvm_reset_clr:-}\n" >&2
else
printf "%b" "\nRVM is not a function, selecting rubies with 'rvm use ...' will not work.\n" >&2
fi
if is_parent_of gnome-terminal $$ >/dev/null
then
rvm_log "Please visit https://rvm.io/integration/gnome-terminal/ for a solution.\n" >&2
else
rvm_log "You need to change your terminal settings to allow shell login.
Please visit https://rvm.io/workflow/screen/ for example.\n" >&2
fi
fi
return ${rvm_is_not_a_shell_function:-0}
}
__rvm_detect_xcode_version()
{
typeset version_file
for version_file in \
/Applications/Xcode.app/Contents/version.plist \
/Developer/Applications/Xcode.app/Contents/version.plist
do
if [[ -f $version_file ]]
then
if [[ -x /usr/libexec/PlistBuddy ]]
then
/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $version_file
else
sed -n '/<key>CFBundleShortVersionString<\/key>/{n; s/^.*>\(.*\)<.*$/\1/; p;}' < $version_file
fi
return 0
fi
done
if builtin command -v xcodebuild >/dev/null
then
xcodebuild -version | sed -n '/Xcode/ {s/Xcode //; p;}'
fi
}
__rvm_detect_xcode_version_is()
{
[[ "$(__rvm_detect_xcode_version)" == "$1" ]] || return 1
}
__rvm_version_compare()
{
typeset v1d v2d dots counter IFS
typeset -a transformer
counter=1
IFS="+" # to put + in transformer ;)
v1d=$( printf -- $1 | GREP_OPTIONS="" \grep -o '\.' | wc -l )
v2d=$( printf -- $3 | GREP_OPTIONS="" \grep -o '\.' | wc -l )
if [[ $v1d -ge $v2d ]]
then dots=$v1d
else dots=$v2d
fi
while (( dots >= 0 ))
do transformer+=( "$(( 256 ** dots-- ))*\$$((counter++))" )
done
eval "$(
printf '[[ ';
printf $1 | \awk -F. "{ printf ${transformer[*]} }";
printf -- " $2 ";
printf $3 | \awk -F. "{ printf ${transformer[*]} }";
printf ' ]]'
)"
}
__function_on_stack()
{
typeset fun
for fun in "$@"
do
if [[ " ${FUNCNAME[*]} " =~ " $fun " ]]
then return 0
fi
done
return $#
}
__rvm_pager_or_cat_v()
{
eval "${PAGER:-cat -v} '$1'"
}
#!/usr/bin/env bash
__rvm_load_rvmrc()
{
typeset _file
if (( ${rvm_ignore_rvmrc:=0} == 1 ))
then
return 0
fi
: rvm_stored_umask:${rvm_stored_umask:=$(umask)}
for _file in /etc/rvmrc "$HOME/.rvmrc"
do
if [[ -s "$_file" ]]
then
if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$_file" >/dev/null 2>&1
then
rvm_error "
$_file is for rvm settings only.
rvm CLI may NOT be called from within $_file.
Skipping the loading of $_file
"
return 1
else
source "$_file"
fi
fi
done
return 0
}
# Initialize rvm, ensuring that the path and directories are as expected.
__rvm_initialize()
{
export rvm_ruby_load_path rvm_ruby_require
rvm_ruby_load_path="."
rvm_ruby_require=""
true ${rvm_scripts_path:="$rvm_path/scripts"}
source "$rvm_scripts_path/base"
__rvm_clean_path
__rvm_conditionally_add_bin_path
export PATH
if [[ ! -d "${rvm_tmp_path:-/tmp}" ]]
then
command mkdir -p "${rvm_tmp_path}"
fi
return 0
}
#!/usr/bin/env bash
#
# rm -rf with *some* safeguards in place.
#
__rvm_rm_rf()
{
typeset result target
result=1
target="${1%%+(/|.)}"
#NOTE: RVM Requires extended globbing shell feature turned on.
if [[ -n "${ZSH_VERSION:-}" ]]
then
setopt extendedglob
else
if [[ -n "${BASH_VERSION:-}" ]]
then
shopt -s extglob # Extended globs
else
printf "%b" "What the heck kind of shell are you running here???\n"
fi
fi
case "${target}" in
(*(/|.)@(|/Applications|/Developer|/Guides|/Information|/Library|/Network|/System|/User|/Users|/Volumes|/backups|/bdsm|/bin|/boot|/cores|/data|/dev|/etc|/home|/lib|/lib64|/mach_kernel|/media|/misc|/mnt|/net|/opt|/private|/proc|/root|/sbin|/selinux|/srv|/sys|/tmp|/usr|/var))
false
;;
(*)
if [[ -n "${target}" ]]
then
if [[ -d "${target}" ]]
then # Directory
\rm -rf "${target}"
result=0
elif [[ -f "${target}" || -L "${target}" ]]
then # File / Symbolic Link
\rm -f "${target}"
result=0
else
result=0 # already gone!?
fi
fi
;;
esac
return $result
}
__rvm_reboot()
{
rvm_warn "Do you wish to reboot rvm?\n('yes', or 'no')> "
typeset response
response="no"
read response
if [[ "yes" == "$response" ]]
then
builtin cd $rvm_path
command -v __rvm_reset >> /dev/null 2>&1 || \
source "$rvm_scripts_path/functions/reset"
__rvm_reset
mv "$rvm_archives_path" "$HOME/.archives"
if [[ "/" == "$rvm_path" ]]
then
rvm_error "remove '/' ?!... NO!"
else
if [[ -d "$rvm_path" ]]
then __rvm_rm_rf "$rvm_path"
fi
fi
gem install rvm $rvm_gem_options
"$rvm_scripts_path/get" latest
source "$rvm_scripts_path/rvm"
else
rvm_log "Carry on then..."
fi
return 0
}
# Cleans up temp folders for a given prefix ($1),
# or the current process id.
__rvm_cleanup_tmp()
{
if [[ -d "${rvm_tmp_path}/" ]]
then
case "${rvm_tmp_path%\/}" in
*tmp)
__rvm_rm_rf "${rvm_tmp_path}/${1:-$$}*"
;;
esac
fi
return 0
}
#!/usr/bin/env bash
#
# Environment manipulation functions.
#
__rvm_default_flags()
{
true ${rvm_head_flag:=0} ${rvm_delete_flag:=0}
}
__rvm_nuke_rvm_variables()
{
unset rvm_head_flag $(env | awk -F= '/^rvm_/{print $1" "}')
}
# Unset ruby-specific variables
__rvm_unset_ruby_variables()
{
# unset rvm_ruby_flag $(env | awk -F= '/^rvm_ruby_/{printf $1" "}')
unset rvm_env_string rvm_ruby_string rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_log_path rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_tag rvm_ruby_version rvm_ruby_load_path rvm_ruby_require rvm_head_flag rvm_ruby_package_file rvm_ruby_configure rvm_ruby_name rvm_ruby_url rvm_ruby_global_gems_path rvm_ruby_args rvm_ruby_name rvm_llvm_flag
__rvm_load_rvmrc # restore important variables
}
# TODO: Should be able to...
# Unset both rvm variables as well as ruby-specific variables
# Preserve gemset if 'rvm_sticky' is set
# (persist gemset unless clear is explicitely called).
__rvm_cleanse_variables()
{
__rvm_unset_ruby_variables
if [[ ${rvm_sticky_flag:-0} -eq 1 ]] ; then
export rvm_gemset_name
else
unset rvm_gemset_name
fi
unset rvm_env_string rvm_ruby_string rvm_action rvm_irbrc_file rvm_command rvm_error_message rvm_force_flag rvm_all_flag rvm_reconfigure_flag rvm_make_flags rvm_bin_flag rvm_import_flag rvm_export_flag rvm_self_flag rvm_gem_flag rvm_rubygems_flag rvm_debug_flag rvm_delete_flag rvm_summary_flag rvm_test_flag _rvm_spec_flag rvm_json_flag rvm_yaml_flag rvm_shebang_flag rvm_env_flag rvm_tail_flag rvm_use_flag rvm_dir_flag rvm_list_flag rvm_empty_flag rvm_file_name rvm_benchmark_flag rvm_clear_flag rvm_name_flag rvm_verbose_flag rvm_user_flag rvm_system_flag rvm_configure_flags rvm_uninstall_flag rvm_install_flag rvm_llvm_flag rvm_ruby_bits rvm_sticky_flag rvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag rvm_docs_flag rvm_ruby_aliases rvm_patch_names rvm_install_args rvm_dump_environment_flag rvm_ruby_alias rvm_static_flag rvm_archive_extension rvm_hook rvm_ruby_name
# rvm_gemsets_path rvm_user_path rvm_wrappers_path rvm_patches_path rvm_docs_path rvm_examples_path rvm_rubies_path rvm_usr_path rvm_src_path rvm_tmp_path rvm_lib_path rvm_repos_path rvm_log_path rvm_help_path rvm_environments_path rvm_archives_path
__rvm_load_rvmrc # restore important variables
}
# Add bin path if not present
__rvm_conditionally_add_bin_path()
{
if printf "%b" "${PATH//:/ }" | GREP_OPTIONS="" \grep -vF "${rvm_bin_path}" >/dev/null 2>&1
then
case "${rvm_ruby_string:-"system"}" in
system)
PATH="$PATH:${rvm_bin_path}"
;;
*)
PATH="${rvm_bin_path}:$PATH"
;;
esac
builtin hash -r
fi
return 0
}
__rvm_load_environment()
{
typeset string
string="$1"
if [[ -f "$rvm_environments_path/$string" ]]; then
# Restore the path to it's state minus rvm
__rvm_remove_rvm_from_path
# source the environment file
\. "$rvm_environments_path/$string"
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
then
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
fi
# clear the PATH cache
builtin hash -r
elif [[ -n "$string" ]] ; then
rvm "$string"
else
: # TODO: This should have some error handling in the context.
fi
return 0
}
__rvm_export()
{
# extract the variable name from the first arg.
typeset name
name=${1%%=*}
# store the current value, to be restored later.
builtin export rvm_old_$name=${!name}
# pass-through the return value of the builtin.
export "$@"
return $?
}
__rvm_unset_exports()
{
typeset wrap_name name value
while IFS== read -d "" wrap_name value
do
case "$wrap_name" in
rvm_old_*)
name=${wrap_name#rvm_old_}
if [[ -n "${value:-}" ]]
then export $name="${value}"
else unset $name
fi
unset $wrap_name
;;
esac
done < <(printenv_null)
}
# Clean all *duplicate* items out of the path. (keep first occurrence of each)
__rvm_clean_path()
{
PATH="$(printf "%b" "$PATH" \
| awk -v RS=: -v ORS=: '!($0 in a){a[$0];print}')"
PATH="${PATH/%:/}" # Strip trailing : if it exists
export PATH
builtin hash -r
}
# Clean all rvm items out of the current working path.
__rvm_remove_rvm_from_path()
{
PATH="$(printf "%b" "$PATH" \
| awk -v RS=: -v ORS=: "/${rvm_path//\//\/}/ {next} {print}")"
PATH="${PATH/%:/}" # Strip trailing : if it exists
export PATH
builtin hash -r
}
#!/usr/bin/env bash
export escape_flag _first _second
escape_flag=1
_first=${__array_start}
_second=$[__array_start + 1]
__rvm_md5_for()
{
if builtin command -v md5 > /dev/null; then
echo "$1" | md5
elif builtin command -v md5sum > /dev/null ; then
echo "$1" | md5sum | awk '{print $1}'
else
rvm_error "Neither md5 nor md5sum were found in the PATH"
return 1
fi
return 0
}
__rvm_sha256_for()
{
if builtin command -v sha256sum > /dev/null ; then
echo "$1" | sha256sum | awk '{print $1}'
elif builtin command -v sha256 > /dev/null ; then
echo "$1" | sha256 | awk '{print $1}'
elif builtin command -v shasum > /dev/null ; then
echo "$1" | shasum -a256 | awk '{print $1}'
else
rvm_error "Neither sha256sum nor shasum found in the PATH"
return 1
fi
return 0
}
__rvm_md5_for_contents()
{
if builtin command -v md5 > /dev/null
then
echo "$1" | cat - "$1" | md5
elif builtin command -v md5sum > /dev/null
then
echo "$1" | cat - "$1" | md5sum | awk '{print $1}'
else
rvm_error "Neither md5 nor md5sum were found in the PATH"
return 1
fi
return 0
}
__rvm_sha256_for_contents()
{
if builtin command -v sha256sum > /dev/null ; then
echo "$1" | cat - "$1" | sha256sum | awk '{print $1}'
elif builtin command -v sha256 > /dev/null ; then
echo "$1" | cat - "$1" | sha256 | awk '{print $1}'
elif builtin command -v shasum > /dev/null ; then
echo "$1" | cat - "$1" | shasum -a256 | awk '{print $1}'
else
rvm_error "Neither sha256sum nor shasum found in the PATH"
return 1
fi
return 0
}
__rvm_rvmrc_key()
{
printf "%b" "$1" | \tr '[#/.=]' _
return $?
}
__rvm_reset_rvmrc_trust()
{
if [[ "$1" == all ]]
then
echo "" > "$rvm_user_path/rvmrcs"
else
"$rvm_scripts_path/db" "$rvm_user_path/rvmrcs" \
"$(__rvm_rvmrc_key "$1")" "delete" >/dev/null 2>&1
fi
}
__rvm_trust_rvmrc()
{
__rvm_reset_rvmrc_trust "$1"
"$rvm_scripts_path/db" "$rvm_user_path/rvmrcs" \
"$(__rvm_rvmrc_key "$1")" "1;$(__rvm_md5_for_contents "$1")$(__rvm_sha256_for_contents "$1")" >/dev/null 2>&1
return $?
}
__rvm_untrust_rvmrc()
{
__rvm_reset_rvmrc_trust "$1"
"${rvm_scripts_path:-"$rvm_path/scripts"}/db" "$rvm_user_path/rvmrcs" \
"$(__rvm_rvmrc_key "$1")" "0;$(__rvm_md5_for_contents "$1")$(__rvm_sha256_for_contents "$1")" >/dev/null 2>&1
}
__rvm_rvmrc_stored_trust()
{
"${rvm_scripts_path:-"$rvm_path/scripts"}/db" "$rvm_user_path/rvmrcs" \
"$(__rvm_rvmrc_key "$1")"
return $?
}
__rvm_rvmrc_tools()
{
export escape_flag
typeset rvmrc_action rvmrc_path saveIFS trust rvmrc_ruby
escape_flag=1
rvmrc_action="$1"
(( $# )) && shift || true
if [[ "${rvmrc_action}" == "create" ]]
then
rvmrc_ruby="${1:-${MY_RUBY_HOME##*/}}"
rvmrc_path="$(builtin cd "$PWD" >/dev/null 2>&1; pwd)"
elif [[ "${1:-}" == "all" ]]
then
rvmrc_path="all"
else
rvmrc_path="$(builtin cd "${1:-$PWD}" >/dev/null 2>&1; pwd)"
fi
(( $# )) && shift || true
if (( $# ))
then rvmrc_path="${rvmrc_path}/$1"
elif [[ -s "${rvmrc_path}/.rvmrc" ]]
then rvmrc_path="${rvmrc_path}/.rvmrc"
elif [[ -s "${rvmrc_path}/.versions.conf" ]]
then rvmrc_path="${rvmrc_path}/.versions.conf"
elif [[ -f "${rvmrc_path}/.ruby-version" ]]
then rvmrc_path="${rvmrc_path}/.ruby-version"
elif [[ -f "${rvmrc_path}/.rbfu-version" ]]
then rvmrc_path="${rvmrc_path}/.rbfu-version"
elif [[ -f "${rvmrc_path}/.rbenv-version" ]]
then rvmrc_path="${rvmrc_path}/.rbenv-version"
elif [[ -f "${rvmrc_path}/Gemfile" ]]
then rvmrc_path="${rvmrc_path}/Gemfile"
elif [[ "${rvmrc_path}" == "all" ]]
then rvmrc_path="all"
else rvmrc_path="${rvmrc_path}/.rvmrc"
fi
case "$rvmrc_action" in
create)
(
rvm_ruby_string="${rvmrc_ruby}"
rvm_create_flag=1 __rvm_use
case "${rvmrc_path}" in
(*/.rvmrc|*/--rvmrc)
__rvm_set_rvmrc
;;
(*/.ruby-version|*/--ruby-version)
__rvm_set_ruby_version
;;
(*/.versions.conf|*/--versions-conf)
__rvm_set_versions_conf
;;
(*)
rvm_error "Unrecognized project file format"
return 1
;;
esac
)
;;
reset)
__rvm_reset_rvmrc_trust "$rvmrc_path"
echo "Reset trust for $rvmrc_path"
;;
trust)
__rvm_trust_rvmrc "$rvmrc_path"
echo "Marked $rvmrc_path as trusted"
;;
untrust)
__rvm_untrust_rvmrc "$rvmrc_path"
echo "Marked $rvmrc_path as untrusted"
;;
trusted)
if [[ -f "$rvmrc_path" ]]
then
saveIFS=$IFS
IFS=$';'
trust=($(__rvm_rvmrc_stored_trust "$rvmrc_path"))
IFS=$saveIFS
if [[ "${trust[${_second}]:-'#'}" != "$(__rvm_md5_for_contents "$rvmrc_path")$(__rvm_sha256_for_contents "$rvmrc_path")" ]]
then
echo "The rvmrc at '$rvmrc_path' contains unreviewed changes."
elif [[ "${trust[${_first}]}" == '1' ]]
then
echo "The rvmrc at '$rvmrc_path' is currently trusted."
elif [[ "${trust[${_first}]}" == '0' ]]
then
echo "The rvmrc at '$rvmrc_path' is currently untrusted."
else
echo "The trustiworthiness of '$rvmrc_path' is currently unknown."
fi
else
echo "There is no $rvmrc_path"
fi
;;
is_trusted)
if [[ -f "$rvmrc_path" ]]
then
saveIFS=$IFS
IFS=$';'
trust=($(__rvm_rvmrc_stored_trust "$rvmrc_path"))
IFS=$saveIFS
if [[ "${trust[${_second}]:-'#'}" != "$(__rvm_md5_for_contents "$rvmrc_path")$(__rvm_sha256_for_contents "$rvmrc_path")" ]]
then
return 1
elif [[ "${trust[${_first}]}" == '1' ]]
then
return 0
else
return 1
fi
else
return 1
fi
;;
load)
rvm_rvmrc_cwd="" rvm_trust_rvmrcs_flag=1 \
__rvm_project_rvmrc "$(dirname "$rvmrc_path")" "$(basename "$rvmrc_path")"
;;
try_to_read_ruby)
case "$rvmrc_path" in
(*/.rvmrc)
if ! __rvm_rvmrc_tools is_trusted "$(dirname "$rvmrc_path")" "$(basename "$rvmrc_path")"
then
# subprocess to not mess with current process variables
( __rvm_project_rvmrc "$(dirname "$rvmrc_path")" "$(basename "$rvmrc_path")" >/dev/null 2>&1 )
fi
if __rvm_rvmrc_tools is_trusted "$(dirname "$rvmrc_path")" "$(basename "$rvmrc_path")"
then
rvm_action="${rvm_action:-use}"
rvm_ruby_string="$(
rvm_rvmrc_cwd=""
rvm_trust_rvmrcs_flag=1
__rvm_project_rvmrc "$(dirname "$rvmrc_path")" "$(basename "$rvmrc_path")" >/dev/null 2>&1
__rvm_env_string
)"
rvm_ruby_strings="$rvm_ruby_string"
else
rvm_action="error"
rvm_error_message="The give path does not contain '$(basename "$rvmrc_path")' (or it is not trusted): '$(dirname "$rvmrc_path")' rest of params: '$@'"
fi
;;
(*)
rvm_action="${rvm_action:-use}"
rvm_ruby_string="$(
rvm_rvmrc_cwd=""
rvm_trust_rvmrcs_flag=1
__rvm_project_rvmrc "$(dirname "$rvmrc_path")" "$(basename "$rvmrc_path")" >/dev/null 2>&1
__rvm_env_string
)"
rvm_ruby_strings="$rvm_ruby_string"
;;
esac
;;
*)
echo "Usage: rvm rvmrc {trust,untrust,trusted,load,reset,is_trusted,try_to_read_ruby}"
return 1
;;
esac
unset escape_flag
return $?
}
__rvm_check_rvmrc_trustworthiness()
{
typeset saveIFS trust result
# Trust when they have the flag... of doom!
if [[ -n "$1" && ${rvm_trust_rvmrcs_flag:-0} == 0 ]]
then
saveIFS="$IFS"
IFS=$';'
trust=( $( __rvm_rvmrc_stored_trust "$1" ) )
IFS="$saveIFS"
if [[ "${trust[${_second}]:-'#'}" != "$(__rvm_md5_for_contents "$1")$(__rvm_sha256_for_contents "$1")" ]]
then
__rvm_ask_to_trust "$1"
else
[[ "${trust[${_first}]}" == '1' ]]
fi
fi
result=$?
unset escape_flag
return $result
}
__rvm_display_rvmrc()
{
typeset _rvmrc_base _read_char_flag
_rvmrc_base="$(basename "${_rvmrc}")"
[[ -n "${ZSH_VERSION:-}" ]] && _read_char_flag=k || _read_char_flag=n
printf "
====================================================================================
= %-80s =
= After reading the file, you will be prompted again for 'yes or no' to set =
= the trust level for this particular version of the file. =
= =
= %-80s =
= changes, and may change the trust setting manually at any time. =
====================================================================================
(( press a key to review the ${_rvmrc_base} file ))
" \
"The contents of the ${_rvmrc_base} file will now be displayed." \
"Note: You will be re-prompted each time the ${_rvmrc_base} file's contents change"
builtin read -${_read_char_flag} 1 -s -r anykey
printf "%b" "${rvm_warn_clr}"
command cat -v "${_rvmrc}"
printf "%b" "${rvm_reset_clr}"
printf "
====================================================================================
= %-80s =
====================================================================================
= %-80s =
= %-80s =
= Note that if the contents of the file change, you will be re-prompted to =
= review the file and adjust its trust settings. You may also change the =
= trust settings manually at any time with the 'rvm rvmrc' command. =
====================================================================================
" \
"Viewing of ${_rvmrc} complete." \
"Trusting an ${_rvmrc_base} file means that whenever you cd into this directory," \
"RVM will run this ${_rvmrc_base} shell script."
}
__rvm_ask_to_trust()
{
typeset trusted value anykey _rvmrc
_rvmrc="${1}"
if [[ ! -t 0 ]] || (( ${rvm_promptless:=0} == 1 )) || [[ -n "$MC_SID" ]]
then
return 2
fi
printf "====================================================================================
= NOTICE =
====================================================================================
= %-80s =
= This is a shell script and therefore may contain any shell commands. =
= =
= Examine the contents of this file carefully to be sure the contents are =
= safe before trusting it! ( Choose v[iew] below to view the contents ) =
====================================================================================
" \
"RVM has encountered a new or modified $(basename "${_rvmrc}") file in the current directory"
trusted=0
while (( ! trusted ))
do
printf "Do you wish to trust this $(basename "${_rvmrc}") file? (%b)\n" "${_rvmrc}"
printf "%b" 'y[es], n[o], v[iew], c[ancel]> '
builtin read response
value="$(echo -n "${response}" | \tr '[[:upper:]]' '[[:lower:]]' | __rvm_strip)"
case "${value:-n}" in
v|view)
__rvm_display_rvmrc
;;
y|yes)
trusted=1
;;
n|no)
break
;;
c|cancel)
return 1
;;
esac
done
if (( trusted ))
then
__rvm_trust_rvmrc "$1"
return 0
else
__rvm_untrust_rvmrc "$1"
return 1
fi
}
# Checks the rvmrc for the given directory. Note that if
# argument is passed, it will be used instead of pwd.
__rvm_project_rvmrc()
{
export __rvm_project_rvmrc_lock
: __rvm_project_rvmrc_lock:${__rvm_project_rvmrc_lock:=0}
: __rvm_project_rvmrc_lock:$((__rvm_project_rvmrc_lock+=1))
if (( __rvm_project_rvmrc_lock > 1 ))
then return 0 # no nesting
fi
typeset working_dir requested_file found_file rvm_trustworthiness_result
# Get the first argument or the pwd.
working_dir="${1:-"$PWD"}"
requested_file="${2:-}"
while :
do
if [[ -z "$working_dir" || "$HOME" == "$working_dir" || "/" == "$working_dir" ]]
then
if [[ -n "${rvm_current_rvmrc:-""}" ]]
then
__rvm_remove_rvm_from_path ; __rvm_conditionally_add_bin_path
if (( ${rvm_project_rvmrc_default:-0} == 1 ))
then
__rvm_load_environment "default"
elif [[ -n "${rvm_previous_environment:-""}" ]]
then
__rvm_load_environment "$rvm_previous_environment"
fi
unset rvm_current_rvmrc rvm_previous_environment
fi
break
else
if [[ -n "${requested_file}" && -f "$working_dir/${requested_file}" ]]
then found_file="$working_dir/${requested_file}"
elif [[ -f "$working_dir/.rvmrc" ]]
then found_file="$working_dir/.rvmrc"
elif [[ -f "$working_dir/.versions.conf" ]]
then found_file="$working_dir/.versions.conf"
elif [[ -f "$working_dir/.ruby-version" ]]
then found_file="$working_dir/.ruby-version"
elif [[ -f "$working_dir/.rbfu-version" ]]
then found_file="$working_dir/.rbfu-version"
elif [[ -f "$working_dir/.rbenv-version" ]]
then found_file="$working_dir/.rbenv-version"
elif [[ -f "$working_dir/Gemfile" ]]
then found_file="$working_dir/Gemfile"
fi
if [[ -n "${found_file}" ]]
then
if [[ "${rvm_current_rvmrc:-""}" != "${found_file}" ]]
then
if __rvm_conditionally_do_with_env __rvm_load_project_config "${found_file}"
then true
else
rvm_trustworthiness_result=$?
unset __rvm_project_rvmrc_lock
return "$rvm_trustworthiness_result"
fi
fi
break
else
working_dir="$(dirname "$working_dir")"
fi
fi
done
unset __rvm_project_rvmrc_lock
return $?
}
__rvm_load_project_config()
{
typeset __gemfile
: rvm_autoinstall_bundler_flag:${rvm_autoinstall_bundler_flag:=0}
case "$1" in
(*/.rvmrc)
if __rvm_check_rvmrc_trustworthiness "$1"
then
__rvm_remove_rvm_from_path ; __rvm_conditionally_add_bin_path
rvm_previous_environment="$(__rvm_env_string)"
rvm_current_rvmrc="$1"
__rvm_ensure_is_a_function
source "$1"
else return $?
fi
;;
(*/.versions.conf)
typeset _gem _gem_names _bundle_install
__rvm_ensure_is_a_function
rvm_previous_environment="$(__rvm_env_string)"
rvm_current_rvmrc="$1"
rvm_ruby_string="$(sed -n '/^ruby=/ {s/ruby=//;p;}' < "$1")"
[[ -n "${rvm_ruby_string}" ]] || return 2
rvm_gemset_name="$(sed -n '/^ruby-gemset=/ {s/ruby-gemset=//;p;}' < "$1")"
rvm_create_flag=1 __rvm_use || return 3
# TODO: read env.* # how to sanitize ?
_gem_names="$(sed -n '/^ruby-gem-install=/ {s/ruby-gem-install=//;p;}' < "$1")"
for _gem in ${_gem_names//,/ }
do
# TODO: add support for versions
if ! gem list | GREP_OPTIONS="" \grep "^${_gem} " > /dev/null
then gem install "${_gem}"
fi
done
_bundle_install="$(sed -n '/^ruby-bundle-install=/ {s/ruby-bundle-install=//;p;}' < "$1")"
if [[ -n "${_bundle_install}" ]] || [[ "${rvm_autoinstall_bundler_flag:-0}" == 1 ]]
then
if [[ "${_bundle_install}" == true ]] # prevent file named true for Gemfile
then __gemfile="$(dirname $1)/Gemfile"
elif [[ -f "${_bundle_install}" ]]
then __gemfile="${_bundle_install}"
elif [[ "${rvm_autoinstall_bundler_flag:-0}" == 1 ]]
then __gemfile="$(dirname $1)/Gemfile"
fi
fi
;;
(*/Gemfile)
typeset _bundler_version
__rvm_ensure_is_a_function
rvm_previous_environment="$(__rvm_env_string)"
rvm_current_rvmrc="$1"
rvm_ruby_string="$(sed -n '/^#ruby=/ {s/#ruby=//;p;}' < "$1")"
[[ -n "${rvm_ruby_string}" ]] || return 2
rvm_gemset_name="$(sed -n '/^#ruby-gemset=/ {s/#ruby-gemset=//;p;}' < "$1")"
rvm_create_flag=1 __rvm_use || return 3
# TODO: read #env.* # how to sanitize ?
if [[ "${rvm_autoinstall_bundler_flag:-0}" == "1" ]]
then
_bundler_version="$(sed -n '/^#ruby-bundler-version=/ {s/#ruby-bundler-version=//;p;}' < "$1")"
if ! gem list | GREP_OPTIONS="" \grep "^bundler " | \grep "${_bundler_version}" > /dev/null
then
[[ -z "${_bundler_version}" ]] || _bundler_version=" -v ${_bundler_version}"
gem install "bundler${_bundler_version}"
fi
__gemfile="$1"
fi
;;
(*/.ruby-version|*/.rbfu-version|*/.rbenv-version)
__rvm_ensure_is_a_function
rvm_previous_environment="$(__rvm_env_string)"
rvm_current_rvmrc="$1"
rvm_ruby_string="$(cat "$1")"
[[ -n "${rvm_ruby_string}" ]] || return 2
if [[ -f "$(dirname $1)/.ruby-gemset" ]]
then
rvm_gemset_name="$(cat "$(dirname $1)/.ruby-gemset")"
fi
rvm_create_flag=1 __rvm_use || return 3
# "$(dirname $1)/.rbenv-vars" ... can we support those without licensing ?
if [[ "${rvm_autoinstall_bundler_flag:-0}" == 1 && -f "$(dirname $1)/Gemfile" ]]
then
_bundler_version="$(sed -n '/^#ruby-bundler-version=/ {s/#ruby-bundler-version=//;p;}' < "$1")".strip
if ! gem list | GREP_OPTIONS="" \grep "^bundler " | \grep "${_bundler_version}" > /dev/null
then
[[ -z "${_bundler_version}" ]] || _bundler_version=" -v ${_bundler_version}"
gem install "bundler${_bundler_version}"
fi
__gemfile="$(dirname $1)/Gemfile"
fi
;;
(*)
rvm_error "Unsupported file format for '$1'"
return 1
;;
esac
if [[ -n "${__gemfile:-}" && -f "${__gemfile:-}" ]]
then bundle install --gemfile="${__gemfile}" | GREP_OPTIONS="" \grep -vE '^Using|Your bundle is complete'
fi
}
__rvm_project_rvmrc_with_env()
{
__rvm_do_with_env __rvm_project_rvmrc "$@"
}
__rvm_set_versions_conf()
{
typeset gemset identifier
if [[ -s .versions.conf ]]
then
mv .versions.conf .versions.conf.$(date +%m.%d.%Y-%H:%M:%S)
rvm_warn ".version.conf is not empty, moving aside to preserve."
fi
identifier=$(__rvm_env_string)
gemset=${identifier#*@}
identifier=${identifier%@*}
printf "%b" "ruby=$identifier
" >> .versions.conf
if [[ -n "$gemset" && "$gemset" != "$identifier" ]]
then
printf "%b" "ruby-gemset=$gemset
" >> .versions.conf
else
printf "%b" "#ruby-gemset=my-projectit
" >> .versions.conf
fi
printf "%b" "#ruby-gem-install=bundler rake
#ruby-bundle-install=true
" >> .versions.conf
}
__rvm_set_ruby_version()
{
if [[ -s .ruby-version ]]
then
mv .ruby-version .ruby-version.$(date +%m.%d.%Y-%H:%M:%S)
rvm_warn ".ruby-version is not empty, moving aside to preserve."
fi
echo "$(__rvm_env_string)" >> .ruby-version
}
__rvm_set_rvmrc()
{
typeset flags identifier short_identifier gem_file
true ${rvm_verbose_flag:=0}
if [[ "$HOME" != "$PWD" ]]
then
if (( rvm_verbose_flag ))
then
flags="use "
fi
if [[ -s .rvmrc ]]
then
mv .rvmrc .rvmrc.$(date +%m.%d.%Y-%H:%M:%S)
rvm_warn ".rvmrc is not empty, moving aside to preserve."
fi
identifier=$(__rvm_env_string)
short_identifier="${identifier#ruby-}"
short_identifier="${short_identifier%%-*}"
printf "%b" "#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
# Only full ruby name is supported here, for short names use:
# echo \"rvm use ${short_identifier}\" > .rvmrc
environment_id=\"$identifier\"
# Uncomment the following lines if you want to verify rvm version per project
# rvmrc_rvm_version=\"${rvm_version}\" # 1.10.1 seams as a safe start
# eval \"\$(echo \${rvm_version}.\${rvmrc_rvm_version} | awk -F. '{print \"[[ \"\$1*65536+\$2*256+\$3\" -ge \"\$4*65536+\$5*256+\$6\" ]]\"}' )\" || {
# echo \"This .rvmrc file requires at least RVM \${rvmrc_rvm_version}, aborting loading.\"
# return 1
# }
" >> .rvmrc
if [[ "$identifier" =~ jruby* ]]
then
printf "%b" "
# Uncomment following line if you want options to be set only for given project.
# PROJECT_JRUBY_OPTS=( --1.9 )
# The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
# chmod +x \${rvm_path}/hooks/after_use_jruby_opts
" >> .rvmrc
fi
printf "%b" "
# First we attempt to load the desired environment directly from the environment
# file. This is very fast and efficient compared to running through the entire
# CLI and selector. If you want feedback on which environment was used then
# insert the word 'use' after --create as this triggers verbose mode.
if [[ -d \"\${rvm_path:-\$HOME/.rvm}/environments\"
&& -s \"\${rvm_path:-\$HOME/.rvm}/environments/\$environment_id\" ]]
then
\\. \"\${rvm_path:-\$HOME/.rvm}/environments/\$environment_id\"
[[ -s \"\${rvm_path:-\$HOME/.rvm}/hooks/after_use\" ]] &&
\\. \"\${rvm_path:-\$HOME/.rvm}/hooks/after_use\" || true
" >> .rvmrc
if [[ " $flags " =~ " use " ]]
then
printf "%b" " if [[ \$- == *i* ]] # check for interactive shells
then echo \"Using: \$(tput setaf 2)\$GEM_HOME\$(tput sgr0)\" # show the user the ruby and gemset they are using in green
else echo \"Using: \$GEM_HOME\" # don't use colors in non-interactive shells
fi
" >> .rvmrc
fi
printf "%b" "else
# If the environment file has not yet been created, use the RVM CLI to select.
rvm --create $flags \"\$environment_id\" || {
echo \"Failed to create RVM environment '\${environment_id}'.\"
return 1
}
fi
" >> .rvmrc
for gem_file in *.gems
do
case "$gem_file" in
(\*.gems) continue ;;
esac
printf "%b" "
# If you use an RVM gemset file to install a list of gems (*.gems), you can have
# it be automatically loaded. Uncomment the following and adjust the filename if
# necessary.
#
# filename=\".gems\"
# if [[ -s \"\$filename\" ]]
# then
# rvm gemset import \"\$filename\" | GREP_OPTIONS="" \grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
# fi
" >> .rvmrc
done
if [[ -s Gemfile ]]
then
printf "%b" "
# If you use bundler, this might be useful to you:
# if [[ -s Gemfile ]] && {
# ! builtin command -v bundle >/dev/null ||
# builtin command -v bundle | GREP_OPTIONS="" \grep \$rvm_path/bin/bundle >/dev/null
# }
# then
# printf \"%b\" \"The rubygem 'bundler' is not installed. Installing it now.\\\\n\"
# gem install bundler
# fi
# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
# then
# bundle install | GREP_OPTIONS="" \grep -vE '^Using|Your bundle is complete'
# fi
" >> .rvmrc
fi
else
rvm_error ".rvmrc cannot be set in your home directory.\
\nThe home .rvmrc is for global rvm settings only."
fi
}
__rvm_project_dir_check()
{
[[ -n "${1:-}" && -d "$1" ]] && {
[[ -f "$1/.rvmrc" && -s "$1/.rvmrc" ]] ||
[[ -f "$1/.versions.conf" && -s "$1/.versions.conf" ]] ||
[[ -f "$1/.ruby-version" && -s "$1/.ruby-version" ]] ||
[[ -f "$1/.rbfu-version" && -s "$1/.rbfu-version" ]] ||
[[ -f "$1/.rbenv-version" && -s "$1/.rbenv-version" ]] ||
{
[[ -f "$1/Gemfile" && -s "$1/Gemfile" ]] &&
GREP_OPTIONS="" \grep "^#ruby=" "$1/Gemfile" >/dev/null
}
}
}
#!/usr/bin/env bash
__rvm_record_install()
{
typeset recorded_ruby_name rvm_install_record_file rvm_install_command
[[ -z "$1" ]] && return
recorded_ruby_name="$("$rvm_scripts_path/tools" strings "$1")"
rvm_install_record_file="$rvm_user_path/installs"
rvm_install_command=$(printf "%b" "$recorded_ruby_name $rvm_install_args\n")
[[ ! -f "$rvm_install_record_file" ]] && \touch "$rvm_install_record_file"
\rm -f "$rvm_install_record_file.tmp"
GREP_OPTIONS="" \grep -v "^$recorded_ruby_name " < "$rvm_install_record_file" \
> "$rvm_install_record_file.tmp"
echo "$rvm_install_command" >> "$rvm_install_record_file.tmp"
\rm -f "$rvm_install_record_file"
\mv "$rvm_install_record_file.tmp" "$rvm_install_record_file"
return 0
}
__rvm_remove_install_record()
{
typeset recorded_ruby_name rvm_install_record_file
recorded_ruby_name="$("$rvm_scripts_path/tools" strings "$1")"
rvm_install_record_file="$rvm_user_path/installs"
if [[ -s "$rvm_install_record_file" ]]; then
\mv "$rvm_install_record_file" "$rvm_install_record_file.tmp"
GREP_OPTIONS="" \grep -v "^$recorded_ruby_name " < "$rvm_install_record_file.tmp" \
> "$rvm_install_record_file"
\rm -f "$rvm_install_record_file.tmp"
fi
return 0
}
__rvm_recorded_install_command()
{
typeset recorded_ruby_name recorded_ruby_match
recorded_ruby_name="$("$rvm_scripts_path/tools" strings "$1" \
| awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
[[ -z "$recorded_ruby_name" ]] && return 1
recorded_ruby_match="^$recorded_ruby_name "
if [[ -s "$rvm_user_path/installs" ]] \
&& GREP_OPTIONS="" \grep "$recorded_ruby_match" "$rvm_user_path/installs" >/dev/null 2>&1 ; then
GREP_OPTIONS="" \grep "$recorded_ruby_match" < "$rvm_user_path/installs" | head -n1
else
return 1
fi
return $?
}
#!/usr/bin/env bash
__rvm_env_string()
{
typeset _path _string
_path="${GEM_HOME:-""}"
_string="${_path//*gems\//}"
_string="${_string//\/*/}"
printf "%b" "${_string:-system}"
}
__rvm_expand_ruby_string()
{
typeset string current_ruby
string="$1"
case "${string:-all}" in
all)
"$rvm_scripts_path/list" strings | \tr ' ' "\n"
;;
all-gemsets)
"$rvm_scripts_path/list" gemsets strings
;;
default-with-rvmrc|rvmrc)
"$rvm_scripts_path/tools" path-identifier "$PWD"
;;
all-rubies|rubies)
"$rvm_scripts_path/list" rubies strings
;;
current-ruby|gemsets)
current_ruby="$(__rvm_env_string)"
current_ruby="${current_ruby%@*}"
rvm_silence_logging=1 "$rvm_scripts_path/gemsets" list strings \
| \sed "s/ (default)//; s/^/$current_ruby${rvm_gemset_separator:-@}/ ; s/@default// ;"
;;
current)
__rvm_env_string
;;
aliases)
awk -F= '{print $string}' < "$rvm_path/config/alias"
;;
*)
__rvm_ruby_strings_exist $( echo "$string" | \tr "," "\n" | __rvm_strip )
;;
esac
}
__rvm_become()
{
# set rvm_rvmrc_flag=0 to not create .rvmrc in random places of code
typeset string rvm_rvmrc_flag
string="$1"
rvm_rvmrc_flag=0
[[ -n "$string" ]] && rvm_ruby_string="$string"
__rvm_use > /dev/null 2>&1
rvm_ruby_string="${rvm_ruby_string}${rvm_gemset_name:+${rvm_gemset_separator:-'@'}}${rvm_gemset_name:-}"
return 0
}
__rvm_ensure_has_environment_files()
{
typeset environment_id file_name directory identifier variable value variables
environment_id="$(__rvm_env_string)"
file_name="${rvm_environments_path}/$environment_id"
if [[ ! -d "$rvm_environments_path" ]]
then
\mkdir -p "$rvm_environments_path"
fi
if [[ ! -s "$file_name" ]] || ! GREP_OPTIONS="" \grep 'rvm_env_string=' "$file_name" >/dev/null
then
rm -f "$file_name"
printf "%b" \
"export PATH ; PATH=\"${rvm_ruby_gem_home}/bin:${rvm_ruby_global_gems_path}/bin:${rvm_ruby_home}/bin:${rvm_bin_path}:\$PATH\"\n" \
> "$file_name"
for variable in rvm_env_string rvm_path rvm_ruby_string rvm_gemset_name \
RUBY_VERSION GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC MAGLEV_HOME RBXOPT
do
eval "export $variable"
eval "value=\${${variable}:-""}"
if [[ -n "$value" ]]
then
printf "export %b ; %b='%b'\n" "${variable}" "${variable}" "${value}" >> "$file_name"
else
printf "unset %b\n" "${variable}" >> "$file_name"
fi
done
fi
# Next, ensure we have default wrapper files. Also, prevent it from recursing.
if (( ${rvm_create_default_wrappers:=0} == 1 )) ||
[[ ! -f "$rvm_wrappers_path/$environment_id/ruby" ]]
then
# We need to generate wrappers for both the default gemset and the global gemset.
for identifier in "$environment_id" "${environment_id//@*/}@global"
do
rvm_create_default_wrappers=1
directory="$rvm_wrappers_path/$identifier"
if [[ ! -L "$directory" && ! -d "$directory" ]]; then
\mkdir -p "$directory"
"$rvm_scripts_path/wrapper" "$identifier" &> /dev/null
fi
done
rvm_create_default_wrappers=0
fi
return 0
}
# Loop over the currently installed rubies and refresh their binscripts.
__rvm_bin_scripts()
{
for rvm_ruby_binary in "$rvm_rubies_path"/*/bin/ruby
do
if [[ -x "$rvm_ruby_binary" ]]
then
rvm_ruby_string=$(
dirname "$rvm_ruby_binary" | xargs dirname | xargs basename
)
__rvm_select
__rvm_bin_script
fi
done
return 0
}
# Write the bin/ wrapper script for currently selected ruby.
# TODO: Adjust binscript to be able to handle all rubies,
# not just the standard interpreteres.
__rvm_bin_script()
{
"$rvm_scripts_path/wrapper" "$rvm_ruby_string"
}
# Runs a command in a given env.
__rvm_run_with_env()
{
typeset name environment _command message log path
name="${1:-""}"
environment="${2:-""}"
_command="${3:-""}"
message="${4:-""}"
[[ -n "$environment" ]] || environment="$(__rvm_env_string)"
if [[ -n "$message" ]] ; then rvm_log "$message" ; fi
if (( ${rvm_debug_flag:=0} == 1 ))
then
rvm_debug "Executing: $_command in environment $environment"
fi
path="${rvm_log_path}/$rvm_ruby_string"
log="$path/$name.log"
if [[ ! -d "$path" ]]
then
command mkdir -p "$path"
fi
if [[ ! -f "$log" ]]
then
command touch "$log" # for zsh :(
fi
printf "%b" "[$(date +'%Y-%m-%d %H:%M:%S')] $_command # under $environment\n" >> "${log}"
if (( ${rvm_niceness:=0} > 0 ))
then
_command="nice -n $rvm_niceness $_command"
fi
(
rvm_ruby_string="$environment"
__rvm_use
eval "$_command" >> "${log}" 2>&1
)
result=$?
if (( result > 0 ))
then
rvm_error "Error running '$command' under $env_name,\nplease read $log"
fi
return ${result:-0}
}
# Set shell options that RVM needs temporarily, these are reverted by __rvm_teardown.
# see the top of ./scripts/initialize for settings that are needed all the time.
# Setup must be always called after initialize, otherwise it does nothing ... except exporting.
__rvm_setup()
{
# NOTE: the same set is located below - maker kjfdngkjd
export rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_autoconf_flags rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_ignore_gemsets_flag rvm_install_on_use_flag
export rvm_gems_cache_path rvm_gems_path rvm_man_path rvm_ruby_gem_path rvm_ruby_log_path rvm_ruby_load_path rvm_gems_cache_path rvm_archives_path rvm_docs_path rvm_environments_path rvm_examples_path rvm_gems_path rvm_gemsets_path rvm_help_path rvm_hooks_path rvm_lib_path rvm_log_path rvm_patches_path rvm_repos_path rvm_rubies_path rvm_scripts_path rvm_src_path rvm_tmp_path rvm_user_path rvm_usr_path rvm_wrappers_path rvm_externals_path
export rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_tag rvm_ruby_sha rvm_ruby_version rvm_ruby_require rvm_ruby_package_file rvm_ruby_name rvm_ruby_name rvm_ruby_args rvm_ruby_user_tag rvm_ruby_patch detected_rvm_ruby_name
export __rvm_env_loaded next_token rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_patch_names rvm_tar_command rvm_tar_options rvm_ree_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name
# Setup only on first load.
if (( __rvm_env_loaded != 1 ))
then return 0
fi
if [[ -n "${BASH_VERSION:-}" ]] && ! __function_on_stack cd pushd popd
then
trap 'status=$? ; __rvm_teardown_final ; set +x ; return $status' 0 1 2 3 15
fi
if [[ -n "${ZSH_VERSION:-}" ]]
then
export rvm_zsh_clobber rvm_zsh_nomatch
# Set clobber for zsh users, for compatibility with bash's append operator ( >> file ) behavior
if setopt | GREP_OPTIONS="" \grep -s '^noclobber$' >/dev/null 2>&1
then rvm_zsh_clobber=0
else rvm_zsh_clobber=1
fi
setopt clobber
# Set no_nomatch so globs that don't match any files don't print out a warning
if setopt | GREP_OPTIONS="" \grep -s '^nonomatch$' >/dev/null 2>&1
then rvm_zsh_nomatch=0
else rvm_zsh_nomatch=1
fi
setopt no_nomatch
fi
}
__rvm_teardown()
{
if builtin command -v __rvm_cleanup_tmp >/dev/null 2>&1
then
__rvm_cleanup_tmp
fi
export __rvm_env_loaded
# if __rvm_env_loaded is not set - detect it via rvm_tmp_path
: __rvm_env_loaded:${__rvm_env_loaded:=${rvm_tmp_path:+1}}:
: __rvm_env_loaded:${__rvm_env_loaded:=0}:
# decrease load count counter
: __rvm_env_loaded:$(( __rvm_env_loaded-=1 )):
#skip teardown when already done or when not yet finished
if [[ -z "${rvm_tmp_path:-}" ]] || (( __rvm_env_loaded > 0 ))
then
return 0
fi
if [[ -n "${BASH_VERSION:-}" ]]
then
trap - 0 1 2 3 15 # Clear all traps, we do not want to go into an loop.
fi
if [[ -n "${ZSH_VERSION:-""}" ]]
then
# If rvm_zsh_clobber is 0 then "setopt" contained "noclobber" before rvm performed "setopt clobber".
(( rvm_zsh_clobber == 0 )) && setopt noclobber
# If rvm_zsh_nomatch is 0 then "setopt" contained "nonomatch" before rvm performed "setopt nonomatch".
(( rvm_zsh_nomatch == 0 )) || setopt nomatch
unset rvm_zsh_clobber rvm_zsh_nomatch
fi
if [[ -n "${rvm_stored_umask:-}" ]]
then
umask ${rvm_stored_umask}
fi
# TODO: create a cleanse array for this instead of the current hard coded
# method. The array will be appended to whenever variables are used that
# should be cleaned up when the current RVM commadn is done.
# Cleanse and purge! (may be some redundancy here)
#
# NOTE: Removing rvm_bin_path here causes system wide installations to generate
# a corrupt PATH, breaking the RVM installation.
#
# NOTE: the same set is located above - maker kjfdngkjd
unset rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_autoconf_flags rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_ignore_gemsets_flag rvm_install_on_use_flag
unset rvm_gems_cache_path rvm_gems_path rvm_man_path rvm_ruby_gem_path rvm_ruby_log_path rvm_ruby_load_path rvm_gems_cache_path rvm_archives_path rvm_docs_path rvm_environments_path rvm_examples_path rvm_gems_path rvm_gemsets_path rvm_help_path rvm_hooks_path rvm_lib_path rvm_log_path rvm_patches_path rvm_repos_path rvm_rubies_path rvm_scripts_path rvm_src_path rvm_tmp_path rvm_user_path rvm_usr_path rvm_wrappers_path rvm_externals_path
unset rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_tag rvm_ruby_sha rvm_ruby_version rvm_ruby_require rvm_ruby_package_file rvm_ruby_name rvm_ruby_name rvm_ruby_args rvm_ruby_user_tag rvm_ruby_patch detected_rvm_ruby_name
unset __rvm_env_loaded next_token rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_patch_names rvm_tar_command rvm_tar_options rvm_ree_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name
if builtin command -v __rvm_cleanup_download >/dev/null 2>&1
then
__rvm_cleanup_download
fi
return 0
}
__rvm_teardown_final()
{
__rvm_env_loaded=1
unset __rvm_project_rvmrc_lock
__rvm_teardown
}
__rvm_do_with_env_before()
{
if [[ -n "${rvm_scripts_path:-}" || -n "${rvm_path:-}" ]]
then
# Load env - setup all required variables, __rvm_teardown is called on the end
source "${rvm_scripts_path:-"$rvm_path/scripts"}/initialize"
__rvm_setup
fi
}
__rvm_do_with_env_after()
{
__rvm_teardown
}
__rvm_do_with_env()
{
typeset result
__rvm_do_with_env_before
"$@"
result=$?
__rvm_do_with_env_after
return ${result:-0}
}
__rvm_conditionally_do_with_env()
{
if (( __rvm_env_loaded > 0 ))
then
"$@"
else
__rvm_do_with_env "$@"
fi
}
__rvm_ensure_is_a_function()
{
if [[ ${rvm_reload_flag:=0} == 1 ]] || ! is_a_function rvm
then
for script in version selector selector_gemsets cd cli override_gem
do
if [[ -f "$rvm_scripts_path/$script" ]]
then
source "$rvm_scripts_path/$script"
else
printf "%b" \
"WARNING:
Could not source '$rvm_scripts_path/$script' as file does not exist.
RVM will likely not work as expected.\n"
fi
done
fi
}
#!/usr/bin/env bash
__rvm_current_gemset()
{
# Fetch the current gemset via GEM_HOME
typeset current_gemset
current_gemset="${GEM_HOME:-}"
# We only care about the stuff to the right of the separator.
current_gemset="${current_gemset##*${rvm_gemset_separator:-@}}"
if [[ "${current_gemset}" == "${GEM_HOME:-}" ]] ; then
echo ''
else
echo "${current_gemset}"
fi
}
__rvm_using_gemset_globalcache()
{
"$rvm_scripts_path/db" "$rvm_user_path/db" \
"use_gemset_globalcache" | GREP_OPTIONS="" \grep '^true$' >/dev/null 2>&1
return $?
}
__rvm_current_gemcache_dir()
{
if __rvm_using_gemset_globalcache; then
echo "$rvm_gems_cache_path"
else
echo "${rvm_ruby_gem_home:-"$GEM_HOME"}/cache"
fi
return 0
}
#!/usr/bin/env bash
# Query the rvm key-value database for a specific key
# Allow overrides from user specifications in $rvm_user_path/db
__rvm_db()
{
typeset value key variable
key=${1:-""}
key=${key#go} # Support for goruby - remove the go
variable=${2:-""}
if [[ -f "$rvm_user_path/db" ]] ; then
value="$("$rvm_scripts_path/db" "$rvm_user_path/db" "$key")"
fi
if [[ -z "$value" ]] ; then
value="$("$rvm_scripts_path/db" "$rvm_path/config/db" "$key")"
fi
if [[ -n "$value" ]] ; then
if [[ -z "$variable" ]] ; then
echo $value
else
eval "$variable='$value'"
fi
fi
return 0
}
#!/usr/bin/env bash
unset scripts entry rvm_base_except
printf "%b" "$PATH" | awk -v RS=: -v ORS=: '!($0 in a){a[$0];print}'
+ /scripts/cli : __rvm_parse_args() 758 > [[ -n '' ]]
+ /scripts/cli : __rvm_parse_args() 759 > export 'PS4=+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ /scripts/cli : __rvm_parse_args() 759 > PS4='+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ /scripts/cli : __rvm_parse_args() 790 > [[ -z '' ]]
+ /scripts/cli : __rvm_parse_args() 790 > [[ -n '' ]]
+ /scripts/cli : __rvm_parse_args() 792 > [[ 0 -eq 1 ]]
+ /scripts/cli : __rvm_parse_args() 792 > [[ -n '' ]]
+ /scripts/cli : __rvm_parse_args() 13 > [[ -n info ]]
+ /scripts/cli : __rvm_parse_args() 15 > rvm_token=info
+ /scripts/cli : __rvm_parse_args() 17 > (( 1 > 0 ))
+ /scripts/cli : __rvm_parse_args() 19 > next_token=rvm
+ /scripts/cli : __rvm_parse_args() 20 > shift
+ /scripts/cli : __rvm_parse_args() 38 > case "$rvm_token" in
+ /scripts/cli : __rvm_parse_args() 42 > case "$rvm_token" in
+ /scripts/cli : __rvm_parse_args() 234 > [[ ls == '' ]]
+ /scripts/cli : __rvm_parse_args() 236 > rvm_action=info
+ /scripts/cli : __rvm_parse_args() 237 > rvm_ruby_args=("$next_token" "$@")
+ /scripts/cli : __rvm_parse_args() 238 > rvm_parse_break=1
+ /scripts/cli : __rvm_parse_args() 790 > [[ -z info ]]
+ /scripts/cli : __rvm_parse_args() 792 > [[ 1 -eq 1 ]]
+ /scripts/cli : __rvm_parse_args() 792 > break
+ /scripts/cli : __rvm_parse_args() 796 > [[ 0 -gt 0 ]]
+ /scripts/cli : __rvm_parse_args() 798 > [[ -n '' ]]
+ /scripts/cli : rvm() 861 > result=0
+ /scripts/cli : rvm() 863 > rvm_action=info
+ /scripts/cli : rvm() 865 > [[ 0 -gt 0 ]]
+ /scripts/cli : rvm() 879 > case "$rvm_action" in
+ /scripts/cli : rvm() 951 > rvm_is_not_a_shell_function=
+ /scripts/cli : rvm() 951 > /usr/local/rvm/scripts/info rvm
bash: __rvm_select: line 275: syntax error near unexpected token `('
bash: __rvm_select: line 275: ` +([[:digit:]]).+([[:digit:]]).+([[:digit:]]))'
bash: error importing function definition for `__rvm_select'
bash: __rvm_rm_rf: line 13: syntax error near unexpected token `('
bash: __rvm_rm_rf: line 13: ` *(/|.)@(|/Applications|/Developer|/Guides|/Information|/Library|/Network|/System|/User|/Users|/Volumes|/backups|/bdsm|/bin|/boot|/cores|/data|/dev|/etc|/home|/lib|/lib64|/mach_kernel|/media|/misc|/mnt|/net|/opt|/private|/proc|/root|/sbin|/selinux|/srv|/sys|/tmp|/usr|/var))'
bash: error importing function definition for `__rvm_rm_rf'
bash: __rvm_ruby_string: line 103: syntax error near unexpected token `('
bash: __rvm_ruby_string: line 103: ` 0.+([[:digit:]]) | 0.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]) | 2.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]))'
bash: error importing function definition for `__rvm_ruby_string'
bash: __rvm_parse_args: line 333: syntax error near unexpected token `('
bash: __rvm_parse_args: line 333: ` +([[:digit:]]).+([[:digit:]])*)'
bash: error importing function definition for `__rvm_parse_args'
++ /scripts/base : 11 > [[ -z '' ]]
++ /scripts/base : 16 > export PS4
++ /scripts/base : 17 > PS4='+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
++ /scripts/base : 26 > export __array_start rvm_path
++ /scripts/base : 31 > [[ -n '' ]]
++ /scripts/base : 35 > __array_start=0
++ /scripts/base : 38 > (( 0 == 0 ))
++ /scripts/base : 40 > : rvm_stored_umask:0022
++ /scripts/base : 41 > for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
++ /scripts/base : 43 > [[ -f /etc/rvmrc ]]
++ /scripts/base : 45 > GREP_OPTIONS=
++ /scripts/base : 45 > grep '^\s*rvm .*$' /etc/rvmrc
++ /scripts/base : 54 > source /etc/rvmrc
+++ /etc/rvmrc : 1 > rvm_project_rvmrc=1
+++ /etc/rvmrc : 2 > rvm_trust_rvmrcs_flag=1
+++ /etc/rvmrc : 3 > rvm_gem_options='--no-rdoc --no-ri'
+++ /etc/rvmrc : 4 > rvm_path=/usr/local/rvm
+++ /etc/rvmrc : 5 > rvm_pretty_print_flag=1
+++ /etc/rvmrc : 6 > rvm_auto_reload_flag=1
+++ /etc/rvmrc : 7 > rvm_ps1=1
+++ /etc/rvmrc : 9 > umask g+w
++ /scripts/base : 41 > for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
++ /scripts/base : 43 > [[ -f /Users/rug/.rvmrc ]]
++ /scripts/base : 60 > export rvm_path
++ /scripts/base : 61 > [[ -z /usr/local/rvm ]]
++ /scripts/base : 73 > true /usr/local/rvm/scripts
++ /scripts/base : 76 > source /usr/local/rvm/scripts/initialize
+++ /scripts/initialize : 3 > : rvm_trace_flag:1
+++ /scripts/initialize : 4 > (( rvm_trace_flag > 0 ))
+++ /scripts/initialize : 6 > set -o xtrace
+++ /scripts/initialize : 9 > [[ -z '' ]]
+++ /scripts/initialize : 14 > export PS4
+++ /scripts/initialize : 15 > PS4='+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+++ /scripts/initialize : 26 > [[ -n 3.2.48(1)-release ]]
+++ /scripts/initialize : 28 > shopt -s extglob
+++ /scripts/initialize : 38 > export __rvm_env_loaded
+++ /scripts/initialize : 40 > : __rvm_env_loaded:1:
+++ /scripts/initialize : 42 > : __rvm_env_loaded:2:
+++ /scripts/initialize : 45 > [[ -z /usr/local/rvm/tmp ]]
+++ /scripts/initialize : 45 > (( __rvm_env_loaded == 1 ))
++ /scripts/base : 80 > case " ${rvm_base_except:-} " in
++ /scripts/base : 85 > source /usr/local/rvm/scripts/selector
++ /scripts/base : 86 > source /usr/local/rvm/scripts/selector_gemsets
++ /scripts/base : 90 > typeset -a scripts
++ /scripts/base : 93 > scripts=(logging utility init cleanup env rvmrc install environment gemset db bundler)
++ /scripts/base : 94 > for entry in '${scripts[@]}'
++ /scripts/base : 95 > source /usr/local/rvm/scripts/functions/logging
+++ /scripts/functions/logging : 40 > case "${TERM:-dumb}" in
++++ /scripts/functions/logging : 49 > /usr/local/rvm/scripts/color red
+++ /scripts/functions/logging : 49 > rvm_error_clr=''
++++ /scripts/functions/logging : 50 > /usr/local/rvm/scripts/color yellow
+++ /scripts/functions/logging : 50 > rvm_warn_clr=''
++++ /scripts/functions/logging : 51 > /usr/local/rvm/scripts/color magenta
+++ /scripts/functions/logging : 51 > rvm_debug_clr=''
++++ /scripts/functions/logging : 52 > /usr/local/rvm/scripts/color green
+++ /scripts/functions/logging : 52 > rvm_notify_clr=''
++++ /scripts/functions/logging : 53 > /usr/local/rvm/scripts/color reset
+++ /scripts/functions/logging : 53 > rvm_reset_clr=''
++ /scripts/base : 94 > for entry in '${scripts[@]}'
++ /scripts/base : 95 > source /usr/local/rvm/scripts/functions/utility
+++ /scripts/functions/utility : 3 > [[ -z tar ]]
+++ /scripts/functions/utility : 7 > rvm_tar_command=tar
+++ /scripts/functions/utility : 10 > [[ ! =~ --no-same-owner ]]
+++ /scripts/functions/utility : 11 > tar --help
+++ /scripts/functions/utility : 11 > GREP_OPTIONS=
+++ /scripts/functions/utility : 11 > grep -- --no-same-owner
++ /scripts/base : 94 > for entry in '${scripts[@]}'
++ /scripts/base : 95 > source /usr/local/rvm/scripts/functions/init
++ /scripts/base : 94 > for entry in '${scripts[@]}'
++ /scripts/base : 95 > source /usr/local/rvm/scripts/functions/cleanup
++ /scripts/base : 94 > for entry in '${scripts[@]}'
++ /scripts/base : 95 > source /usr/local/rvm/scripts/functions/env
++ /scripts/base : 94 > for entry in '${scripts[@]}'
++ /scripts/base : 95 > source /usr/local/rvm/scripts/functions/rvmrc
+++ /scripts/functions/rvmrc : 3 > export escape_flag _first _second
+++ /scripts/functions/rvmrc : 4 > escape_flag=1
+++ /scripts/functions/rvmrc : 5 > _first=0
+++ /scripts/functions/rvmrc : 6 > _second=1
++ /scripts/base : 94 > for entry in '${scripts[@]}'
++ /scripts/base : 95 > source /usr/local/rvm/scripts/functions/install
++ /scripts/base : 94 > for entry in '${scripts[@]}'
++ /scripts/base : 95 > source /usr/local/rvm/scripts/functions/environment
++ /scripts/base : 94 > for entry in '${scripts[@]}'
++ /scripts/base : 95 > source /usr/local/rvm/scripts/functions/gemset
++ /scripts/base : 94 > for entry in '${scripts[@]}'
++ /scripts/base : 95 > source /usr/local/rvm/scripts/functions/db
++ /scripts/base : 94 > for entry in '${scripts[@]}'
++ /scripts/base : 95 > source /usr/local/rvm/scripts/functions/bundler
++ /scripts/base : 97 > unset scripts entry rvm_base_except
+ /scripts/info : 6 > source /usr/local/rvm/scripts/version
+ /scripts/info : 192 > rvm_ruby_gem_home=/usr/local/rvm/gems/ruby-1.9.3-p194
+ /scripts/info : 194 > [[ ! -d /usr/local/rvm/gems/ruby-1.9.3-p194 ]]
+ /scripts/info : 198 > rvm_info=
+ /scripts/info : 200 > args=($*)
+ /scripts/info : 202 > ruby_strings=rvm
+ /scripts/info : 203 > args[$__array_start]=
+ /scripts/info : 204 > args=(${args[@]})
+ /scripts/info : 206 > sections=
+ /scripts/info : 207 > all_sections='system rvm ruby homes binaries environment'
+ /scripts/info : 211 > /usr/local/rvm/scripts/match 'system rvm ruby homes binaries environment debug' rvm
+ /scripts/info : 212 > sections=rvm
+ /scripts/info : 213 > ruby_strings=
+ /scripts/info : 216 > [[ -z rvm ]]
+ /scripts/info : 220 > rvm_is_a_shell_function
+ /scripts/functions/utility : rvm_is_a_shell_function() 285 > (( 0 > 0 ))
+ /scripts/functions/utility : rvm_is_a_shell_function() 301 > return 0
+ /scripts/info : 222 > [[ -z '' ]]
++ /scripts/info : 224 > __rvm_env_string
++ /scripts/functions/environment : __rvm_env_string() 5 > typeset _path _string
++ /scripts/functions/environment : __rvm_env_string() 7 > _path=/usr/local/rvm/gems/ruby-1.9.3-p194
++ /scripts/functions/environment : __rvm_env_string() 9 > _string=ruby-1.9.3-p194
++ /scripts/functions/environment : __rvm_env_string() 10 > _string=ruby-1.9.3-p194
++ /scripts/functions/environment : __rvm_env_string() 12 > printf %b ruby-1.9.3-p194
+ /scripts/info : 224 > printf %b '\nruby-1.9.3-p194:\n'
ruby-1.9.3-p194:
+ /scripts/info : 226 > info_sections
++ /scripts/info : info_sections() 178 > printf %b rvm
+ /scripts/info : info_sections() 180 > for section in '$(printf "%b" "${sections//,/ }")'
+ /scripts/info : info_sections() 182 > rvm_info=
+ /scripts/info : info_sections() 184 > info_rvm
+ /scripts/info : info_rvm() 43 > typeset installed_at years months days hours minutes seconds part
++ /scripts/info : info_rvm() 47 > __rvm_version
++ /scripts/version : __rvm_version() 17 > __rvm_meta
++ /scripts/info : info_rvm() 47 > tr '\n' ' '
++ /scripts/version : __rvm_meta() 5 > rvm_meta_author='Wayne E. Seguin'
++ /scripts/version : __rvm_meta() 6 > rvm_meta_author_email=wayneeseguin@gmail.com
++ /scripts/version : __rvm_meta() 10 > rvm_meta_authors=("Wayne E. Seguin <wayneeseguin@gmail.com>" "Michal Papis <mpapis@gmail.com>")
++ /scripts/info : info_rvm() 47 > __rvm_strip
++ /scripts/version : __rvm_meta() 11 > rvm_meta_website=https://rvm.io/
++ /scripts/version : __rvm_meta() 12 > rvm_meta_version='1.13.1 (master)'
++ /scripts/version : __rvm_version() 19 > typeset IFS release
++ /scripts/version : __rvm_version() 20 > IFS=:
++ /scripts/version : __rvm_version() 21 > rvm_meta_authors='Wayne E. Seguin <wayneeseguin@gmail.com>:Michal Papis <mpapis@gmail.com>'
++ /scripts/functions/utility : __rvm_strip() 219 > sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]]\{1,\}/ /g'
++ /scripts/version : __rvm_version() 22 > rvm_meta_authors='Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com>'
++ /scripts/version : __rvm_version() 24 > echo -e '\nrvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]\n'
++ /scripts/functions/utility : __rvm_strip() 220 > return 0
+ /scripts/info : info_rvm() 47 > rvm_info='
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
'
+ /scripts/info : info_rvm() 49 > rvm_info='
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "'
++ /scripts/info : info_rvm() 50 > cat /usr/local/rvm/installed.at
+ /scripts/info : info_rvm() 50 > installed_at=1336097547
+ /scripts/info : info_rvm() 51 > [[ -n 1336097547 ]]
+ /scripts/info : info_rvm() 51 > (( installed_at ))
++ /scripts/info : info_rvm() 53 > date +%s
+ /scripts/info : info_rvm() 53 > seconds=1755
+ /scripts/info : info_rvm() 54 > (( seconds ))
+ /scripts/info : info_rvm() 56 > minutes=29
+ /scripts/info : info_rvm() 57 > hours=0
+ /scripts/info : info_rvm() 58 > days=0
+ /scripts/info : info_rvm() 59 > months=0
+ /scripts/info : info_rvm() 60 > years=0
+ /scripts/info : info_rvm() 61 > seconds=15
+ /scripts/info : info_rvm() 62 > for part in year month day hour minute second
+ /scripts/info : info_rvm() 63 > eval 'rvm_info="${rvm_info}$(print_part ${years} year)"'
+++ /scripts/info : info_rvm() 63 > print_part 0 year
+++ /scripts/info : print_part() 34 > (( 0 ))
+++ /scripts/info : print_part() 34 > return
++ /scripts/info : info_rvm() 63 > rvm_info='
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "'
+ /scripts/info : info_rvm() 62 > for part in year month day hour minute second
+ /scripts/info : info_rvm() 63 > eval 'rvm_info="${rvm_info}$(print_part ${months} month)"'
+++ /scripts/info : info_rvm() 63 > print_part 0 month
+++ /scripts/info : print_part() 34 > (( 0 ))
+++ /scripts/info : print_part() 34 > return
++ /scripts/info : info_rvm() 63 > rvm_info='
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "'
+ /scripts/info : info_rvm() 62 > for part in year month day hour minute second
+ /scripts/info : info_rvm() 63 > eval 'rvm_info="${rvm_info}$(print_part ${days} day)"'
+++ /scripts/info : info_rvm() 63 > print_part 0 day
+++ /scripts/info : print_part() 34 > (( 0 ))
+++ /scripts/info : print_part() 34 > return
++ /scripts/info : info_rvm() 63 > rvm_info='
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "'
+ /scripts/info : info_rvm() 62 > for part in year month day hour minute second
+ /scripts/info : info_rvm() 63 > eval 'rvm_info="${rvm_info}$(print_part ${hours} hour)"'
+++ /scripts/info : info_rvm() 63 > print_part 0 hour
+++ /scripts/info : print_part() 34 > (( 0 ))
+++ /scripts/info : print_part() 34 > return
++ /scripts/info : info_rvm() 63 > rvm_info='
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "'
+ /scripts/info : info_rvm() 62 > for part in year month day hour minute second
+ /scripts/info : info_rvm() 63 > eval 'rvm_info="${rvm_info}$(print_part ${minutes} minute)"'
+++ /scripts/info : info_rvm() 63 > print_part 29 minute
+++ /scripts/info : print_part() 34 > (( 29 ))
+++ /scripts/info : print_part() 35 > typeset ret
+++ /scripts/info : print_part() 36 > ret='29 minute'
+++ /scripts/info : print_part() 37 > (( 29 == 1 ))
+++ /scripts/info : print_part() 37 > ret='29 minutes'
+++ /scripts/info : print_part() 38 > printf '29 minutes '
++ /scripts/info : info_rvm() 63 > rvm_info='
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "29 minutes '
+ /scripts/info : info_rvm() 62 > for part in year month day hour minute second
+ /scripts/info : info_rvm() 63 > eval 'rvm_info="${rvm_info}$(print_part ${seconds} second)"'
+++ /scripts/info : info_rvm() 63 > print_part 15 second
+++ /scripts/info : print_part() 34 > (( 15 ))
+++ /scripts/info : print_part() 35 > typeset ret
+++ /scripts/info : print_part() 36 > ret='15 second'
+++ /scripts/info : print_part() 37 > (( 15 == 1 ))
+++ /scripts/info : print_part() 37 > ret='15 seconds'
+++ /scripts/info : print_part() 38 > printf '15 seconds '
++ /scripts/info : info_rvm() 63 > rvm_info='
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "29 minutes 15 seconds '
+ /scripts/info : info_rvm() 65 > rvm_info='
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "29 minutes 15 seconds ago'
+ /scripts/info : info_rvm() 72 > rvm_info='
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "29 minutes 15 seconds ago"\n'
+ /scripts/info : info_sections() 186 > printf %b '
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "29 minutes 15 seconds ago"\n'
rvm:
version: "rvm 1.13.1 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "29 minutes 15 seconds ago"
+ /scripts/info : 242 > exit 0
+ /scripts/cli : rvm() 1099 > current_result=0
+ /scripts/cli : rvm() 1101 > (( result > 0 ))
+ /scripts/cli : rvm() 1101 > result=0
+ /scripts/cli : rvm() 1103 > [[ 0 -gt 0 ]]
+ /scripts/cli : rvm() 1117 > case "$rvm_action" in
+ /scripts/cli : rvm() 1115 > current_result=0
+ /scripts/cli : rvm() 1117 > (( result > 0 ))
+ /scripts/cli : rvm() 1117 > result=0
+ /scripts/cli : rvm() 1119 > [[ 0 -eq 1 ]]
+ /scripts/cli : rvm() 1125 > typeset __local_rvm_trace_flag
+ /scripts/cli : rvm() 1126 > __local_rvm_trace_flag=1
+ /scripts/cli : rvm() 1128 > __rvm_teardown
+ /scripts/functions/environment : __rvm_teardown() 1 > builtin command -v __rvm_cleanup_tmp
+ /scripts/functions/environment : __rvm_teardown() 3 > __rvm_cleanup_tmp
+ /scripts/functions/cleanup : __rvm_cleanup_tmp() 1 > [[ -d /usr/local/rvm/tmp/ ]]
+ /scripts/functions/cleanup : __rvm_cleanup_tmp() 97 > case "${rvm_tmp_path%\/}" in
+ /scripts/functions/cleanup : __rvm_cleanup_tmp() 5 > __rvm_rm_rf '/usr/local/rvm/tmp/12381*'
+ /scripts/functions/cleanup : __rvm_rm_rf() 1 > typeset result target
+ /scripts/functions/cleanup : __rvm_rm_rf() 2 > result=1
+ /scripts/functions/cleanup : __rvm_rm_rf() 3 > target='/usr/local/rvm/tmp/12381*'
+ /scripts/functions/cleanup : __rvm_rm_rf() 6 > [[ -n '' ]]
+ /scripts/functions/cleanup : __rvm_rm_rf() 10 > [[ -n 3.2.48(1)-release ]]
+ /scripts/functions/cleanup : __rvm_rm_rf() 12 > shopt -s extglob
+ /scripts/functions/cleanup : __rvm_rm_rf() 25 > case "${target}" in
+ /scripts/functions/cleanup : __rvm_rm_rf() 24 > [[ -n /usr/local/rvm/tmp/12381* ]]
+ /scripts/functions/cleanup : __rvm_rm_rf() 26 > [[ -d /usr/local/rvm/tmp/12381* ]]
+ /scripts/functions/cleanup : __rvm_rm_rf() 30 > [[ -f /usr/local/rvm/tmp/12381* ]]
+ /scripts/functions/cleanup : __rvm_rm_rf() 30 > [[ -L /usr/local/rvm/tmp/12381* ]]
+ /scripts/functions/cleanup : __rvm_rm_rf() 35 > result=0
+ /scripts/functions/cleanup : __rvm_rm_rf() 41 > return 0
+ /scripts/functions/cleanup : __rvm_cleanup_tmp() 96 > return 0
+ /scripts/functions/environment : __rvm_teardown() 258 > export __rvm_env_loaded
+ /scripts/functions/environment : __rvm_teardown() 260 > : __rvm_env_loaded:1:
+ /scripts/functions/environment : __rvm_teardown() 261 > : __rvm_env_loaded:1:
+ /scripts/functions/environment : __rvm_teardown() 263 > : __rvm_env_loaded:0:
+ /scripts/functions/environment : __rvm_teardown() 265 > [[ -z /usr/local/rvm/tmp ]]
+ /scripts/functions/environment : __rvm_teardown() 265 > (( __rvm_env_loaded > 0 ))
+ /scripts/functions/environment : __rvm_teardown() 270 > [[ -n 3.2.48(1)-release ]]
+ /scripts/functions/environment : __rvm_teardown() 272 > trap - 0 1 2 3 15
+ /scripts/functions/environment : __rvm_teardown() 275 > [[ -n '' ]]
+ /scripts/functions/environment : __rvm_teardown() 285 > [[ -n 0022 ]]
+ /scripts/functions/environment : __rvm_teardown() 287 > umask 0022
+ /scripts/functions/environment : __rvm_teardown() 299 > unset rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_autoconf_flags rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_ignore_gemsets_flag rvm_install_on_use_flag
+ /scripts/functions/environment : __rvm_teardown() 300 > unset rvm_gems_cache_path rvm_gems_path rvm_man_path rvm_ruby_gem_path rvm_ruby_log_path rvm_ruby_load_path rvm_gems_cache_path rvm_archives_path rvm_docs_path rvm_environments_path rvm_examples_path rvm_gems_path rvm_gemsets_path rvm_help_path rvm_hooks_path rvm_lib_path rvm_log_path rvm_patches_path rvm_repos_path rvm_rubies_path rvm_scripts_path rvm_src_path rvm_tmp_path rvm_user_path rvm_usr_path rvm_wrappers_path rvm_externals_path
+ /scripts/functions/environment : __rvm_teardown() 301 > unset rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_tag rvm_ruby_sha rvm_ruby_version rvm_ruby_require rvm_ruby_package_file rvm_ruby_name rvm_ruby_name rvm_ruby_args rvm_ruby_user_tag rvm_ruby_patch detected_rvm_ruby_name
+ /scripts/functions/environment : __rvm_teardown() 302 > unset __rvm_env_loaded next_token rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_patch_names rvm_tar_command rvm_tar_options rvm_ree_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name
+ /scripts/functions/environment : __rvm_teardown() 304 > builtin command -v __rvm_cleanup_download
+ /scripts/functions/environment : __rvm_teardown() 309 > return 0
+ /scripts/cli : rvm() 1136 > (( __local_rvm_trace_flag > 0 ))
+ /scripts/cli : rvm() 1138 > set +o verbose
+ /scripts/cli : rvm() 1139 > set +o xtrace
bash: __rvm_select: line 275: syntax error near unexpected token `('
bash: __rvm_select: line 275: ` +([[:digit:]]).+([[:digit:]]).+([[:digit:]]))'
bash: error importing function definition for `__rvm_select'
bash: __rvm_rm_rf: line 13: syntax error near unexpected token `('
bash: __rvm_rm_rf: line 13: ` *(/|.)@(|/Applications|/Developer|/Guides|/Information|/Library|/Network|/System|/User|/Users|/Volumes|/backups|/bdsm|/bin|/boot|/cores|/data|/dev|/etc|/home|/lib|/lib64|/mach_kernel|/media|/misc|/mnt|/net|/opt|/private|/proc|/root|/sbin|/selinux|/srv|/sys|/tmp|/usr|/var))'
bash: error importing function definition for `__rvm_rm_rf'
bash: __rvm_ruby_string: line 103: syntax error near unexpected token `('
bash: __rvm_ruby_string: line 103: ` 0.+([[:digit:]]) | 0.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]) | 2.+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]).+([[:digit:]]).+([[:digit:]]) | 1.+([[:digit:]]))'
bash: error importing function definition for `__rvm_ruby_string'
bash: __rvm_parse_args: line 333: syntax error near unexpected token `('
bash: __rvm_parse_args: line 333: ` +([[:digit:]]).+([[:digit:]])*)'
bash: error importing function definition for `__rvm_parse_args'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment