Skip to content

Instantly share code, notes, and snippets.

@thenickcox
Created July 18, 2013 03:14
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 thenickcox/6026454 to your computer and use it in GitHub Desktop.
Save thenickcox/6026454 to your computer and use it in GitHub Desktop.
Apple_PubSub_Socket_Render=/tmp/launch-FRCk2R/Render
Apple_Ubiquity_Message=/tmp/launch-vyS1ut/Apple_Ubiquity_Message
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_REMATCH=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="2" [2]="48" [3]="1" [4]="release" [5]="x86_64-apple-darwin11")
BASH_VERSION='3.2.48(1)-release'
COLUMNS=80
COMMAND_MODE=unix2003
DIRSTACK=()
DISPLAY=/tmp/launch-wYmOl0/org.x:0
EDITOR=vim
EUID=501
GEM_HOME=/Users/macbookpro/.rvm/gems/ruby-2.0.0-p0
GEM_PATH=/Users/macbookpro/.rvm/gems/ruby-2.0.0-p0:/Users/macbookpro/.rvm/gems/ruby-2.0.0-p0@global
GROUPS=()
HISTCONTROL=ignoreboth
HISTFILE=/Users/macbookpro/.bash_history
HISTFILESIZE=50000
HISTSIZE=50000
HOME=/Users/macbookpro
HOSTNAME=Nick-Coxs-Macbook-Pro.local
HOSTTYPE=x86_64
IFS=$' \t\n'
IRBRC=/Users/macbookpro/.rvm/rubies/ruby-2.0.0-p0/.irbrc
ITERM_PROFILE=Default
ITERM_SESSION_ID=w0t0p0
LANG=en_US.UTF-8
LINES=24
LOGNAME=macbookpro
MACHTYPE=x86_64-apple-darwin11
MAILCHECK=60
MANPATH=/usr/local/man:/usr/local/mysql/man:/usr/local/git/man:
MY_RUBY_HOME=/Users/macbookpro/.rvm/rubies/ruby-2.0.0-p0
OPTERR=1
OPTIND=1
OSTYPE=darwin11
PATH='/Users/macbookpro/.rvm/gems/ruby-2.0.0-p0/bin:/Users/macbookpro/.rvm/gems/ruby-2.0.0-p0@global/bin:/Users/macbookpro/.rvm/rubies/ruby-2.0.0-p0/bin:/Users/macbookpro/.rvm/bin:~/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/Users/macbookpro/.rvm/bin'
PIPESTATUS=([0]="0")
PPID=68094
PROMPT_COMMAND='echo -ne "\033k\033\\";history -a; history -n'
PS1='\n\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[0;33m\] $(parse_git_branch) \n$\[\033[00m\] '
PS2='> '
PS4='+ '
PWD=/Users/macbookpro
RUBY_VERSION=ruby-2.0.0-p0
SECURITYSESSIONID=186a8
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHLVL=1
SSH_AGENT_PID=60047
SSH_AUTH_SOCK=/tmp/ssh-J2wzRIEKq9/agent.60045
SSH_ENV=/Users/macbookpro/.ssh/environment
TERM=xterm
TERM_PROGRAM=iTerm.app
TMPDIR=/var/folders/jt/d_n84hhs77df188pv2ygv3v80000gn/T/
UID=501
USER=macbookpro
YELLOW='\[\033[0;33m\]'
_=/Users/macbookpro/.rvm/scripts/rvm
__CF_USER_TEXT_ENCODING=0x1F5:0:0
__array_start=0
__git_commandlist=$'[-c\nname=value]\n<command>\n[<args>]\nadd\nget-tar-commit-id\ngrep\nrelink\nam\ngui\nremote\nannotate\nremote-ext\napply\nremote-fd\nhelp\nremote-ftp\narchive\nremote-ftps\nbisect\nremote-http\nremote-https\nblame\nimap-send\nremote-testgit\nbranch\nrepack\nbundle\ninit\nreplace\ninstaweb\nrequest-pull\nlog\ncheckout\nlost-found\nreset\ncheckout-index\nls-files\ncherry\nls-remote\ncherry-pick\nls-tree\nrevert\ncitool\nrm\nclean\nsend-email\nclone\nmerge\ncommit\nconfig\nshortlog\ncount-objects\nshow\ncredential-cache\nshow-branch\ncredential-store\nshow-ref\nstage\nstash\nstatus\nmergetool\ndescribe\nsubmodule\ndiff\nmv\nname-rev\ntag\nnotes\ndifftool\nfast-export\nfetch\nfilter-branch\npull\nvar\npush\nverify-pack\nformat-patch\nfsck\nrebase\nwhatchanged\ngc\ncredential-osxkeychain\nsubtree'
__git_merge_strategylist=
__git_whitespacelist='nowarn warn error error-all strip'
_first=0
_second=1
escape_flag=1
old_rvm_debug_flag=0
old_rvm_verbose_flag=0
platform=Darwin
rvm_bin_path=/Users/macbookpro/.rvm/bin
rvm_debug_clr=$'\E[35m'
rvm_env_string=ruby-2.0.0-p0
rvm_error_clr=$'\E[31m'
rvm_ignore_rvmrc=0
rvm_notify_clr=$'\E[32m'
rvm_path=/Users/macbookpro/.rvm
rvm_prefix=/Users/macbookpro
rvm_reset_clr=$'\E(B\E[m'
rvm_ruby_string=ruby-2.0.0-p0
rvm_rubygems_path=/Users/macbookpro/.rvm/rubygems
rvm_version='1.18.14 (stable)'
rvm_warn_clr=$'\E[33m'
rvmrc=/Users/macbookpro/.rvmrc
script=override_gem
__function_on_stack ()
{
typeset fun;
for fun in "$@";
do
if [[ " ${FUNCNAME[*]} " =~ " $fun " ]]; then
return 0;
fi;
done;
return $#
}
__git_aliased_command ()
{
local word cmdline=$(git --git-dir="$(__gitdir)" config --get "alias.$1");
for word in $cmdline;
do
if [ "${word##-*}" ]; then
echo $word;
return;
fi;
done
}
__git_aliases ()
{
local i IFS='
';
for i in $(git --git-dir="$(__gitdir)" config --list);
do
case "$i" in
alias.*)
i="${i#alias.}";
echo "${i/=*/}"
;;
esac;
done
}
__git_commands ()
{
if [ -n "$__git_commandlist" ]; then
echo "$__git_commandlist";
return;
fi;
local i IFS=" "'
';
for i in $(git help -a|egrep '^ ');
do
case $i in
*--*)
: helper pattern
;;
applymbox)
: ask gittus
;;
applypatch)
: ask gittus
;;
archimport)
: import
;;
cat-file)
: plumbing
;;
check-attr)
: plumbing
;;
check-ref-format)
: plumbing
;;
commit-tree)
: plumbing
;;
cvsexportcommit)
: export
;;
cvsimport)
: import
;;
cvsserver)
: daemon
;;
daemon)
: daemon
;;
diff-files)
: plumbing
;;
diff-index)
: plumbing
;;
diff-tree)
: plumbing
;;
fast-import)
: import
;;
fsck-objects)
: plumbing
;;
fetch-pack)
: plumbing
;;
fmt-merge-msg)
: plumbing
;;
for-each-ref)
: plumbing
;;
hash-object)
: plumbing
;;
http-*)
: transport
;;
index-pack)
: plumbing
;;
init-db)
: deprecated
;;
local-fetch)
: plumbing
;;
mailinfo)
: plumbing
;;
mailsplit)
: plumbing
;;
merge-*)
: plumbing
;;
mktree)
: plumbing
;;
mktag)
: plumbing
;;
pack-objects)
: plumbing
;;
pack-redundant)
: plumbing
;;
pack-refs)
: plumbing
;;
parse-remote)
: plumbing
;;
patch-id)
: plumbing
;;
peek-remote)
: plumbing
;;
prune)
: plumbing
;;
prune-packed)
: plumbing
;;
quiltimport)
: import
;;
read-tree)
: plumbing
;;
receive-pack)
: plumbing
;;
reflog)
: plumbing
;;
repo-config)
: deprecated
;;
rerere)
: plumbing
;;
rev-list)
: plumbing
;;
rev-parse)
: plumbing
;;
runstatus)
: plumbing
;;
sh-setup)
: internal
;;
shell)
: daemon
;;
send-pack)
: plumbing
;;
show-index)
: plumbing
;;
ssh-*)
: transport
;;
stripspace)
: plumbing
;;
svn)
: import export
;;
symbolic-ref)
: plumbing
;;
tar-tree)
: deprecated
;;
unpack-file)
: plumbing
;;
unpack-objects)
: plumbing
;;
update-index)
: plumbing
;;
update-ref)
: plumbing
;;
update-server-info)
: daemon
;;
upload-archive)
: plumbing
;;
upload-pack)
: plumbing
;;
write-tree)
: plumbing
;;
verify-tag)
: plumbing
;;
*)
echo $i
;;
esac;
done
}
__git_complete_file ()
{
local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
?*:*)
ref="${cur%%:*}";
cur="${cur#*:}";
case "$cur" in
?*/*)
pfx="${cur%/*}";
cur="${cur##*/}";
ls="$ref:$pfx";
pfx="$pfx/"
;;
*)
ls="$ref"
;;
esac;
COMPREPLY=($(compgen -P "$pfx" -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" | sed '/^100... blob /s,^.* ,,
/^040000 tree /{
s,^.* ,,
s,$,/,
}
s/^.* //')" -- "$cur"))
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
}
__git_complete_revlist ()
{
local pfx cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
*...*)
pfx="${cur%...*}...";
cur="${cur#*...}";
__gitcomp "$(__git_refs)" "$pfx" "$cur"
;;
*..*)
pfx="${cur%..*}..";
cur="${cur#*..}";
__gitcomp "$(__git_refs)" "$pfx" "$cur"
;;
*.)
__gitcomp "$cur."
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
}
__git_heads ()
{
local cmd i is_hash=y dir="$(__gitdir "$1")";
if [ -d "$dir" ]; then
for i in $(git --git-dir="$dir" for-each-ref --format='%(refname)' refs/heads );
do
echo "${i#refs/heads/}";
done;
return;
fi;
for i in $(git-ls-remote "$1" 2>/dev/null);
do
case "$is_hash,$i" in
y,*)
is_hash=n
;;
n,*^{})
is_hash=y
;;
n,refs/heads/*)
is_hash=y;
echo "${i#refs/heads/}"
;;
n,*)
is_hash=y;
echo "$i"
;;
esac;
done
}
__git_merge_strategies ()
{
if [ -n "$__git_merge_strategylist" ]; then
echo "$__git_merge_strategylist";
return;
fi;
sed -n "/^all_strategies='/{
s/^all_strategies='//
s/'//
p
q
}" "$(git --exec-path)/git-merge"
}
__git_ps1 ()
{
local b="$(git symbolic-ref HEAD 2>/dev/null)";
if [ -n "$b" ]; then
if [ -n "$1" ]; then
printf "$1" "${b##refs/heads/}";
else
printf " (%s)" "${b##refs/heads/}";
fi;
fi
}
__git_refs ()
{
local cmd i is_hash=y dir="$(__gitdir "$1")";
if [ -d "$dir" ]; then
if [ -e "$dir/HEAD" ]; then
echo HEAD;
fi;
for i in $(git --git-dir="$dir" for-each-ref --format='%(refname)' refs/tags refs/heads refs/remotes);
do
case "$i" in
refs/tags/*)
echo "${i#refs/tags/}"
;;
refs/heads/*)
echo "${i#refs/heads/}"
;;
refs/remotes/*)
echo "${i#refs/remotes/}"
;;
*)
echo "$i"
;;
esac;
done;
return;
fi;
for i in $(git-ls-remote "$dir" 2>/dev/null);
do
case "$is_hash,$i" in
y,*)
is_hash=n
;;
n,*^{})
is_hash=y
;;
n,refs/tags/*)
is_hash=y;
echo "${i#refs/tags/}"
;;
n,refs/heads/*)
is_hash=y;
echo "${i#refs/heads/}"
;;
n,refs/remotes/*)
is_hash=y;
echo "${i#refs/remotes/}"
;;
n,*)
is_hash=y;
echo "$i"
;;
esac;
done
}
__git_refs2 ()
{
local i;
for i in $(__git_refs "$1");
do
echo "$i:$i";
done
}
__git_refs_remotes ()
{
local cmd i is_hash=y;
for i in $(git-ls-remote "$1" 2>/dev/null);
do
case "$is_hash,$i" in
n,refs/heads/*)
is_hash=y;
echo "$i:refs/remotes/$1/${i#refs/heads/}"
;;
y,*)
is_hash=n
;;
n,*^{})
is_hash=y
;;
n,refs/tags/*)
is_hash=y
;;
n,*)
is_hash=y
;;
esac;
done
}
__git_remotes ()
{
local i ngoff IFS='
' d="$(__gitdir)";
shopt -q nullglob || ngoff=1;
shopt -s nullglob;
for i in "$d/remotes"/*;
do
echo ${i#$d/remotes/};
done;
[ "$ngoff" ] && shopt -u nullglob;
for i in $(git --git-dir="$d" config --list);
do
case "$i" in
remote.*.url=*)
i="${i#remote.}";
echo "${i/.url=*/}"
;;
esac;
done
}
__git_tags ()
{
local cmd i is_hash=y dir="$(__gitdir "$1")";
if [ -d "$dir" ]; then
for i in $(git --git-dir="$dir" for-each-ref --format='%(refname)' refs/tags );
do
echo "${i#refs/tags/}";
done;
return;
fi;
for i in $(git-ls-remote "$1" 2>/dev/null);
do
case "$is_hash,$i" in
y,*)
is_hash=n
;;
n,*^{})
is_hash=y
;;
n,refs/tags/*)
is_hash=y;
echo "${i#refs/tags/}"
;;
n,*)
is_hash=y;
echo "$i"
;;
esac;
done
}
__gitcomp ()
{
local all c s='
' IFS=' '' ''
';
local cur="${COMP_WORDS[COMP_CWORD]}";
if [ $# -gt 2 ]; then
cur="$3";
fi;
for c in $1;
do
case "$c$4" in
--*=*)
all="$all$c$4$s"
;;
*.)
all="$all$c$4$s"
;;
*)
all="$all$c$4 $s"
;;
esac;
done;
IFS=$s;
COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur"));
return
}
__gitdir ()
{
if [ -z "$1" ]; then
if [ -n "$__git_dir" ]; then
echo "$__git_dir";
else
if [ -d .git ]; then
echo .git;
else
git rev-parse --git-dir 2> /dev/null;
fi;
fi;
else
if [ -d "$1/.git" ]; then
echo "$1/.git";
else
echo "$1";
fi;
fi
}
__list_remote_all_for ()
{
{
__list_remote_rubies_for "$1";
__list_remote_rbx_for "$1";
__list_remote_jruby_for "$1"
} | sort -u
}
__list_remote_jruby_for ()
{
typeset rvm_ruby_url;
rvm_ruby_url="$1";
curl -LsS http://jruby.org.s3.amazonaws.com/ | GREP_OPTIONS="" \grep -oE "<Key>[^<]+jruby-bin-[^<]+\.tar\.gz</Key>" | awk -F"[<>]" '/'"${rvm_ruby_url//\//\/}"'/{print "http://jruby.org.s3.amazonaws.com/"$3}' | sed 's/-bin-/-/'
}
__list_remote_rbx_for ()
{
typeset rvm_ruby_url;
rvm_ruby_url="$1";
curl -LsS http://binaries.rubini.us/ | GREP_OPTIONS="" \grep -oE "<Key>[^<]+\.tar\.bz2</Key>" | awk -F"[<>]" '/'"${rvm_ruby_url//\//\/}"'/{print "http://binaries.rubini.us/"$3}'
}
__list_remote_rubies_for ()
{
typeset rvm_ruby_url;
rvm_ruby_url="$1";
awk '/'"${rvm_ruby_url//\//\/}"'/{print}' < $rvm_path/config/remote;
if [[ -f $rvm_user_path/remote ]]; then
awk '/'"${rvm_ruby_url//\//\/}"'/{print}' < $rvm_user_path/remote;
fi
}
__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"
;;
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
}
__rvm_after_cd ()
{
typeset rvm_hook;
rvm_hook="after_cd";
if [[ -n "${rvm_scripts_path:-}" || -n "${rvm_path:-}" ]]; then
source "${rvm_scripts_path:-$rvm_path/scripts}/hook";
fi
}
__rvm_array_add_or_update ()
{
typeset _array_name _variable _separator _value _local_value;
typeset -a _array_value_old _array_value_new;
_array_name="$1";
_variable="$2";
_separator="$3";
_value="${4##${_separator}}";
_array_value_new=();
eval "_array_value_old=( \"\${${_array_name}[@]}\" )";
case " ${_array_value_old[*]} " in
*[[:space:]]${_variable}*)
for _local_value in "${_array_value_old[@]}";
do
case "${_local_value}" in
${_variable}*)
_array_value_new+=("${_local_value}${_separator}${_value}")
;;
*)
_array_value_new+=("${_local_value}")
;;
esac;
done
;;
*)
_array_value_new=("${_array_value_old[@]}" "${_variable}${_value}")
;;
esac;
eval "${_array_name}=( \"\${_array_value_new[@]}\" )"
}
__rvm_array_contains ()
{
typeset _search _iterator;
_search="$1";
shift;
for _iterator in "$@";
do
case "${_iterator}" in
${_search})
return 0
;;
esac;
done;
return 1
}
__rvm_array_prepend_or_ignore ()
{
typeset _array_name _variable _separator _value _local_value;
typeset -a _array_value_old _array_value_new;
_array_name="$1";
_variable="$2";
_separator="$3";
_value="$4";
_array_value_new=();
eval "_array_value_old=( \"\${${_array_name}[@]}\" )";
case " ${_array_value_old[*]} " in
*[[:space:]]${_variable}*)
for _local_value in "${_array_value_old[@]}";
do
case "${_local_value}" in
${_variable}*)
rvm_debug "__rvm_array_prepend_or_ignore ${_array_name} ${_variable}\"${_value}${_separator}${_local_value#${_variable}}\"";
_array_value_new+=("${_variable}${_value}${_separator}${_local_value#${_variable}}")
;;
*)
_array_value_new+=("${_local_value}")
;;
esac;
done;
eval "${_array_name}=( \"\${_array_value_new[@]}\" )"
;;
esac
}
__rvm_ask_for ()
{
typeset response;
rvm_warn "$1";
printf "%b" "(anything other than '$2' will cancel) > ";
read response || return $?;
[[ "$2" == "$response" ]] || return $?
}
__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 =
==============================================================================
= %-74s =
= 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
}
__rvm_become ()
{
typeset string rvm_rvmrc_flag;
string="$1";
rvm_rvmrc_flag=0;
[[ -n "$string" ]] && {
rvm_ruby_string="$string";
rvm_gemset_name=""
};
__rvm_use > /dev/null || return $?;
rvm_ruby_string="${rvm_ruby_string}${rvm_gemset_name:+${rvm_gemset_separator:-'@'}}${rvm_gemset_name:-}";
return 0
}
__rvm_bin_script ()
{
"$rvm_scripts_path/wrapper" "$rvm_ruby_string"
}
__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
}
__rvm_calculate_remote_file ()
{
rvm_remote_server_url="$( __rvm_db "rvm_remote_server_url${3:-}" )";
[[ -n "$rvm_remote_server_url" ]] || {
rvm_debug "rvm_remote_server_url${3:-} not found";
return $1
};
__rvm_system_path "" "${3:-}";
__rvm_ruby_package_file "${4:-}";
__remote_file="${rvm_remote_server_url}/${rvm_remote_server_path}${rvm_ruby_package_file}"
}
__rvm_call_with_restored_umask ()
{
rvm_umask="$(umask)";
if [[ -n "${rvm_stored_umask:-}" ]]; then
umask ${rvm_stored_umask};
fi;
"$@";
umask "${rvm_umask}";
unset rvm_umask
}
__rvm_cd ()
{
typeset old_cdpath ret;
ret=0;
old_cdpath="${CDPATH}";
CDPATH=".";
chpwd_functions="" builtin cd "$@" || ret=$?;
CDPATH="${old_cdpath}";
return $ret
}
__rvm_check_rvmrc_trustworthiness ()
{
typeset saveIFS trust result;
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_checksum_all ()
{
[[ -n "${_checksum_md5:-}" && -n "${_checksum_sha512:-}" ]]
}
__rvm_checksum_any ()
{
[[ -n "${_checksum_md5:-}" || -n "${_checksum_sha512:-}" ]]
}
__rvm_checksum_calculate_file ()
{
_checksum_md5="$( __rvm_md5_calculate "${1:-}" )";
_checksum_sha512="$( __rvm_sha__calculate 512 "${1:-}" )"
}
__rvm_checksum_none ()
{
[[ -z "${_checksum_md5:-}" && -z "${_checksum_sha512:-}" ]]
}
__rvm_checksum_read ()
{
__rvm_checksum_none || return 0;
typeset _type _value _name;
typeset -a _list;
list=();
for _name in "$@";
do
list+=("$_name");
if [[ "$_name" =~ "?" ]]; then
list+=("${_name%\?*}");
fi;
done;
for _name in "${list[@]}";
do
_checksum_md5="$( "$rvm_scripts_path/db" "$rvm_path/config/md5" "$_name" | head -n 1 )";
[[ -n "${_checksum_md5:-}" ]] || _checksum_md5="$( "$rvm_scripts_path/db" "$rvm_user_path/md5" "$_name" | head -n 1 )";
_checksum_sha512="$( "$rvm_scripts_path/db" "$rvm_path/config/sha512" "$_name" | head -n 1 )";
[[ -n "${_checksum_sha512:-}" ]] || _checksum_sha512="$( "$rvm_scripts_path/db" "$rvm_user_path/sha512" "$_name" | head -n 1 )";
__rvm_checksum_none || return 0;
done;
return 1
}
__rvm_checksum_validate_file ()
{
__rvm_checksum_any || return 1;
if [[ -n "${_checksum_md5:-}" ]]; then
[[ "$(__rvm_md5_calculate "${1:-}")" == "${_checksum_md5:-}" ]] || return 2;
fi;
if [[ -n "${_checksum_sha512:-}" ]]; then
[[ "$(__rvm_sha__calculate 512 "${1:-}")" == "${_checksum_sha512:-}" ]] || return 3;
fi;
return 0
}
__rvm_checksum_write ()
{
[[ -n "${1:-}" ]] || return 1;
__rvm_checksum_any || return 1;
[[ -z "${_checksum_md5:-}" ]] || "$rvm_scripts_path/db" "$rvm_user_path/md5" "${1:-}" "${_checksum_md5:-}";
[[ -z "${_checksum_sha512:-}" ]] || "$rvm_scripts_path/db" "$rvm_user_path/sha512" "${1:-}" "${_checksum_sha512:-}";
return 0
}
__rvm_clean_path ()
{
export PATH;
typeset IFS _iterator_path;
typeset -a _old_path _new_path;
IFS=:;
_old_path=();
__rvm_custom_separated_array _old_path : "${PATH}";
for _iterator_path in "${_old_path[@]}";
do
[[ ":${_new_path[*]}:" =~ :${_iterator_path}: ]] || _new_path+=("${_iterator_path}");
done;
PATH="${_new_path[*]}";
builtin hash -r
}
__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_configure_flags rvm_patch_names rvm_make_flags;
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_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_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_dump_environment_flag rvm_ruby_alias rvm_static_flag rvm_archive_extension rvm_hook rvm_ruby_name rvm_remote_flag;
__rvm_load_rvmrc
}
__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
}
__rvm_conditionally_add_bin_path ()
{
[[ ":${PATH}:" =~ ":${rvm_bin_path}:" ]] || {
case "${rvm_ruby_string:-"system"}" in
system)
PATH="$PATH:${rvm_bin_path}"
;;
*)
PATH="${rvm_bin_path}:$PATH"
;;
esac;
builtin hash -r
}
}
__rvm_conditionally_do_with_env ()
{
if (( __rvm_env_loaded > 0 )); then
"$@";
else
__rvm_do_with_env "$@";
fi
}
__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
}
__rvm_current_gemset ()
{
typeset current_gemset;
current_gemset="${GEM_HOME:-}";
current_gemset="${current_gemset##*${rvm_gemset_separator:-@}}";
if [[ "${current_gemset}" == "${GEM_HOME:-}" ]]; then
echo '';
else
echo "${current_gemset}";
fi
}
__rvm_custom_separated_array ()
{
typeset IFS;
IFS=$2;
if [[ -n "${ZSH_VERSION:-}" ]]; then
eval "$1+=( \${=3} )";
else
eval "$1+=( \$3 )";
fi
}
__rvm_db ()
{
typeset value key variable;
key=${1:-""};
key=${key#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
}
__rvm_default_flags ()
{
true ${rvm_head_flag:=0} ${rvm_delete_flag:=0}
}
__rvm_detect_system ()
{
unset _system_type _system_name _system_version _system_arch;
export _system_type _system_name _system_version _system_arch;
_system_type="unknown";
_system_name="unknown";
_system_version="unknown";
_system_arch="$(uname -m)";
case "$(uname)" in
Linux)
_system_type="linux";
if [[ -f /etc/lsb-release ]] && GREP_OPTIONS="" \grep "DISTRIB_ID=Ubuntu" /etc/lsb-release > /dev/null; then
_system_name="ubuntu";
_system_version="$(awk -F'=' '$1=="DISTRIB_RELEASE"{print $2}' /etc/lsb-release)";
else
if [[ -f /etc/os-release ]] && GREP_OPTIONS="" \grep "ID=opensuse" /etc/os-release > /dev/null; then
_system_name="opensuse";
_system_version="$(awk -F'=' '$1=="VERSION_ID"{gsub(/"/,"");print $2}' /etc/os-release)";
else
if [[ -f /etc/debian_version ]]; then
_system_name="debian";
_system_version="$(cat /etc/debian_version)";
else
if [[ -f /etc/centos-release ]]; then
_system_name="centos";
_system_version="$(grep -Eo '[[:digit:]\.]+' /etc/centos-release | awk -F. '{print $1"."$2}')";
else
if [[ -f /etc/redhat-release ]]; then
if grep CentOS /etc/redhat-release > /dev/null; then
_system_name="centos";
else
_system_name="redhat";
fi;
_system_version="$(grep -Eo '[[:digit:]\.]+' /etc/redhat-release | awk -F. '{print $1"."$2}')";
else
if [[ -f /etc/gentoo-release ]]; then
_system_name="gentoo";
_system_version="base-$(cat /etc/gentoo-release | awk 'NR==1 {print $NF}' | awk -F. '{print $1"."$2}')";
else
if [[ -f /etc/arch-release ]]; then
_system_name="arch";
_system_version="libc-$(ldd --version | awk 'NR==1 {print $NF}' | awk -F. '{print $1"."$2}')";
else
_system_version="libc-$(ldd --version | awk 'NR==1 {print $NF}' | awk -F. '{print $1"."$2}')";
fi;
fi;
fi;
fi;
fi;
fi;
fi
;;
SunOS)
_system_type="sunos";
_system_name="solaris";
_system_version="$(uname -v)";
if __rvm_string_match "${_system_version}" "joyent*"; then
_system_name="smartos";
_system_version="${_system_version#* }";
else
if __rvm_string_match "${_system_version}" "oi*"; then
_system_name="openindiana";
_system_version="${_system_version#* }";
fi;
fi
;;
OpenBSD)
_system_type="bsd";
_system_name="openbsd";
_system_version="$(uname -r)"
;;
Darwin)
_system_type="darwin";
_system_name="osx";
_system_version="$(sw_vers -productVersion)";
_system_version="${_system_version%.*}"
;;
*)
return 1
;;
esac;
_system_type="${_system_type//[ \/]/_}";
_system_name="${_system_name//[ \/]/_}";
_system_version="${_system_version//[ \/]/_}";
_system_arch="${_system_arch//[ \/]/_}";
_system_arch="${_system_arch/amd64/x86_64}";
_system_arch="${_system_arch/i[123456789]86/i386}"
}
__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_display_rvmrc ()
{
typeset _rvmrc_base _read_char_flag;
_rvmrc_base="$(basename "${_rvmrc}")";
[[ -n "${ZSH_VERSION:-}" ]] && _read_char_flag=k || _read_char_flag=n;
printf "
==============================================================================
= %-74s =
= 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. =
= =
= %-74s =
= 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 "
==============================================================================
= %-74s =
==============================================================================
= %-74s =
= %-74s =
= 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_do_with_env ()
{
typeset result;
__rvm_do_with_env_before;
"$@";
result=$?;
__rvm_do_with_env_after;
return ${result:-0}
}
__rvm_do_with_env_after ()
{
__rvm_teardown
}
__rvm_do_with_env_before ()
{
if [[ -n "${rvm_scripts_path:-}" || -n "${rvm_path:-}" ]]; then
source "${rvm_scripts_path:-"$rvm_path/scripts"}/initialize";
__rvm_setup;
fi
}
__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;
if (( ${rvm_create_default_wrappers:=0} == 1 )) || [[ ! -f "$rvm_wrappers_path/$environment_id/ruby" ]]; then
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
}
__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
}
__rvm_env_string ()
{
typeset _path _string;
_path="${GEM_HOME:-""}";
_string="${_path//*gems\//}";
_string="${_string//\/*/}";
printf "%b" "${_string:-system}\n"
}
__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_export ()
{
typeset name;
name=${1%%\=*};
builtin export rvm_old_$name=${!name};
export "$@";
return $?
}
__rvm_find_first_file ()
{
typeset _first_file _variable_first_file __file_enum;
_first_file="";
_variable_first_file="$1";
shift;
for __file_enum in "$@";
do
if [[ -f "$__file_enum" ]]; then
eval "$_variable_first_file=\"\$__file_enum\"";
return 0;
fi;
done;
eval "$_variable_first_file=\"\"";
return 1
}
__rvm_fix_group_permissions ()
{
if umask -S | grep 'g=rw' > /dev/null; then
chmod -R g+rwX "$@";
fi
}
__rvm_gemset_clear ()
{
export rvm_gemset_name;
rvm_gemset_name="";
__rvm_use
}
__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 ()
{
__rvm_gemset_select_only && __rvm_gemset_select_validation && __rvm_gemset_select_ensure
}
__rvm_gemset_select_cli ()
{
__rvm_gemset_select_cli_validation && __rvm_gemset_select
}
__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;
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";
else
if [[ -n "${GEM_HOME:-}" ]]; then
rvm_gemset_name="$GEM_HOME";
fi;
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_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
}
__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 [[ ! -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;
else
if (( ${rvm_delete_flag:=0} == 1 )); then
return 4;
fi;
fi
}
__rvm_gemset_use ()
{
if __rvm_gemset_select_cli; then
rvm_log "Using $rvm_ruby_string with gemset ${rvm_gemset_name:-default}";
__rvm_use;
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_gemsets_initial ()
{
if (( ${rvm_skip_gemsets_flag:-0} == 0 )); then
__rvm_run_with_env "gemsets.initial" "$rvm_ruby_string" "'$rvm_scripts_path/gemsets' initial" "$rvm_ruby_string - #importing default gemsets, this may take time ...";
else
mkdir -p "$rvm_gems_path/$rvm_ruby_string@global/bin";
rvm_log "Skipped importing default gemsets";
fi
}
__rvm_has_opt ()
{
{
[[ -n "${ZSH_VERSION}" ]] && setopt | grep "^${1}$" > /dev/null 2>&1
} || {
[[ -n "${BASH_VERSION}" ]] && [[ ":$SHELLOPTS:" =~ ":${1}:" ]]
} || return 1
}
__rvm_initialize ()
{
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
}
__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
}
__rvm_join_array ()
{
typeset IFS;
IFS="$2";
eval "$1=\"\${$3[*]}\""
}
__rvm_load_environment ()
{
typeset string;
string="$1";
if [[ -f "$rvm_environments_path/$string" ]]; then
__rvm_remove_rvm_from_path;
\. "$rvm_environments_path/$string";
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]; then
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use";
fi;
builtin hash -r;
else
if [[ -n "$string" ]]; then
rvm "$string";
else
:;
fi;
fi
}
__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;
rvm_action=use 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;
_gem_names="$(sed -n '/^ruby-gem-install=/ {s/ruby-gem-install=//;p;}' < "$1")";
for _gem in ${_gem_names//,/ };
do
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 ]]; then
__gemfile="$(dirname $1)/Gemfile";
else
if [[ -f "${_bundle_install}" ]]; then
__gemfile="${_bundle_install}";
else
if [[ "${rvm_autoinstall_bundler_flag:-0}" == 1 ]]; then
__gemfile="$(dirname $1)/Gemfile";
fi;
fi;
fi;
fi
;;
*/Gemfile)
__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}" ]] || {
rvm_ruby_string="$(sed -n "s/ rescue nil$//; /^\s*ruby/ {s/^\s*ruby//; s/[ ()'\"]//g; 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;
if [[ "${rvm_autoinstall_bundler_flag:-0}" == "1" ]]; then
__gemfile="$1";
gem list | GREP_OPTIONS="" \grep "^bundler " > /dev/null || gem install bundler;
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;
if [[ "${rvm_autoinstall_bundler_flag:-0}" == 1 && -f "$(dirname $1)/Gemfile" ]]; then
if ! gem list | GREP_OPTIONS="" \grep "^bundler " > /dev/null; then
gem install "bundler";
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_load_rvmrc ()
{
typeset _file;
typeset -a rvm_rvmrc_files;
if (( ${rvm_ignore_rvmrc:=0} == 1 )); then
return 0;
fi;
[[ -n "${rvm_stored_umask:-}" ]] || export rvm_stored_umask=$(umask);
rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc");
if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]; then
rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc");
fi;
for _file in "${rvm_rvmrc_files[@]}";
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
}
__rvm_log_command ()
{
typeset name message _log _command_start _command_name;
typeset -a _command;
name="${1:-}";
message="${2:-}";
[[ -z "$message" ]] || rvm_log "$message";
shift 2;
_command=("$@");
_command_start="$1";
while (( $# )) && [[ "$1" =~ "=" ]]; do
shift;
done;
_command_name="$1";
[[ ! "${_command_start}" =~ "=" ]] || _command=("env" "${_command[@]}");
(( ${rvm_niceness:-0} == 0 )) || _command=(nice -n $rvm_niceness "${_command[@]}");
_log="${rvm_log_path}${rvm_ruby_string:+/}${rvm_ruby_string:-}/$name.log";
[[ -d "${_log%\/*}" ]] || \mkdir -p "${_log%\/*}";
[[ -f "${_log}" ]] || \rm -f "${_log}";
{
printf "%b" "[$(date +'%Y-%m-%d %H:%M:%S')] ${_command_name}\n";
if is_a_function "${_command_name}"; then
typeset -f "${_command_name}";
fi;
printf "%b" "current path: $PWD\n";
printf "%b" "command(${#_command[@]}): ${_command[*]}\n"
} | tee "${_log}" | rvm_debug_stream;
"${_command[@]}" >> "${_log}" 2>&1 || {
typeset result=$?;
rvm_error "Error running '${_command[*]}', please read ${_log}";
return ${result}
}
}
__rvm_manage_wrapper ()
{
( action="${1:-}";
shift;
rubies_string="${1:-}";
args=($@);
source "$rvm_scripts_path"/manage )
}
__rvm_md5_calculate ()
{
typeset _sum;
if builtin command -v md5 > /dev/null 2>&1; then
_sum=$(md5 "$@");
echo ${_sum##* };
return 0;
else
if builtin command -v md5sum > /dev/null 2>&1; then
_sum=$(md5sum "$@");
echo ${_sum%% *};
return 0;
else
for _path in /usr/gnu/bin /sbin /bin /usr/bin /usr/sbin;
do
if [[ -x "${_path}/md5" ]]; then
_sum=$(${_path}/md5 "$@");
echo ${_sum##* };
return 0;
else
if [[ -x "${_path}/md5sum" ]]; then
_sum=$(${_path}/md5sum "$@");
echo ${_sum%% *};
return 0;
fi;
fi;
done;
fi;
fi;
rvm_error "Neither md5sum nor md5 found in the PATH";
return 1
}
__rvm_md5_for ()
{
if builtin command -v md5 > /dev/null; then
echo "$1" | md5;
else
if 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;
fi;
return 0
}
__rvm_md5_for_contents ()
{
if builtin command -v md5 > /dev/null; then
echo "$1" | cat - "$1" | md5;
else
if 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;
fi;
return 0
}
__rvm_meta ()
{
rvm_meta_author="Wayne E. Seguin";
rvm_meta_author_email="wayneeseguin@gmail.com";
rvm_meta_authors=("Wayne E. Seguin <wayneeseguin@gmail.com>" "Michal Papis <mpapis@gmail.com>");
rvm_meta_website="https://rvm.io/";
rvm_meta_version="${rvm_version}"
}
__rvm_nuke_rvm_variables ()
{
unset rvm_head_flag $(env | awk -F= '/^rvm_/{print $1" "}')
}
__rvm_package_create ()
{
rvm_debug __rvm_package_create:$#: "$@";
case "$1" in
*.tar.bz2)
if [[ -z "${3:-}" ]]; then
${rvm_tar_command:-tar} cjf "$1" "$2";
else
${rvm_tar_command:-tar} cjf "$1" -C "$2" "$3";
fi
;;
*.tar.gz | *.tgz)
if [[ -z "${3:-}" ]]; then
${rvm_tar_command:-tar} czf "$1" "$2";
else
${rvm_tar_command:-tar} czf "$1" -C "$2" "$3";
fi
;;
*)
return 199
;;
esac
}
__rvm_package_extract ()
{
rvm_debug __rvm_package_extract:$#: "$@";
[[ -d "$2" ]] || mkdir -p "$2";
case "$1" in
*.zip)
unzip -q -o "$1" -d "$2"
;;
*.tar.bz2)
${rvm_tar_command:-tar} xjf "$1" -C "$2" ${rvm_tar_options:-}
;;
*.tar.gz | *.tgz)
${rvm_tar_command:-tar} xzf "$1" -C "$2" ${rvm_tar_options:-}
;;
*)
return 199
;;
esac
}
__rvm_package_list ()
{
rvm_debug __rvm_package_list:$#: "$@";
case "$1" in
*.zip)
unzip -Z -1 "$1"
;;
*.tar.bz2)
${rvm_tar_command:-tar} tjf "$1"
;;
*.tar.gz | *.tgz)
${rvm_tar_command:-tar} tzf "$1"
;;
*)
return 199
;;
esac
}
__rvm_pager_or_cat_v ()
{
eval "${PAGER:-cat -v} '$1'"
}
__rvm_parse_args ()
{
typeset _string;
export rvm_ruby_string;
rvm_action="${rvm_action:-""}";
rvm_parse_break=0;
if [[ " $* " =~ " --trace " ]]; then
echo "$@";
__rvm_version;
fi;
while [[ -n "$next_token" ]]; do
rvm_token="$next_token";
if (( $# > 0 )); then
next_token="$1";
shift;
else
next_token="";
fi;
case "$rvm_token" in
[[:alnum:]]* | @*)
case "$rvm_token" in
use)
rvm_action="$rvm_token";
rvm_verbose_flag=1;
if [[ "ruby" == "$next_token" ]]; then
next_token="${1:-}";
(( $# == 0 )) || shift;
fi
;;
install | uninstall | reinstall | try_install)
export ${rvm_token}_flag=1;
rvm_action=$rvm_token
;;
gemset)
rvm_action=$rvm_token;
rvm_ruby_gem_home="${GEM_HOME:-""}";
rvm_ruby_args=();
__rvm_parse_args_find_known_flags rvm_ruby_args "$next_token" "$@";
: rvm_ruby_args:${#rvm_ruby_args[@]}:${rvm_ruby_args[*]}:;
next_token="${rvm_ruby_args[__array_start]}";
rvm_gemset_name="${rvm_ruby_args[__array_start+1]}";
case "${next_token:-help}" in
help)
true
;;
clear)
__rvm_gemset_clear
;;
use | delete)
[[ "delete" != "$next_token" ]] || rvm_delete_flag=1;
[[ "use" != "$next_token" ]] || rvm_use_flag=1;
case "$rvm_gemset_name" in
*${rvm_gemset_separator:-"@"}*)
rvm_ruby_string="${rvm_gemset_name%%${rvm_gemset_separator:-"@"}*}";
rvm_gemset_name="${rvm_gemset_name##*${rvm_gemset_separator:-"@"}}";
if [[ "${rvm_ruby_string:-""}" != "${rvm_gemset_name:-""}" ]]; then
rvm_ruby_string="$rvm_ruby_string${rvm_gemset_separator:-"@"}$rvm_gemset_name";
fi;
rvm_ruby_gem_home="$rvm_ruby_gem_home${rvm_gemset_separator:-"@"}$rvm_gemset_name"
;;
"")
rvm_error "Gemset was not given.\n Usage:\n rvm gemset $rvm_gemset_name <gemsetname>\n";
return 1
;;
esac
;;
esac;
rvm_parse_break=1
;;
gemdir | gempath | gemhome)
rvm_ruby_args=("$rvm_token");
rvm_action="gemset";
rvm_gemdir_flag=1;
if [[ "system" == "$next_token" ]]; then
rvm_system_flag=1;
next_token="${1:-}";
(( $# == 0 )) || shift;
fi;
if [[ "user" == "$next_token" ]]; then
rvm_user_flag=1;
next_token="${1:-}";
(( $# == 0 )) || shift;
fi
;;
pkg)
rvm_action="$rvm_token";
__rvm_parse_args_find_known_flags rvm_ruby_args "$next_token" "$@";
rvm_parse_break=1
;;
do | exec)
if [[ -z "$next_token" ]]; then
rvm_action="error";
rvm_error_message="'rvm $rvm_token' must be followed by arguments.";
break;
fi;
rvm_action="do";
rvm_ruby_args=("$next_token" "$@");
rvm_parse_break=1
;;
gem | rake | ruby)
if [[ "$rvm_token" == "ruby" ]] && [[ "$rvm_action" == "install" || "$rvm_action" == "use" ]]; then
rvm_ruby_string=ruby;
rvm_ruby_strings=ruby;
continue;
fi;
rvm_action=error;
rvm_error_message="Please note that \`rvm $rvm_token ...\` was removed, try \`$rvm_token $next_token $*\` or \`rvm all do $rvm_token $next_token $*\` instead."
;;
fetch | version | srcdir | reset | debug | reload | update | monitor | notes | implode | seppuku | question | answer | env | unexport | automount | prepare)
rvm_action=$rvm_token
;;
doctor)
rvm_action=notes
;;
mount)
rvm_action=$rvm_token;
while [[ -n "${next_token:-}" ]] && [[ -x "${next_token:-}" || -d "${next_token:-}" || "${next_token:-}" =~ ^http || "${next_token:-}" =~ tar.bz2$ ]]; do
rvm_ruby_args=("$next_token" "${rvm_ruby_args[@]}");
next_token="${1:-}";
(( $# == 0 )) || shift;
done
;;
rm | remove)
rvm_action="remove";
rvm_remove_flag=1
;;
rtfm | RTFM | rvmrc | usage | help | inspect | list | ls | info | strings | get | current | docs | alias | rubygems | cleanup | tools | disk-usage | snapshot | repair | migrate | upgrade | cron | group | switch | which | config-get | requirements)
case "$rvm_token" in
ls)
rvm_action="list"
;;
usage)
rvm_action="help"
;;
RTFM)
rvm_action="rtfm"
;;
*)
rvm_action="$rvm_token"
;;
esac;
rvm_ruby_args=();
__rvm_parse_args_find_known_flags rvm_ruby_args "$next_token" "$@";
rvm_parse_break=1
;;
user)
rvm_action="tools";
rvm_ruby_args=("$rvm_token" "$next_token" "$@");
rvm_parse_break=1
;;
load-rvmrc)
rvm_action="rvmrc";
rvm_ruby_args=("load" "$next_token" "$@");
rvm_parse_break=1
;;
benchmark | bench)
rvm_action="benchmark"
;;
specs | tests)
rvm_action="rake";
rvm_ruby_args=("${rvm_token/%ss/s}")
;;
export)
if [[ -n "$next_token" ]]; then
rvm_export_args="$next_token$@";
rvm_action="export";
rvm_parse_break=1;
else
rvm_action="error";
rvm_error_message="rvm export must be followed by a NAME=VALUE argument";
fi
;;
alt*)
rvm_action="help";
rvm_ruby_args=("alt.md");
rvm_parse_break=1
;;
wrapper)
rvm_action="wrapper";
rvm_ruby_string="$next_token";
rvm_wrapper_name="$1";
(( $# == 0 )) || shift;
rvm_ruby_args=("$@");
rvm_parse_break=1
;;
reboot | damnit | wtf | argh | BOOM | boom | wth)
rvm_action="reboot"
;;
in)
rvm_token="${next_token}";
next_token="${1:-}";
(( $# == 0 )) || shift;
if __rvm_project_dir_check "$rvm_token"; then
export rvm_in_flag="$rvm_token";
__rvm_rvmrc_tools try_to_read_ruby $rvm_token;
else
export "rvm_in_flag"=1;
fi
;;
*,*)
rvm_ruby_strings="$rvm_token";
[[ -n "${rvm_action:-""}" ]] || rvm_action="ruby"
;;
${rvm_gemset_separator:-"@"}*)
rvm_action="${rvm_action:-use}";
rvm_gemset_name="${rvm_token/*${rvm_gemset_separator:-"@"}/}";
rvm_ruby_string="${rvm_ruby_string:-""}";
rvm_ruby_strings="${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
;;
*${rvm_gemset_separator:-"@"}*)
rvm_action="${rvm_action:-use}";
rvm_gemset_name="${rvm_token/*${rvm_gemset_separator:-"@"}/}";
rvm_ruby_string="$rvm_token";
rvm_ruby_strings="$rvm_token"
;;
*+*)
rvm_action="${rvm_action:-use}";
rvm_ruby_alias="${rvm_token/*+/}";
rvm_ruby_string="${rvm_token/+*/}";
rvm_ruby_strings="$rvm_ruby_string"
;;
*-* | +([[:digit:]]).+([[:digit:]])*)
rvm_action="${rvm_action:-use}";
rvm_ruby_string="$rvm_token";
rvm_ruby_strings="$rvm_token"
;;
opal* | jruby* | ree* | kiji* | macruby* | rbx* | rubinius* | goruby | mruby | ironruby* | default* | maglev* | tcs* | jamesgolick* | ruby* | system | default | all)
rvm_action="${rvm_action:-use}";
case "$rvm_token" in
rubinius)
rvm_token="rbx"
;;
esac;
rvm_ruby_interpreter="$rvm_token";
rvm_ruby_string="$rvm_token";
rvm_ruby_strings="$rvm_token"
;;
old)
case "${rvm_action:-action-missing}" in
remove)
rvm_ruby_strings="old:${next_token:-}";
next_token="${1:-}";
(( $# == 0 )) || shift
;;
action-missing)
rvm_error_message="what do you want to do with old rubies? rvm can only remove old rubies.";
rvm_action="error"
;;
*)
rvm_error_message="rvm can not $rvm_action old rubies, rvm can only remove old rubies.";
rvm_action="error"
;;
esac
;;
*.rb)
rvm_ruby_args=("$rvm_token");
rvm_ruby_file="$rvm_token";
if [[ -z "${rvm_action:-""}" || "$rvm_action" == "use" ]]; then
rvm_action="ruby";
fi
;;
*.gems)
rvm_file_name="${rvm_token}"
;;
"")
rvm_action="error";
rvm_error_message="Unrecognized command line argument(s): '$@'"
;;
*)
if [[ "gemset" == "$rvm_action" ]]; then
rvm_gemset_name="${rvm_token/.gems/}";
rvm_file_name="$rvm_gemset_name.gems";
else
if [[ -f "$rvm_rubies_path/$rvm_token" || -L "$rvm_rubies_path/$rvm_token" ]]; then
rvm_ruby_string=$rvm_token;
rvm_ruby_strings="$rvm_token";
rvm_action="${rvm_action:-use}";
else
if __rvm_project_dir_check "$rvm_token"; then
__rvm_rvmrc_tools try_to_read_ruby $rvm_token;
else
rvm_action="error";
rvm_error_message="Unrecognized command line argument: '$rvm_token'";
fi;
fi;
fi
;;
esac
;;
-*)
case "$rvm_token" in
-S)
rvm_action="ruby";
rvm_ruby_args=("$rvm_token" "$next_token" "$@");
rvm_parse_break=1
;;
-e)
rvm_action="ruby";
IFS="\n";
rvm_ruby_args=("$rvm_token" "'$next_token $@'");
IFS=" ";
rvm_parse_break=1
;;
-v | --version)
if [[ -z "$next_token" ]]; then
rvm_action="version";
else
rvm_ruby_version="$next_token";
next_token="${1:-}";
(( $# == 0 )) || shift;
fi
;;
-n | --name)
rvm_ruby_name="$next_token";
next_token="${1:-}";
(( $# == 0 )) || shift
;;
--branch)
rvm_ruby_repo_branch="$next_token";
next_token="${1:-}";
(( $# == 0 )) || shift;
rvm_disable_binary_flag=1
;;
--repository | --repo | --url)
rvm_ruby_repo_url="$next_token";
next_token="${1:-}";
(( $# == 0 )) || shift;
rvm_disable_binary_flag=1
;;
-r | --remote | --binary | --latest-binary)
rvm_remote_flag=1;
if [[ "$rvm_token" == "--latest-binary" ]]; then
rvm_latest_binary_flag=1;
fi;
while [[ -n "${next_token:-}" ]] && [[ "${next_token:-}" =~ ^http || "${next_token:-}" =~ tar.bz2$ || "${next_token:-}" =~ ":" ]]; do
rvm_ruby_args=("$next_token" "${rvm_ruby_args[@]}");
next_token="${1:-}";
(( $# == 0 )) || shift;
done
;;
--ree-options)
if [[ -n "$next_token" ]]; then
__rvm_custom_separated_array rvm_ree_options , "${next_token}";
next_token="${1:-}";
(( $# == 0 )) || shift;
else
rvm_action="error";
rvm_error_message="--ree-options *must* be followed by... well... comma,separated,list,of,options.";
fi
;;
--patches | --patch)
export -a rvm_patch_names;
__rvm_custom_separated_array rvm_patch_names , "$next_token";
next_token="${1:-}";
(( $# == 0 )) || shift;
rvm_patch_original_pwd="$PWD";
rvm_disable_binary_flag=1
;;
--arch | --archflags)
rvm_architectures="${rvm_architectures:-},${next_token#-arch }";
rvm_architectures="${rvm_architectures##,}";
next_token="${1:-}";
(( $# == 0 )) || shift;
rvm_disable_binary_flag=1
;;
--with-arch=*)
rvm_architectures="${rvm_architectures:-},${rvm_token#--with-arch=}";
rvm_architectures="${rvm_architectures##,}";
rvm_disable_binary_flag=1
;;
--32)
rvm_architectures="${rvm_architectures:-},i386";
rvm_architectures="${rvm_architectures##,}";
rvm_disable_binary_flag=1
;;
--64)
rvm_architectures="${rvm_architectures:-},x86_64";
rvm_architectures="${rvm_architectures##,}";
rvm_disable_binary_flag=1
;;
--universal)
rvm_architectures="${rvm_architectures:-},i386,x86_64";
rvm_architectures="${rvm_architectures##,}";
rvm_disable_binary_flag=1
;;
--bin)
if [[ "update" == "${rvm_action:-""}" ]]; then
rvm_bin_flag=1;
else
rvm_bin_path="$next_token";
next_token="${1:-}";
(( $# == 0 )) || shift;
fi
;;
--rdoc | --yard)
rvm_docs_type="$rvm_token";
rvm_docs_type
;;
-f | --file)
rvm_action="ruby";
rvm_ruby_file="$next_token";
next_token="${1:-}";
(( $# == 0 )) || shift
;;
--passenger)
rvm_log "NOTE: If you are using Passenger 3 you no longer need the passenger_ruby,\nuse the wrapper script for your ruby instead (see 'rvm wrapper')";
rvm_wrapper_name="${rvm_token/--/}"
;;
--editor)
rvm_wrapper_name="${rvm_token/--/}"
;;
--symlink)
rvm_warn "--symlink has been removed, please see 'rvm wrapper'.";
next_token="${1:-}";
(( $# == 0 )) || shift
;;
-h | --help)
rvm_action=help
;;
-l | --level)
rvm_ruby_patch_level="p$next_token";
next_token="${1:-}";
(( $# == 0 )) || shift
;;
--sha | --make | --make-install)
rvm_token=${rvm_token#--};
rvm_token=${rvm_token//-/_};
export "rvm_ruby_${rvm_token}"="$next_token";
next_token="${1:-}";
rvm_disable_binary_flag=1;
(( $# == 0 )) || shift
;;
--nice | --sdk | --autoconf-flags | --proxy)
rvm_token=${rvm_token#--};
rvm_token=${rvm_token//-/_};
export "rvm_${rvm_token}"="$next_token";
next_token="${1:-}";
(( $# == 0 )) || shift
;;
--disable-llvm | --disable-jit)
rvm_llvm_flag=0
;;
--enable-llvm | --enable-jit)
rvm_llvm_flag=1
;;
--install)
rvm_install_on_use_flag=1
;;
--color=*)
rvm_pretty_print_flag=${rvm_token#--color=}
;;
--pretty)
rvm_pretty_print_flag=auto
;;
--1.8 | --1.9 | --18 | --19)
rvm_token=${rvm_token#--};
rvm_token=${rvm_token//\./};
export "rvm_${rvm_token}_flag"=1;
rvm_disable_binary_flag=1
;;
--rvmrc | --versions-conf | --ruby-version)
rvm_token=${rvm_token#--};
rvm_token=${rvm_token//-/_};
export rvm_rvmrc_flag="${rvm_token}"
;;
--head | --static)
rvm_token=${rvm_token#--};
rvm_token=${rvm_token//-/_};
export "rvm_${rvm_token}_flag"=1
;;
--self | --gem | --rubygems | --reconfigure | --default | --force | --export | --summary | --latest | --yaml | --json | --archive | --shebang | --env | --path | --cron | --tail | --delete | --verbose | --import | --sticky | --create | --gems | --docs | --skip-autoreconf | --force-autoconf | --auto | --autoinstall-bundler | --disable-binary | --ignore-gemsets | --skip-gemsets | --debug | --quiet | --silent | --skip-openssl | --fuzzy)
rvm_token=${rvm_token#--};
rvm_token=${rvm_token//-/_};
export "rvm_${rvm_token}_flag"=1
;;
--dump-environment | --verify-downloads)
rvm_token=${rvm_token#--};
rvm_token=${rvm_token//-/_};
export "rvm_${rvm_token}_flag"="$next_token";
next_token="${1:-}";
(( $# == 0 )) || shift
;;
--clang)
rvm_configure_flags+=(--with-gcc=clang)
;;
-M)
if [[ -n "$next_token" ]]; then
__rvm_custom_separated_array rvm_make_flags , "${next_token}";
next_token="${1:-}";
(( $# == 0 )) || shift;
rvm_disable_binary_flag=1;
else
rvm_action="error";
rvm_error_message="--make *must* be followed by make flags.";
fi
;;
-j)
if [[ -n "$next_token" ]]; then
rvm_make_flags+=(-j$next_token);
next_token="${1:-}";
(( $# == 0 )) || shift;
else
rvm_action="error";
rvm_error_message="-j *must* be followed by an integer (normally the # of CPU's in your machine).";
fi
;;
--with-rubies)
rvm_ruby_strings="$next_token";
next_token="${1:-}";
(( $# == 0 )) || shift
;;
-C | --configure)
if [[ -n "$next_token" ]]; then
__rvm_custom_separated_array rvm_configure_flags , "${next_token}";
next_token="${1:-}";
(( $# == 0 )) || shift;
rvm_disable_binary_flag=1;
else
rvm_action="error";
rvm_error_message="--configure *must* be followed by configure flags.";
fi
;;
--movable)
rvm_make_flags+=(-j3);
rvm_configure_flags+=(--enable-shared --enable-load-relative --sysconfdir=/etc);
rvm_disable_binary_flag=1
;;
--with-* | --without-* | --enable-* | --disable-*)
rvm_configure_flags+=("$rvm_token");
rvm_disable_binary_flag=1
;;
--trace)
export rvm_trace_flag=1;
set -o xtrace;
[[ -n "${ZSH_VERSION:-""}" ]] || {
set -o errtrace;
export PS4="+ \$(date \"+%s.%N\") \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
}
;;
--)
if [[ "${rvm_action}" == *install ]]; then
rvm_configure_flags+=("$next_token" "$@");
else
rvm_ruby_args=("$next_token" "$@");
fi;
rvm_disable_binary_flag=1;
rvm_parse_break=1
;;
*)
rvm_action="error";
rvm_error_message="Unrecognized command line flag: '$rvm_token'"
;;
esac
;;
*)
if __rvm_project_dir_check "$rvm_token"; then
__rvm_rvmrc_tools try_to_read_ruby "$rvm_token";
else
rvm_action="error";
rvm_error_message="Unrecognized command line argument(s): '$rvm_token $@'";
fi
;;
esac;
if [[ -z "${rvm_action:-""}" && -n "${rvm_ruby_string:-""}" ]]; then
rvm_action="use";
fi;
if [[ "error" == "${rvm_action:-""}" || ${rvm_parse_break:-0} -eq 1 || -n "${rvm_error_message:-""}" ]]; then
break;
fi;
done;
: rvm_ruby_args:${#rvm_ruby_args[@]}:${rvm_ruby_args[*]}:;
if [[ -n "${rvm_error_message:-""}" ]]; then
rvm_error "$rvm_error_message ( see: 'rvm usage' )";
return 1;
fi
}
__rvm_parse_args_find_known_flags ()
{
typeset _args_array_name _temp_var;
typeset -a _new_args;
_args_array_name="$1";
(( $# == 0 )) || shift;
_new_args=();
while (( $# )); do
case "$1" in
--verify-downloads)
export "rvm_verify_downloads_flag"="${2:-}";
shift
;;
--force | --verbose | --debug | --quiet | --silent | --create)
export "rvm_${1#--}_flag=1"
;;
--clang-ok)
export rvm_force_clang_ok=1
;;
--only-path)
_temp_var="${1#--}";
export "rvm_${_temp_var//-/_}_flag=1"
;;
--32)
rvm_architectures="${rvm_architectures:-},i386";
rvm_architectures="${rvm_architectures##,}";
rvm_disable_binary_flag=1
;;
--64)
rvm_architectures="${rvm_architectures:-},x86_64";
rvm_architectures="${rvm_architectures##,}";
rvm_disable_binary_flag=1
;;
--universal)
rvm_architectures="${rvm_architectures:-},i386,x86_64";
rvm_architectures="${rvm_architectures##,}";
rvm_disable_binary_flag=1
;;
--)
shift;
_new_args+=("$@");
shift $#
;;
*)
_new_args+=("$1")
;;
esac;
(( $# == 0 )) || shift;
done;
eval "${_args_array_name}+=( \"\${_new_args[@]}\" )"
}
__rvm_project_dir_check ()
{
typeset _found_file path_to_check variable variable_default;
typeset -a _valid_files;
path_to_check="$1";
variable="${2:-}";
variable_default="${3:-}";
_valid_files=("$path_to_check" "$path_to_check/.rvmrc" "$path_to_check/.versions.conf" "$path_to_check/.ruby-version" "$path_to_check/.rbfu-version" "$path_to_check/.rbenv-version" "$path_to_check/Gemfile");
__rvm_find_first_file _found_file "${_valid_files[@]}" || true;
if [[ "${_found_file##*/}" == "Gemfile" ]]; then
[[ -s "$_found_file" ]] && {
GREP_OPTIONS="" \grep "^#ruby=" "$_found_file" > /dev/null || GREP_OPTIONS="" \grep "^\s*ruby" "$_found_file" > /dev/null
} || _found_file="";
fi;
if [[ -n "$variable" ]]; then
eval "$variable=\"\${_found_file:-$variable_default}\"";
fi;
[[ -n "${_found_file:-$variable_default}" ]] || return $?
}
__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;
fi;
typeset working_dir found_file rvm_trustworthiness_result;
working_dir="${1:-"$PWD"}";
while :; do
if [[ -z "$working_dir" || "$HOME" == "$working_dir" || "${rvm_prefix:-}" == "$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";
else
if [[ -n "${rvm_previous_environment:-""}" ]]; then
__rvm_load_environment "$rvm_previous_environment";
fi;
fi;
unset rvm_current_rvmrc rvm_previous_environment;
fi;
break;
else
if __rvm_project_dir_check "$working_dir" found_file; then
if [[ "${rvm_current_rvmrc:-""}" != "${found_file}" ]]; then
__rvm_conditionally_do_with_env __rvm_load_project_config "${found_file}" || {
rvm_trustworthiness_result=$?;
unset __rvm_project_rvmrc_lock;
return "$rvm_trustworthiness_result"
};
fi;
break;
else
working_dir="$(dirname "$working_dir")";
fi;
fi;
done;
unset __rvm_project_rvmrc_lock;
return $?
}
__rvm_read_lines ()
{
typeset IFS;
IFS="
";
if [[ "${2:--}" == "-" ]]; then
eval "$1=( \$( cat - ) )";
else
eval "$1=( \$( cat \"\${2:--}\" ) )";
fi
}
__rvm_reboot ()
{
rvm_warn "Do you wish to reboot rvm?\n('yes', or 'no')> ";
typeset response;
response="no";
read response;
if [[ "yes" == "$response" ]]; then
__rvm_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
}
__rvm_record_install ()
{
[[ -n "$1" ]] || return;
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";
[[ -f "$rvm_install_record_file" ]] || \touch "$rvm_install_record_file";
__rvm_sed_i "$rvm_install_record_file" -e "/^$recorded_ruby_name/d";
printf "%b" "$recorded_ruby_name -- ${rvm_configure_flags[*]}\n" >> "$rvm_install_record_file"
}
__rvm_recorded_install_command ()
{
typeset recorded_ruby_name;
recorded_ruby_name="$( "$rvm_scripts_path/tools" strings "$1" )";
recorded_ruby_name=${recorded_ruby_name%%${rvm_gemset_seperator:-"@"}*};
[[ -n "$recorded_ruby_name" ]] || return 1;
if [[ -s "$rvm_user_path/installs" ]] && GREP_OPTIONS="" \grep "^$recorded_ruby_name " "$rvm_user_path/installs" > /dev/null 2>&1; then
GREP_OPTIONS="" \grep "^$recorded_ruby_name " "$rvm_user_path/installs" | head -n 1;
else
return 1;
fi
}
__rvm_remote_extension ()
{
case "$1" in
*.tar.*)
rvm_remote_extension="tar${1##*tar}"
;;
jruby-*)
rvm_remote_extension="tar.gz"
;;
*)
rvm_remote_extension="tar.bz2"
;;
esac;
[[ "$2" != "-" ]] || printf "%b" "${rvm_remote_extension}"
}
__rvm_remote_server_path ()
{
typeset _iterator;
_iterator="";
while ! __rvm_remote_server_path_single 0 1 "${_iterator}" "${1:-}"; do
: $(( _iterator+=1 ));
done
}
__rvm_remote_server_path_single ()
{
typeset __remote_file;
__rvm_calculate_remote_file "$@" || return $?;
if [[ -z "${__remote_file:-}" ]]; then
rvm_debug "No remote file name found";
return $1;
else
if file_exists_at_url "${__remote_file}"; then
rvm_debug "Found remote file ${__remote_file}";
printf "%b" "${__remote_file}";
else
rvm_debug "Remote file does not exist ${__remote_file}";
return $2;
fi;
fi
}
__rvm_remove_from_array ()
{
typeset _array_name _search _iterator;
typeset -a _temp_array;
_array_name="$1";
_search="$2";
shift 2;
_temp_array=();
for _iterator in "$@";
do
__rvm_string_match "$_iterator" "$_search" || _temp_array+=("$_iterator");
done;
eval "$_array_name=( \"\${_temp_array[@]}\" )"
}
__rvm_remove_from_path ()
{
export PATH;
typeset _value;
_value="${1//+(\/)//}";
if [[ "$PATH" =~ "//" ]]; then
if [[ `uname -s` = "Darwin" ]]; then
PATH="$(sed -E 's#/+#/#g' <<<$PATH)";
else
PATH="$(sed -r 's#/+#/#g' <<<$PATH)";
fi;
fi;
case ":$PATH:" in
*:${_value}:*)
typeset -a _path;
_path=();
__rvm_custom_separated_array _path : "${PATH}";
__rvm_remove_from_array _path "${_value}" "${_path[@]}";
__rvm_join_array PATH : _path
;;
esac
}
__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
__rvm_sed_i "$rvm_install_record_file" -e "/^$recorded_ruby_name/d";
fi
}
__rvm_remove_rvm_from_path ()
{
typeset local_rvm_path;
__rvm_remove_from_path "${rvm_path%/}/*";
__rvm_remove_from_path "${rvm_bin_path}";
while local_rvm_path="$( __rvm_which rvm 2>/dev/null )"; do
__rvm_remove_from_path "${local_rvm_path%/*}";
done;
builtin hash -r
}
__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_rm_rf ()
{
__rvm_rm_rf_verbose "$@"
}
__rvm_rm_rf_verbose ()
{
typeset result target;
result=1;
target="${1%%+(/|.)}";
if [[ -n "${ZSH_VERSION:-}" ]]; then
setopt extendedglob;
else
if [[ -n "${BASH_VERSION:-}" ]]; then
shopt -s extglob;
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
\rm -rf "${target}";
result=0;
else
if [[ -f "${target}" || -L "${target}" ]]; then
\rm -f "${target}";
result=0;
else
result=0;
fi;
fi;
fi
;;
esac;
return $result
}
__rvm_ruby_config_get ()
{
typeset variable_name ruby_path;
variable_name="$1";
ruby_path="${2:-$rvm_ruby_home/bin/ruby}";
case "${variable_name:---all}" in
--all)
"$ruby_path" -rrbconfig -e 'puts RbConfig::CONFIG.sort.map{|k,v| "#{k}: #{v}" }' 2> /dev/null
;;
*)
"$ruby_path" -rrbconfig -e 'puts RbConfig::CONFIG["'"$variable_name"'"]' 2> /dev/null
;;
esac
}
__rvm_ruby_config_save ()
{
typeset ruby_path config_path default_config_path;
ruby_path="${1:-$rvm_ruby_home/bin/ruby}";
default_config_path="#{RbConfig::CONFIG[\"prefix\"]}/config";
config_path="${2:-$default_config_path}";
"$ruby_path" -rrbconfig -e '\
File.open("'"$config_path"'","w") { |file|
RbConfig::CONFIG.sort.each{|key,value|
file.write("#{key.gsub(/\.|-/,"_")}=\"#{value.gsub("$","\\$")}\"\n")
}
}
' > /dev/null 2>&1
}
__rvm_ruby_package_file ()
{
case "$1" in
*.tar.*)
rvm_ruby_package_file="/$1"
;;
jruby-*)
typeset __version;
__version="$(
rvm_ruby_string="$1"
__rvm_ruby_string
echo "$rvm_ruby_version"
)";
rvm_ruby_package_file="/${__version}/jruby-bin-${__version}.$(__rvm_remote_extension "$1" -)"
;;
"")
rvm_ruby_package_file=""
;;
*)
rvm_ruby_package_file="/$1.$(__rvm_remote_extension "$1" -)"
;;
esac
}
__rvm_ruby_string ()
{
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;
if (( rvm_expanding_aliases == 0 )) && [[ -n "${rvm_ruby_string}" && "$rvm_ruby_string" != "system" ]]; then
if [[ -f "$rvm_path/config/alias" && -s "$rvm_path/config/alias" ]] && expanded_alias_name="$("$rvm_scripts_path"/db "$rvm_path/config/alias" "$rvm_ruby_string")" && [[ -n "$expanded_alias_name" ]]; then
rvm_ruby_string="$expanded_alias_name";
else
if [[ "$rvm_ruby_string" == default ]]; then
rvm_ruby_string="system";
fi;
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;
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;
fi;
strings=();
__rvm_custom_separated_array strings - "${ruby_string}";
if (( ${#strings[@]} == 0 )); then
if echo "${GEM_HOME:-}" | GREP_OPTIONS="" \grep "${rvm_gems_path}" > /dev/null 2>&1; then
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 | weekly)
if [[ "${rvm_ruby_interpreter}" == "rbx" ]]; then
rvm_ruby_patch_level="$string";
else
rvm_ruby_version="$string";
fi;
rvm_nightly_flag=1
;;
nightly* | weekly*)
rvm_ruby_patch_level="$string"
;;
preview*)
rvm_ruby_patch_level="$string"
;;
rc[[:digit:]]*)
rvm_ruby_patch_level="$string"
;;
[[:digit:]].[[:digit:]]*)
if [[ "${rvm_ruby_interpreter}" == "rbx" ]]; then
if [[ -z "${rvm_ruby_version}" ]]; then
rvm_ruby_version="${string}";
else
if [[ -z "${rvm_ruby_patch_level}" ]]; then
rvm_ruby_patch_level="${string}";
else
rvm_error "Unknown ruby interpreter string component: '$string'.";
return 1;
fi;
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"
;;
b[[:digit:]]*)
rvm_ruby_repo_branch="${string}";
rvm_head_flag=1
;;
opal | ruby | rbx | jruby | macruby | ree | kiji | rubinius | maglev | ironruby | goruby | mruby | tcs | jamesgolick)
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
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.0.0*)
rvm_ruby_interpreter="ruby"
;;
2.*)
rvm_error "Version '$rvm_ruby_version' is ambiguous. Cannot select Ruby implementation/version, please be more specific.";
return 2
;;
esac;
fi;
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;
else
if (( ${rvm_head_flag:=0} == 1 )); then
rvm_ruby_string="${rvm_ruby_string}-head";
else
if [[ -n "${rvm_ruby_revision:-}" ]]; then
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_revision}";
else
if [[ -n "${rvm_ruby_sha:-}" ]]; then
rvm_ruby_string="${rvm_ruby_string}-s${rvm_ruby_sha}";
else
if [[ -n "${rvm_ruby_tag:-}" ]]; then
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_tag}";
else
if [[ -n "${rvm_ruby_patch_level:-}" ]]; then
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}";
else
if [[ -n "${rvm_ruby_user_tag:-}" ]]; then
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_user_tag}";
else
if (( ${rvm_fuzzy_flag:-0} == 1 )) && [[ "${rvm_ruby_interpreter}" == "ruby" || "${rvm_ruby_interpreter}" == "ree" ]]; then
rvm_ruby_patch_level="$(
"${rvm_scripts_path:-$rvm_path/scripts}/list" strings |
grep "${rvm_ruby_interpreter}-${rvm_ruby_version}-" |
awk -F- '{print $3}' | sort | tail -n 1
)";
fi;
if (( ${rvm_latest_binary_flag:-0} == 1 )) && [[ "${rvm_ruby_interpreter}" == "ruby" || "${rvm_ruby_interpreter}" == "ree" ]]; then
rvm_ruby_patch_level="$(
__list_remote_rubies_for $( __rvm_system_path_for rubies ) |
awk -F/ '{x=$NF; gsub(".tar.*","",x); print x}' |
grep "${rvm_ruby_interpreter}-${rvm_ruby_version}-" |
awk -F- '{print $3}' | sort | tail -n 1
)";
fi;
[[ -n "${rvm_ruby_patch_level:-""}" ]] || rvm_ruby_patch_level="$(
__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level"
)";
if [[ -n "${rvm_ruby_patch_level:-""}" ]]; then
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}";
fi;
fi;
fi;
fi;
fi;
fi;
fi;
fi;
if [[ -n "${rvm_ruby_name:-}" ]]; then
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_name}";
detected_rvm_ruby_name="${rvm_ruby_name}";
rvm_ruby_name="";
else
detected_rvm_ruby_name="";
fi
}
__rvm_ruby_string_paths_under ()
{
typeset __search_path part parts;
__search_path="${1%/}";
if [[ -n "${ZSH_VERSION:-}" ]]; then
parts=(${=rvm_ruby_string//-/ });
else
parts=(${rvm_ruby_string//-/ });
fi;
echo "$__search_path";
for part in "${parts[@]}";
do
__search_path="$__search_path/$part";
echo "$__search_path";
done
}
__rvm_ruby_strings_exist ()
{
for rvm_ruby_string in ${@//,/ };
do
rvm_gemset_name="";
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
}
__rvm_rubygems_create_link ()
{
typeset ruby_lib_gem_path;
rubygems_detect_ruby_lib_gem_path "${1:-ruby}";
\mkdir -p "$(dirname $ruby_lib_gem_path)" "$rvm_ruby_gem_home" "$rvm_ruby_global_gems_path";
if [[ -d "$ruby_lib_gem_path" && ! -L "$ruby_lib_gem_path" ]]; then
if [[ "$rvm_ruby_gem_home" != "$rvm_ruby_global_gems_path" ]]; then
\cp -f "$ruby_lib_gem_path"/* "$rvm_ruby_global_gems_path"/ 2> /dev/null;
fi;
\mv -f "$ruby_lib_gem_path"/* "$rvm_ruby_gem_home"/ 2> /dev/null;
fi;
__rvm_rm_rf "$ruby_lib_gem_path";
if [[ -d "$rvm_ruby_gem_home" ]]; then
ln -fs "$rvm_ruby_gem_home" "$ruby_lib_gem_path";
fi
}
__rvm_run ()
{
typeset name message;
typeset -a _command_array;
name="${1:-}";
eval "_command_array=( ${2:-} )";
message="${3:-}";
__rvm_log_command "$name" "$message" "${_command_array[@]}" || return $?
}
__rvm_run_script ()
{
"$rvm_scripts_path/${1:-"$rvm_action"}" "${rvm_ruby_args[@]}"
}
__rvm_run_with_env ()
{
typeset name environment _command message log __logs_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;
__logs_path="${rvm_log_path}/$rvm_ruby_string";
[[ -d "$__logs_path" ]] || command mkdir -p "$__logs_path";
log="$__logs_path/$name.log";
[[ -f "$log" ]] || command touch "$log";
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=$?;
rvm_error "Error running '$command' under $env_name,\nplease read $log";
return $result
}
}
__rvm_rvmrc_key ()
{
printf "%b" "$1" | \tr '[#/.=()]' _;
return $?
}
__rvm_rvmrc_stored_trust ()
{
[[ -f "$1" ]] || return 1;
"${rvm_scripts_path:-"$rvm_path/scripts"}/db" "$rvm_user_path/rvmrcs" "$(__rvm_rvmrc_key "$1")" || return $?
}
__rvm_rvmrc_stored_trust_check ()
{
typeset rvmrc_path;
rvmrc_path="$1";
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.";
return 1;
else
if [[ "${trust[${_first}]}" == '1' ]]; then
echo "The rvmrc at '$rvmrc_path' is currently trusted.";
return 0;
else
if [[ "${trust[${_first}]}" == '0' ]]; then
echo "The rvmrc at '$rvmrc_path' is currently untrusted.";
return 1;
else
echo "The trustiworthiness of '$rvmrc_path' is currently unknown.";
return 1;
fi;
fi;
fi;
else
echo "There is no $rvmrc_path";
return 1;
fi
}
__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:-${GEM_HOME##*/}}";
rvmrc_path="$(__rvm_cd "$PWD" >/dev/null 2>&1; pwd)";
else
if [[ "${1:-}" == "all" ]]; then
rvmrc_path="all";
else
if [[ -n "${1:-}" ]]; then
rvmrc_path="${1%/.rvmrc}";
else
rvmrc_path="$PWD";
fi;
rvmrc_path="$(__rvm_cd "${rvmrc_path}" >/dev/null 2>&1; pwd)";
fi;
fi;
(( $# )) && shift || true;
if (( $# )); then
rvmrc_path="${rvmrc_path}/$1";
else
__rvm_project_dir_check "${rvmrc_path}" 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" && rvm_log "Reset trust for $rvmrc_path" || rvm_error "Reset trust for $rvmrc_path - failed"
;;
trust)
__rvm_trust_rvmrc "$rvmrc_path" && rvm_log "Marked $rvmrc_path as trusted" || rvm_error "Marked $rvmrc_path as trusted - failed"
;;
untrust)
__rvm_untrust_rvmrc "$rvmrc_path" && rvm_log "Marked $rvmrc_path as untrusted" || rvm_error "Marked $rvmrc_path as untrusted - failed"
;;
trusted)
__rvm_rvmrc_stored_trust_check "$rvmrc_path" || return $?
;;
is_trusted)
__rvm_rvmrc_stored_trust_check "$rvmrc_path" > /dev/null
;;
load)
rvm_rvmrc_cwd="" rvm_trust_rvmrcs_flag=1 __rvm_project_rvmrc "$rvmrc_path"
;;
try_to_read_ruby)
case "$rvmrc_path" in
*/.rvmrc)
if ! __rvm_rvmrc_tools is_trusted "$(dirname "$rvmrc_path")" "$(basename "$rvmrc_path")"; then
( rvm_promptless=1 __rvm_project_rvmrc "$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_is_not_a_shell_function=0
__rvm_project_rvmrc "$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 "$rvmrc_path" >/dev/null 2>&1
__rvm_env_string
)";
rvm_ruby_strings="$rvm_ruby_string"
;;
esac
;;
*)
rvm_error "Usage: rvm rvmrc {trust,untrust,trusted,load,reset,is_trusted,try_to_read_ruby,create}";
return 1
;;
esac;
unset escape_flag;
return $?
}
__rvm_sed_i ()
{
typeset _filename _executable;
[[ -n "${1:-}" ]] || {
rvm_debug "no file given for __rvm_sed_i";
return 0
};
_filename="$1";
shift;
if [[ -x "${_filename}" ]]; then
_executable=true;
fi;
{
\sed "$@" < "${_filename}" > "${_filename}.new" && \mv -f "${_filename}.new" "${_filename}"
} 2>&1 | rvm_debug_stream;
if [[ -n "${_executable:-}" ]]; then
chmod +x "${_filename}";
fi
}
__rvm_select ()
{
true ${rvm_gemset_name:=};
typeset _original_env_string;
_original_env_string=${rvm_env_string};
export -a rvm_configure_flags rvm_patch_names rvm_ree_options rvm_make_flags;
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_debug_flag rvm_default_flag rvm_delete_flag rvm_docs_type rvm_dump_environment_flag rvm_error_message rvm_expanding_aliases rvm_file_name rvm_gemdir_flag rvm_gemset_name rvm_gemstone_package_file rvm_gemstone_url rvm_head_flag rvm_hook rvm_install_on_use_flag rvm_llvm_flag rvm_loaded_flag rvm_niceness rvm_nightly_flag rvm_only_path_flag rvm_parse_break rvm_patch_original_pwd rvm_pretty_print_flag rvm_proxy rvm_quiet_flag rvm_reload_flag rvm_remove_flag rvm_ruby_alias rvm_ruby_args rvm_ruby_binary rvm_ruby_bits rvm_ruby_configure rvm_ruby_file rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_global_gems_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_make rvm_ruby_make_install rvm_ruby_minor_version rvm_ruby_mode rvm_ruby_name rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_patch rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_sha rvm_ruby_string rvm_ruby_strings rvm_ruby_tag rvm_ruby_url rvm_ruby_user_tag rvm_ruby_version rvm_script_name rvm_sdk rvm_silent_flag rvm_sticky_flag rvm_system_flag rvm_token rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_wrapper_name rvm_architectures;
if [[ -z "${rvm_ruby_string:-}" ]]; then
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:-missing}" in
missing)
return 2
;;
opal)
rvm_ruby_version="head";
rvm_ruby_revision="head";
rvm_ruby_interpreter="opal";
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_disable_binary_flag=1
;;
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";
rvm_disable_binary_flag=1;
else
if [[ "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";
else
if [[ -n "${rvm_ruby_version:-}" ]]; then
__rvm_db "macruby_${rvm_ruby_version}_url" "rvm_ruby_url";
[[ -n "${rvm_ruby_url:-}" ]] || __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;
fi;
fi;
rvm_ruby_patch_level="";
else
rvm_error "MacRuby can only be installed on a Darwin OS.";
fi
;;
rbx | rubinius)
if (( ${rvm_nightly_flag:=0} == 1 )); then
typeset org_rvm_ruby_patch_level _rvm_ruby_name;
if [[ "$rvm_ruby_version" == head ]]; then
rvm_ruby_version="";
fi;
rvm_debug "searching for binary rbx ${rvm_ruby_version:-}${rvm_ruby_version:+-}${rvm_ruby_patch_level}*${rvm_ruby_name:+-}${rvm_ruby_name:-}";
org_rvm_ruby_patch_level="$rvm_ruby_patch_level";
_rvm_ruby_name="${rvm_ruby_name:-${detected_rvm_ruby_name:-}}";
rvm_ruby_patch_level="$(
__list_remote_rbx_for $( __rvm_system_path_for rbx ) |
GREP_OPTIONS="" \grep ${rvm_ruby_version:-}${rvm_ruby_version:+-}${org_rvm_ruby_patch_level}.*${_rvm_ruby_name:+-}${_rvm_ruby_name:-} |
tail -n 1
)";
[[ -n "${rvm_ruby_patch_level:-}" ]] || {
rvm_error "Could not find rbx binary '${rvm_ruby_version:-}${rvm_ruby_version:+-}${org_rvm_ruby_patch_level}*${rvm_ruby_name:+-}${rvm_ruby_name:-}' release for '$( __rvm_system_path_for rbx )'.";
return 1
};
rvm_ruby_patch_level="${rvm_ruby_patch_level##*/}";
rvm_ruby_patch_level="${rvm_ruby_patch_level%.tar.*}";
if [[ -z "${rvm_ruby_version:-}" ]]; then
rvm_ruby_patch_level="${rvm_ruby_patch_level#rubinius-}";
rvm_ruby_version="${rvm_ruby_patch_level%%-*}";
fi;
if [[ -z "${rvm_ruby_name:-}" ]]; then
rvm_ruby_name="${rvm_ruby_patch_level##*-}";
fi;
rvm_ruby_patch_level="${rvm_ruby_patch_level##*${org_rvm_ruby_patch_level}}";
rvm_ruby_patch_level="${rvm_ruby_patch_level%%-*}";
rvm_ruby_patch_level="${org_rvm_ruby_patch_level}${rvm_ruby_patch_level}";
rvm_ruby_string="rubinius-${rvm_ruby_version}-${rvm_ruby_patch_level}-${rvm_ruby_name}";
rvm_debug "detected rbx ${rvm_ruby_string}";
rvm_verify_downloads_flag=1;
fi;
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")};
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
if [[ -n "${rvm_ruby_patch_level:-}" ]]; then
rbx_url="$( __rvm_db "rbx_2.0.0_url" )";
rvm_archive_extension="zip";
rvm_ruby_url="${rbx_url}";
rvm_ruby_package_file="release-${rvm_ruby_version}-${rvm_ruby_patch_level}.${rvm_archive_extension}";
rvm_ruby_url="$rvm_ruby_url/$rvm_ruby_package_file";
else
rvm_ruby_patch_level="";
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";
fi;
else
rvm_ruby_patch_level="";
rvm_ruby_version="head";
rvm_disable_binary_flag=1;
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")}";
rvm_disable_binary_flag=1;
else
if (( ${rvm_18_flag:-0} || ${rvm_19_flag:-0} || ${#rvm_patch_names[@]} )); 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}}";
rvm_disable_binary_flag=1;
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;
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";
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}";
rvm_disable_binary_flag=1;
else
rvm_ruby_package_file="MagLev-${rvm_ruby_version}";
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=$(
command curl -s https://raw.github.com/MagLev/maglev/MagLev-${rvm_ruby_version}/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")}";
rvm_disable_binary_flag=1;
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")";
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
;;
*)
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_ruby_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_ruby_repo_url:-"$(__rvm_db "goruby_repo_url")"};
rvm_ruby_url=$rvm_ruby_repo_url;
rvm_ruby_configure="";
rvm_ruby_make="";
rvm_ruby_make_install=""
;;
mruby)
rvm_ruby_interpreter="mruby";
rvm_ruby_version="head";
rvm_ruby_string="mruby-head";
rvm_ruby_patch_level="";
rvm_ruby_repo_url=${rvm_ruby_repo_url:-"$(__rvm_db "mruby_repo_url")"};
rvm_ruby_url=$rvm_ruby_repo_url;
export rvm_head_flag=1;
rvm_disable_binary_flag=1;
export rvm_skip_autoreconf_flag=1;
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_disable_binary_flag=1;
rvm_ruby_configure="";
rvm_ruby_make="";
rvm_ruby_make_install=""
;;
jamesgolick)
rvm_ruby_interpreter="jamesgolick";
rvm_ruby_version="head";
rvm_ruby_string="jamesgolick";
rvm_ruby_patch_level="";
rvm_ruby_repo_url=${rvm_jamesgolick_repo_url:-"$(__rvm_db "jamesgolick_repo_url")"};
rvm_ruby_url=$rvm_ruby_repo_url;
rvm_ruby_repo_branch="${rvm_ruby_repo_branch:-"$(__rvm_db "jamesgolick_repo_branch")"}";
export rvm_head_flag=1;
rvm_disable_binary_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
if __rvm_version_compare "${rvm_ruby_version}" -lt "1.8.5"; then
rvm_archive_extension="tar.gz";
else
rvm_archive_extension="tar.bz2";
fi;
else
rvm_disable_binary_flag=1;
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)) && __rvm_string_match "$ruby_binary" "*rvm*"; then
rvm_ruby_string="$(dirname "$ruby_binary" | xargs dirname | xargs basename)";
else
rvm_ruby_interpreter="system";
fi
;;
default | system | user)
;;
*)
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;
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_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" && "${rvm_prefix:-}" != "$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 __rvm_string_match "$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_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_setup ()
{
__variables_definition export;
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;
if setopt | GREP_OPTIONS="" \grep -s '^noclobber$' > /dev/null 2>&1; then
rvm_zsh_clobber=0;
else
rvm_zsh_clobber=1;
fi;
setopt clobber;
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_setup_cd ()
{
typeset __cd_prefix __command;
if typeset -f smartcd > /dev/null 2> /dev/null; then
__cd_prefix="smartcd";
else
__cd_prefix="builtin";
fi;
function __rvm_after_cd ()
{
typeset rvm_hook;
rvm_hook="after_cd";
if [[ -n "${rvm_scripts_path:-}" || -n "${rvm_path:-}" ]]; then
source "${rvm_scripts_path:-$rvm_path/scripts}/hook";
fi
};
function __rvm_setup_cd_function ()
{
typeset __cd_prefix __command;
__cd_prefix=$1;
__command=$2;
eval "
${__command}(){
if ${__cd_prefix} ${__command} \"\$@\"
then
[[ -n \"\${rvm_current_rvmrc:-""}\" && \"\$*\" == \".\" ]] && rvm_current_rvmrc=\"\" || true
__rvm_do_with_env_before
__rvm_project_rvmrc
__rvm_after_cd
__rvm_do_with_env_after
return 0
else
return \$?
fi
}"
};
if [[ -n "${ZSH_VERSION:-}" ]]; then
autoload is-at-least;
if is-at-least 4.3.4 > /dev/null 2>&1; then
export -a chpwd_functions;
chpwd_functions=("${chpwd_functions[@]}" __rvm_do_with_env_before __rvm_project_rvmrc __rvm_after_cd __rvm_do_with_env_after);
else
for __command in cd popd pushd;
do
__rvm_setup_cd_function "${__cd_prefix}" "${__command}";
done;
fi;
else
for __command in cd popd pushd;
do
__rvm_setup_cd_function "${__cd_prefix}" "${__command}";
done;
fi
}
__rvm_setup_cd_function ()
{
typeset __cd_prefix __command;
__cd_prefix=$1;
__command=$2;
eval "
${__command}(){
if ${__cd_prefix} ${__command} \"\$@\"
then
[[ -n \"\${rvm_current_rvmrc:-""}\" && \"\$*\" == \".\" ]] && rvm_current_rvmrc=\"\" || true
__rvm_do_with_env_before
__rvm_project_rvmrc
__rvm_after_cd
__rvm_do_with_env_after
return 0
else
return \$?
fi
}"
}
__rvm_sha256_for ()
{
if builtin command -v sha256sum > /dev/null; then
echo "$1" | sha256sum | awk '{print $1}';
else
if builtin command -v sha256 > /dev/null; then
echo "$1" | sha256 | awk '{print $1}';
else
if 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;
fi;
fi;
return 0
}
__rvm_sha256_for_contents ()
{
if builtin command -v sha256sum > /dev/null; then
echo "$1" | cat - "$1" | sha256sum | awk '{print $1}';
else
if builtin command -v sha256 > /dev/null; then
echo "$1" | cat - "$1" | sha256 | awk '{print $1}';
else
if 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;
fi;
fi;
return 0
}
__rvm_sha__calculate ()
{
typeset bits _sum;
bits=${1:-512};
shift;
if builtin command -v sha${bits}sum > /dev/null; then
_sum=$(sha${bits}sum "$@");
echo ${_sum% *};
return 0;
else
if builtin command -v sha${bits} > /dev/null; then
_sum=$(sha${bits} "$@");
echo ${_sum% *};
return 0;
else
if builtin command -v shasum > /dev/null; then
_sum=$(shasum -a${bits} "$@");
echo ${_sum% *};
return 0;
fi;
fi;
fi;
rvm_error "Neither sha512sum nor shasum found in the PATH";
return 1
}
__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
}
__rvm_string_match ()
{
typeset _string;
_string="$1";
shift;
while (( $# )); do
case "${_string}" in
$1)
return 0
;;
esac;
shift;
done;
return 1
}
__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
}
__rvm_strip ()
{
\sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]]\{1,\}/ /g';
return $?
}
__rvm_switch ()
{
typeset new_rvm_path new_rvm_bin_path;
(( $# )) && [[ -z "$1" ]] && shift || true;
(( $# )) && [[ -n "$1" ]] && [[ -d "$1" || -d "${1%/*}" ]] && [[ ! -f "$1" ]] || {
rvm_error "No valid path given.";
return 1
};
[[ "${rvm_path}" != "${new_rvm_path}" ]] || {
rvm_warn "Already there!";
return 2
};
rvm_log "Switching ${rvm_path} => ${1}";
new_rvm_path="${1%/}";
new_rvm_bin_path="${2:-$new_rvm_path/bin}";
new_rvm_bin_path="${new_rvm_bin_path%/}";
__rvm_use_system;
__rvm_remove_from_path "${rvm_path%/}/*";
rvm_reload_flag=1;
rvm_path="${new_rvm_path}";
rvm_bin_path="${new_rvm_bin_path}";
rvm_scripts_path="${rvm_path}/scripts";
rvm_environments_path="${rvm_path}/environments";
__rvm_remove_from_path "${rvm_path%/}/*";
__rvm_add_to_path prepend "${rvm_bin_path}"
}
__rvm_system_path ()
{
rvm_remote_server_path="$(__rvm_db "rvm_remote_server_path${2:-}")";
[[ -n "${rvm_remote_server_path}" ]] || if __rvm_detect_system; then
rvm_remote_server_path="${_system_name}/${_system_version}/${_system_arch}";
else
return $?;
fi;
if [[ "${1:-}" == "-" ]]; then
printf "%b" "${rvm_remote_server_path}\n";
fi
}
__rvm_system_path_for ()
{
typeset _iterator rvm_remote_server_type rvm_remote_server_path;
_iterator="";
while :; do
rvm_remote_server_type="$(__rvm_db "rvm_remote_server_type${_iterator}")";
[[ -n "${rvm_remote_server_type}" ]] || return 0;
if [[ "${rvm_remote_server_type}" == "$1" || "$1" == "all" ]]; then
__rvm_system_path - "${_iterator}";
fi;
: $(( _iterator+=1 ));
done | sort -u | tr "\n" "|" | sed 's/|$//'
}
__rvm_teardown ()
{
if builtin command -v __rvm_cleanup_tmp > /dev/null 2>&1; then
__rvm_cleanup_tmp;
fi;
export __rvm_env_loaded;
: __rvm_env_loaded:${__rvm_env_loaded:=${rvm_tmp_path:+1}}:;
: __rvm_env_loaded:${__rvm_env_loaded:=0}:;
: __rvm_env_loaded:$(( __rvm_env_loaded-=1 )):;
if [[ -z "${rvm_tmp_path:-}" ]] || (( __rvm_env_loaded > 0 )); then
return 0;
fi;
if [[ -n "${BASH_VERSION:-}" ]]; then
trap - 0 1 2 3 15;
fi;
if [[ -n "${ZSH_VERSION:-""}" ]]; then
(( rvm_zsh_clobber == 0 )) && setopt noclobber;
(( rvm_zsh_nomatch == 0 )) || setopt nomatch;
unset rvm_zsh_clobber rvm_zsh_nomatch;
fi;
if [[ -n "${rvm_stored_umask:-}" ]]; then
umask ${rvm_stored_umask};
unset rvm_stored_umask;
fi;
if [[ "${rvm_stored_errexit:-""}" == "1" ]]; then
set -e;
fi;
__variables_definition unset;
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_trust_rvmrc ()
{
[[ -f "$1" ]] || return 1;
__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_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)
}
__rvm_unset_ruby_variables ()
{
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_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
}
__rvm_untrust_rvmrc ()
{
[[ -f "$1" ]] || return 1;
__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 || return $?
}
__rvm_usage ()
{
__rvm_pager_or_cat_v "${rvm_path:-$HOME/.rvm}/README"
}
__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_manage_wrapper "install" "$rvm_ruby_string";
else
rvm_error "$rvm_ruby_string is not installed.";
rvm_log "To install do: 'rvm install $rvm_ruby_string'";
export rvm_recommended_ruby="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;
if [[ "maglev" == "$rvm_ruby_interpreter" ]]; then
GEM_PATH="$GEM_PATH:$MAGLEV_HOME/lib/maglev/gems/1.8/";
fi;
[[ -n "${IRBRC:-}" ]] || unset IRBRC;
__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
"$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;
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_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
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;
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_using_gemset_globalcache ()
{
"$rvm_scripts_path/db" "$rvm_user_path/db" "use_gemset_globalcache" | GREP_OPTIONS="" \grep '^true$' > /dev/null 2>&1;
return $?
}
__rvm_version ()
{
__rvm_meta;
typeset IFS release;
IFS=':';
rvm_meta_authors="${rvm_meta_authors[*]}";
rvm_meta_authors="${rvm_meta_authors//:/, }";
echo -e "\nrvm ${rvm_meta_version} by ${rvm_meta_authors} [${rvm_meta_website}]\n"
}
__rvm_version_compare ()
{
typeset first;
first="$( printf "%b" "$1\n$3\n" | LC_ALL=C sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n | head -n1 )";
case "$2" in
-eq | == | =)
[[ "$1" == "$3" ]] || return $?
;;
-gt | \>)
[[ "$1" != "$3" && "$first" == "$1" ]] || return $?
;;
-ge | \>=)
[[ "$1" == "$3" || "$first" == "$1" ]] || return $?
;;
-lt | \<)
[[ "$1" != "$3" && "$first" == "$2" ]] || return $?
;;
-le | \<=)
[[ "$1" == "$3" || "$first" == "$3" ]] || return $?
;;
*)
rvm_error "Unsupported operator '$2'.";
return 1
;;
esac;
return 0
}
__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_which ()
{
if command which --skip-alias --skip-functions which > /dev/null 2>&1; then
command which --skip-alias --skip-functions "$@";
else
if command whence whence > /dev/null 2>&1; then
command whence -p "$@";
else
if command which which > /dev/null 2>&1; then
command which "$@";
else
if which which > /dev/null 2>&1; then
which "$@";
else
return 1;
fi;
fi;
fi;
fi
}
__variables_definition ()
{
typeset -a __variables_list __array_list;
typeset __method;
__method="$1";
__variables_list=(rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_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_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_disable_binary_flag rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag rvm_remote_flag rvm_verify_downloads_flag rvm_skip_openssl_flag rvm_gems_cache_path rvm_gems_path rvm_man_path rvm_ruby_gem_path rvm_ruby_log_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 rvm_stored_errexit 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_package_file rvm_ruby_name rvm_ruby_name rvm_ruby_args rvm_ruby_user_tag rvm_ruby_patch detected_rvm_ruby_name __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_tar_command rvm_tar_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name rvm_with_gems rvm_without_gems rvm_force_clang_ok rvm_ignore_dotfiles_flag rvm_latest_binary_flag rvm_fuzzy_flag);
__array_list=(rvm_patch_names rvm_ree_options rvm_autoconf_flags);
case "${__method}" in
export)
export -a "${__array_list[@]}"
;;
unset)
unset "${__array_list[@]}"
;;
*)
rvm_error "Unknown action given to __variables_definition: ${__method}";
return 1
;;
esac;
${__method} "${__variables_list[@]}"
}
_git ()
{
local i c=1 command __git_dir;
while [ $c -lt $COMP_CWORD ]; do
i="${COMP_WORDS[c]}";
case "$i" in
--git-dir=*)
__git_dir="${i#--git-dir=}"
;;
--bare)
__git_dir="."
;;
--version | --help | -p | --paginate)
;;
*)
command="$i";
break
;;
esac;
c=$((++c));
done;
if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
case "${COMP_WORDS[COMP_CWORD]}" in
--*=*)
COMPREPLY=()
;;
--*)
__gitcomp "
--no-pager
--git-dir=
--bare
--version
--exec-path
"
;;
*)
__gitcomp "$(__git_commands) $(__git_aliases)"
;;
esac;
return;
fi;
local expansion=$(__git_aliased_command "$command");
[ "$expansion" ] && command="$expansion";
case "$command" in
am)
_git_am
;;
add)
_git_add
;;
apply)
_git_apply
;;
bisect)
_git_bisect
;;
bundle)
_git_bundle
;;
branch)
_git_branch
;;
checkout)
_git_checkout
;;
cherry)
_git_cherry
;;
cherry-pick)
_git_cherry_pick
;;
commit)
_git_commit
;;
config)
_git_config
;;
describe)
_git_describe
;;
diff)
_git_diff
;;
fetch)
_git_fetch
;;
format-patch)
_git_format_patch
;;
gc)
_git_gc
;;
log)
_git_log
;;
ls-remote)
_git_ls_remote
;;
ls-tree)
_git_ls_tree
;;
merge)
_git_merge
;;
merge-base)
_git_merge_base
;;
name-rev)
_git_name_rev
;;
pull)
_git_pull
;;
push)
_git_push
;;
rebase)
_git_rebase
;;
remote)
_git_remote
;;
reset)
_git_reset
;;
shortlog)
_git_shortlog
;;
show)
_git_show
;;
show-branch)
_git_log
;;
stash)
_git_stash
;;
submodule)
_git_submodule
;;
tag)
_git_tag
;;
whatchanged)
_git_log
;;
*)
COMPREPLY=()
;;
esac
}
_git_add ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--*)
__gitcomp "--interactive --refresh";
return
;;
esac;
COMPREPLY=()
}
_git_am ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
if [ -d .dotest ]; then
__gitcomp "--skip --resolved";
return;
fi;
case "$cur" in
--whitespace=*)
__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}";
return
;;
--*)
__gitcomp "
--signoff --utf8 --binary --3way --interactive
--whitespace=
";
return
;;
esac;
COMPREPLY=()
}
_git_apply ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--whitespace=*)
__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}";
return
;;
--*)
__gitcomp "
--stat --numstat --summary --check --index
--cached --index-info --reverse --reject --unidiff-zero
--apply --no-add --exclude=
--whitespace= --inaccurate-eof --verbose
";
return
;;
esac;
COMPREPLY=()
}
_git_bisect ()
{
local i c=1 command;
while [ $c -lt $COMP_CWORD ]; do
i="${COMP_WORDS[c]}";
case "$i" in
start | bad | good | reset | visualize | replay | log)
command="$i";
break
;;
esac;
c=$((++c));
done;
if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
__gitcomp "start bad good reset visualize replay log";
return;
fi;
case "$command" in
bad | good | reset)
__gitcomp "$(__git_refs)"
;;
*)
COMPREPLY=()
;;
esac
}
_git_branch ()
{
__gitcomp "$(__git_refs)"
}
_git_bundle ()
{
local mycword="$COMP_CWORD";
case "${COMP_WORDS[0]}" in
git)
local cmd="${COMP_WORDS[2]}";
mycword="$((mycword-1))"
;;
git-bundle*)
local cmd="${COMP_WORDS[1]}"
;;
esac;
case "$mycword" in
1)
__gitcomp "create list-heads verify unbundle"
;;
2)
;;
*)
case "$cmd" in
create)
__git_complete_revlist
;;
esac
;;
esac
}
_git_checkout ()
{
__gitcomp "$(__git_refs)"
}
_git_cherry ()
{
__gitcomp "$(__git_refs)"
}
_git_cherry_pick ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--*)
__gitcomp "--edit --no-commit"
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
}
_git_commit ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--*)
__gitcomp "
--all --author= --signoff --verify --no-verify
--edit --amend --include --only
";
return
;;
esac;
COMPREPLY=()
}
_git_config ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
local prv="${COMP_WORDS[COMP_CWORD-1]}";
case "$prv" in
branch.*.remote)
__gitcomp "$(__git_remotes)";
return
;;
branch.*.merge)
__gitcomp "$(__git_refs)";
return
;;
remote.*.fetch)
local remote="${prv#remote.}";
remote="${remote%.fetch}";
__gitcomp "$(__git_refs_remotes "$remote")";
return
;;
remote.*.push)
local remote="${prv#remote.}";
remote="${remote%.push}";
__gitcomp "$(git --git-dir="$(__gitdir)" for-each-ref --format='%(refname):%(refname)' refs/heads)";
return
;;
pull.twohead | pull.octopus)
__gitcomp "$(__git_merge_strategies)";
return
;;
color.branch | color.diff | color.status)
__gitcomp "always never auto";
return
;;
color.*.*)
__gitcomp "
black red green yellow blue magenta cyan white
bold dim ul blink reverse
";
return
;;
*.*)
COMPREPLY=();
return
;;
esac;
case "$cur" in
--*)
__gitcomp "
--global --system --file=
--list --replace-all
--get --get-all --get-regexp
--add --unset --unset-all
--remove-section --rename-section
";
return
;;
branch.*.*)
local pfx="${cur%.*}.";
cur="${cur##*.}";
__gitcomp "remote merge" "$pfx" "$cur";
return
;;
branch.*)
local pfx="${cur%.*}.";
cur="${cur#*.}";
__gitcomp "$(__git_heads)" "$pfx" "$cur" ".";
return
;;
remote.*.*)
local pfx="${cur%.*}.";
cur="${cur##*.}";
__gitcomp "
url fetch push skipDefaultUpdate
receivepack uploadpack tagopt
" "$pfx" "$cur";
return
;;
remote.*)
local pfx="${cur%.*}.";
cur="${cur#*.}";
__gitcomp "$(__git_remotes)" "$pfx" "$cur" ".";
return
;;
esac;
__gitcomp "
apply.whitespace
core.fileMode
core.gitProxy
core.ignoreStat
core.preferSymlinkRefs
core.logAllRefUpdates
core.loosecompression
core.repositoryFormatVersion
core.sharedRepository
core.warnAmbiguousRefs
core.compression
core.legacyHeaders
core.packedGitWindowSize
core.packedGitLimit
clean.requireForce
color.branch
color.branch.current
color.branch.local
color.branch.remote
color.branch.plain
color.diff
color.diff.plain
color.diff.meta
color.diff.frag
color.diff.old
color.diff.new
color.diff.commit
color.diff.whitespace
color.pager
color.status
color.status.header
color.status.added
color.status.changed
color.status.untracked
diff.renameLimit
diff.renames
fetch.unpackLimit
format.headers
format.subjectprefix
gitcvs.enabled
gitcvs.logfile
gitcvs.allbinary
gitcvs.dbname gitcvs.dbdriver gitcvs.dbuser gitcvs.dvpass
gc.packrefs
gc.reflogexpire
gc.reflogexpireunreachable
gc.rerereresolved
gc.rerereunresolved
http.sslVerify
http.sslCert
http.sslKey
http.sslCAInfo
http.sslCAPath
http.maxRequests
http.lowSpeedLimit
http.lowSpeedTime
http.noEPSV
i18n.commitEncoding
i18n.logOutputEncoding
log.showroot
merge.tool
merge.summary
merge.verbosity
pack.window
pack.depth
pack.windowMemory
pack.compression
pack.deltaCacheSize
pack.deltaCacheLimit
pull.octopus
pull.twohead
repack.useDeltaBaseOffset
show.difftree
showbranch.default
tar.umask
transfer.unpackLimit
receive.unpackLimit
receive.denyNonFastForwards
user.name
user.email
user.signingkey
whatchanged.difftree
branch. remote.
"
}
_git_describe ()
{
__gitcomp "$(__git_refs)"
}
_git_diff ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--*)
__gitcomp "--cached --stat --numstat --shortstat --summary
--patch-with-stat --name-only --name-status --color
--no-color --color-words --no-renames --check
--full-index --binary --abbrev --diff-filter
--find-copies-harder --pickaxe-all --pickaxe-regex
--text --ignore-space-at-eol --ignore-space-change
--ignore-all-space --exit-code --quiet --ext-diff
--no-ext-diff";
return
;;
esac;
__git_complete_file
}
_git_diff_tree ()
{
__gitcomp "$(__git_refs)"
}
_git_fetch ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "${COMP_WORDS[0]},$COMP_CWORD" in
git-fetch*,1)
__gitcomp "$(__git_remotes)"
;;
git,2)
__gitcomp "$(__git_remotes)"
;;
*)
case "$cur" in
*:*)
__gitcomp "$(__git_refs)" "" "${cur#*:}"
;;
*)
local remote;
case "${COMP_WORDS[0]}" in
git-fetch)
remote="${COMP_WORDS[1]}"
;;
git)
remote="${COMP_WORDS[2]}"
;;
esac;
__gitcomp "$(__git_refs2 "$remote")"
;;
esac
;;
esac
}
_git_format_patch ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--*)
__gitcomp "
--stdout --attach --thread
--output-directory
--numbered --start-number
--numbered-files
--keep-subject
--signoff
--in-reply-to=
--full-index --binary
--not --all
";
return
;;
esac;
__git_complete_revlist
}
_git_gc ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--*)
__gitcomp "--prune --aggressive";
return
;;
esac;
COMPREPLY=()
}
_git_log ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--pretty=*)
__gitcomp "
oneline short medium full fuller email raw
" "" "${cur##--pretty=}";
return
;;
--date=*)
__gitcomp "
relative iso8601 rfc2822 short local default
" "" "${cur##--date=}";
return
;;
--*)
__gitcomp "
--max-count= --max-age= --since= --after=
--min-age= --before= --until=
--root --topo-order --date-order --reverse
--no-merges --follow
--abbrev-commit --abbrev=
--relative-date --date=
--author= --committer= --grep=
--all-match
--pretty= --name-status --name-only --raw
--not --all
--left-right --cherry-pick
";
return
;;
esac;
__git_complete_revlist
}
_git_ls_remote ()
{
__gitcomp "$(__git_remotes)"
}
_git_ls_tree ()
{
__git_complete_file
}
_git_merge ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "${COMP_WORDS[COMP_CWORD-1]}" in
-s | --strategy)
__gitcomp "$(__git_merge_strategies)";
return
;;
esac;
case "$cur" in
--strategy=*)
__gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}";
return
;;
--*)
__gitcomp "
--no-commit --no-summary --squash --strategy
";
return
;;
esac;
__gitcomp "$(__git_refs)"
}
_git_merge_base ()
{
__gitcomp "$(__git_refs)"
}
_git_name_rev ()
{
__gitcomp "--tags --all --stdin"
}
_git_nuke ()
{
__gitcomp "$(__git_refs)"
}
_git_pull ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "${COMP_WORDS[0]},$COMP_CWORD" in
git-pull*,1)
__gitcomp "$(__git_remotes)"
;;
git,2)
__gitcomp "$(__git_remotes)"
;;
*)
local remote;
case "${COMP_WORDS[0]}" in
git-pull)
remote="${COMP_WORDS[1]}"
;;
git)
remote="${COMP_WORDS[2]}"
;;
esac;
__gitcomp "$(__git_refs "$remote")"
;;
esac
}
_git_push ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "${COMP_WORDS[0]},$COMP_CWORD" in
git-push*,1)
__gitcomp "$(__git_remotes)"
;;
git,2)
__gitcomp "$(__git_remotes)"
;;
*)
case "$cur" in
*:*)
local remote;
case "${COMP_WORDS[0]}" in
git-push)
remote="${COMP_WORDS[1]}"
;;
git)
remote="${COMP_WORDS[2]}"
;;
esac;
__gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
;;
+*)
__gitcomp "$(__git_refs)" + "${cur#+}"
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
;;
esac
}
_git_rebase ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
if [ -d .dotest ] || [ -d .git/.dotest-merge ]; then
__gitcomp "--continue --skip --abort";
return;
fi;
case "${COMP_WORDS[COMP_CWORD-1]}" in
-s | --strategy)
__gitcomp "$(__git_merge_strategies)";
return
;;
esac;
case "$cur" in
--strategy=*)
__gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}";
return
;;
--*)
__gitcomp "--onto --merge --strategy";
return
;;
esac;
__gitcomp "$(__git_refs)"
}
_git_remote ()
{
local i c=1 command;
while [ $c -lt $COMP_CWORD ]; do
i="${COMP_WORDS[c]}";
case "$i" in
add | rm | show | prune | update)
command="$i";
break
;;
esac;
c=$((++c));
done;
if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
__gitcomp "add rm show prune update";
return;
fi;
case "$command" in
rm | show | prune)
__gitcomp "$(__git_remotes)"
;;
update)
local i c='' IFS='
';
for i in $(git --git-dir="$(__gitdir)" config --list);
do
case "$i" in
remotes.*)
i="${i#remotes.}";
c="$c ${i/=*/}"
;;
esac;
done;
__gitcomp "$c"
;;
*)
COMPREPLY=()
;;
esac
}
_git_reset ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--*)
__gitcomp "--mixed --hard --soft";
return
;;
esac;
__gitcomp "$(__git_refs)"
}
_git_shortlog ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--*)
__gitcomp "
--max-count= --max-age= --since= --after=
--min-age= --before= --until=
--no-merges
--author= --committer= --grep=
--all-match
--not --all
--numbered --summary
";
return
;;
esac;
__git_complete_revlist
}
_git_show ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--pretty=*)
__gitcomp "
oneline short medium full fuller email raw
" "" "${cur##--pretty=}";
return
;;
--*)
__gitcomp "--pretty=";
return
;;
esac;
__git_complete_file
}
_git_stash ()
{
__gitcomp 'list show apply clear'
}
_git_submodule ()
{
local i c=1 command;
while [ $c -lt $COMP_CWORD ]; do
i="${COMP_WORDS[c]}";
case "$i" in
add | status | init | update)
command="$i";
break
;;
esac;
c=$((++c));
done;
if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--*)
__gitcomp "--quiet --cached"
;;
*)
__gitcomp "add status init update"
;;
esac;
return;
fi
}
_git_tag ()
{
local i c=1 f=0;
while [ $c -lt $COMP_CWORD ]; do
i="${COMP_WORDS[c]}";
case "$i" in
-d | -v)
__gitcomp "$(__git_tags)";
return
;;
-f)
f=1
;;
esac;
c=$((++c));
done;
case "${COMP_WORDS[COMP_CWORD-1]}" in
-m | -F)
COMPREPLY=()
;;
-* | tag | git-tag)
if [ $f = 1 ]; then
__gitcomp "$(__git_tags)";
else
COMPREPLY=();
fi
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
}
_gitk ()
{
local cur="${COMP_WORDS[COMP_CWORD]}";
case "$cur" in
--*)
__gitcomp "--not --all";
return
;;
esac;
__git_complete_revlist
}
cd ()
{
if builtin cd "$@"; then
[[ -n "${rvm_current_rvmrc:-}" && "$*" == "." ]] && rvm_current_rvmrc="" || true;
__rvm_do_with_env_before;
__rvm_project_rvmrc;
__rvm_after_cd;
__rvm_do_with_env_after;
return 0;
else
return $?;
fi
}
cdgem ()
{
gem_dir=`gem env | grep INSTALLATION | cut -d' ' -f6`;
cd $gem_dir/gems;
cd `ls|grep $1|sort|tail -1`
}
file_exists_at_url ()
{
( if [[ -n "${1:-}" ]]; then
unset curl;
\curl -slkL --max-time 3 --head "$1" 2>&1 | GREP_OPTIONS="" \grep -E 'HTTP/[0-9\.]+ 200 OK' > /dev/null 2>&1 || return $?;
else
rvm_log "Warning: URL was not passed to file_exists_at_url";
return 1;
fi )
}
g ()
{
if [[ $# > 0 ]]; then
git $@;
else
git status;
fi
}
gem ()
{
typeset result;
( typeset rvmrc;
rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc");
if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]; then
rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc");
fi;
for rvmrc in "${rvm_rvmrc_files[@]}";
do
[[ -s "${rvmrc}" ]] && source "${rvmrc}" || true;
done;
unset rvm_rvmrc_files;
command gem "$@" ) || result=$?;
hash -r;
return ${result:-0}
}
git-done ()
{
branch=`git_branch_name`;
git checkout master && git pull --rebase;
git checkout $branch && git rebase master && git checkout master && git merge $branch && bundle install && bundle exec rake db:migrate && bundle exec rake && git push && git branch -d $branch && git push origin :$branch
}
git-new-remote-tracking ()
{
git checkout -b $1 && git push -u origin $1
}
git-nuke ()
{
git branch -D $1 && git push origin :$1
}
git_branch_name ()
{
val=`git branch 2>/dev/null | grep '^*' | colrm 1 2`;
echo "$val"
}
glg ()
{
gem list | grep $1
}
is_a_function ()
{
typeset -f $1 > /dev/null 2>&1 || return $?
}
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
}
parse_git_branch ()
{
val=`git_branch_name | sed 's_\(.*\)_(\1)_'`;
echo "$val"
}
popd ()
{
if builtin popd "$@"; then
[[ -n "${rvm_current_rvmrc:-}" && "$*" == "." ]] && rvm_current_rvmrc="" || true;
__rvm_do_with_env_before;
__rvm_project_rvmrc;
__rvm_after_cd;
__rvm_do_with_env_after;
return 0;
else
return $?;
fi
}
printenv_null ()
{
if printenv --null > /dev/null 2> /dev/null; then
printenv --null;
else
printenv | sed '/=/ { s/=.*$//; p; }; d;' | while read name; do
zero="\0";
eval "eval \"printf '%b' '$name=\$$name$zero'\"";
done;
fi
}
pushd ()
{
if builtin pushd "$@"; then
[[ -n "${rvm_current_rvmrc:-}" && "$*" == "." ]] && rvm_current_rvmrc="" || true;
__rvm_do_with_env_before;
__rvm_project_rvmrc;
__rvm_after_cd;
__rvm_do_with_env_after;
return 0;
else
return $?;
fi
}
rrg ()
{
bundle exec rake routes | grep $1
}
rubygems_detect_ruby_lib_gem_path ()
{
ruby_lib_gem_path="$(
"${1:-ruby}" -rrbconfig -e "puts ::Kernel.const_get('RbConfig')::CONFIG['rubylibprefix']||::Kernel.const_get('RbConfig')::CONFIG['prefix']
")/gems/";
case "$rvm_ruby_string" in
jruby*)
ruby_lib_gem_path+="shared"
;;
*)
ruby_lib_gem_path+="$("${1:-ruby}" -rrbconfig -e "puts ::Kernel.const_get('RbConfig')::CONFIG['ruby_version']")"
;;
esac
}
rvm ()
{
typeset result current_result;
export -a rvm_ruby_args > /dev/null 2> /dev/null;
rvm_ruby_args=();
if (( ${rvm_ignore_rvmrc:=0} == 0 )); then
[[ -n "${rvm_stored_umask:-}" ]] || export rvm_stored_umask=$(umask);
rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc");
if [[ -n "${rvm_prefix:-}" ]] && [[ ! "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]; then
rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc");
fi;
for rvmrc in "${rvm_rvmrc_files[@]}";
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;
unset rvm_rvmrc_files;
fi;
disk_version="$(cat "$rvm_path/VERSION") ($(cat "$rvm_path/RELEASE" 2>/dev/null))";
if [[ -s "$rvm_path/VERSION" && "${rvm_version:-}" != "${disk_version:-}" && "reload" != "${1:-}" ]]; then
if (( ${rvm_auto_reload_flag:-0} )); then
__rvm_project_rvmrc_lock=0;
rvm_reload_flag=1;
source "${rvm_scripts_path:-${rvm_path}/scripts}/rvm";
else
printf "%b" "
A RVM version ${disk_version} is installed yet ${rvm_version} is loaded.
Please do one of the following:
* 'rvm reload'
* open a new shell
* 'echo rvm_auto_reload_flag=1 >> ~/.rvmrc' # for auto reload with msg.
* 'echo rvm_auto_reload_flag=2 >> ~/.rvmrc' # for silent auto reload.
";
return 1;
fi;
fi;
__rvm_initialize;
__rvm_setup;
next_token="$1";
(( $# == 0 )) || shift;
__rvm_parse_args "$@";
(( rvm_trace_flag == 0 )) || {
export PS4;
if [[ -n "$ZSH_VERSION" ]]; then
PS4="%F{red}%x:%I %F{green}%N:%i%F{white} %_";
else
PS4="+ \$(date \"+%s.%N\") \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > ";
fi;
set -x
};
result=$?;
: rvm_ruby_args:${#rvm_ruby_args[@]}:${rvm_ruby_args[*]}:;
(( result )) || case "${rvm_action:=usage}" in
use)
if rvm_is_a_shell_function; then
__rvm_use;
fi
;;
switch)
if rvm_is_a_shell_function; then
__rvm_switch "${rvm_ruby_args[@]}";
fi
;;
srcdir)
__rvm_source_dir
;;
inspect | usage | strings | version)
__rvm_${rvm_action}
;;
ls | list)
"$rvm_scripts_path/list" "${rvm_ruby_args[@]}"
;;
debug)
rvm_is_not_a_shell_function="${rvm_is_not_a_shell_function}" "$rvm_scripts_path/info" '' debug
;;
info)
rvm_is_not_a_shell_function="${rvm_is_not_a_shell_function}" "$rvm_scripts_path/${rvm_action}" "${rvm_ruby_args[@]}"
;;
benchmark | reset)
source "$rvm_scripts_path/functions/${rvm_action}";
__rvm_${rvm_action}
;;
update)
printf "%b" "ERROR: rvm update has been removed. See 'rvm get' and rvm 'rubygems' CLI API instead\n"
;;
reboot)
source "$rvm_scripts_path/functions/cleanup";
__rvm_reboot
;;
implode | seppuku)
source "$rvm_scripts_path/functions/implode";
__rvm_implode
;;
get)
next_token="${1:-}";
(( $# == 0 )) || shift;
[[ "$next_token" == "${rvm_action}" ]] && shift;
tmpdir="${TMPDIR:-/tmp}";
\cp -f "$rvm_scripts_path/get" "$tmpdir/$$";
if bash "$tmpdir/$$" "${rvm_ruby_args[@]}"; then
rvm_reload_flag=1;
else
rvm_error "Could not update RVM, get some help at #rvm IRC channel at freenode servers.";
fi;
\rm -f $tmpdir/$$
;;
current)
__rvm_env_string
;;
help | rtfm | env | list | monitor | notes | pkg | requirements)
next_token="${1:-}";
(( $# == 0 )) || shift;
if (( $# )) && [[ "$next_token" == "${rvm_action}" ]]; then
shift;
fi;
"$rvm_scripts_path/${rvm_action}" "${rvm_ruby_args[@]}"
;;
cleanup | tools | snapshot | disk-usage | repair | alias | docs | rubygems | migrate | upgrade | cron | group)
__rvm_run_script "$rvm_action" "${rvm_ruby_args[@]}"
;;
wrapper)
"$rvm_scripts_path/wrapper" "$rvm_ruby_string" "$rvm_wrapper_name" "${rvm_ruby_args[@]}";
result=$?;
unset rvm_wrapper_name
;;
do)
old_rvm_ruby_string=${rvm_ruby_string:-};
unset rvm_ruby_string;
export rvm_ruby_strings;
( if [[ -n "${rvm_in_flag}" && -d "${rvm_in_flag}" ]]; then
__rvm_cd "${rvm_in_flag}";
fi;
"$rvm_scripts_path/set" "$rvm_action" "${rvm_ruby_args[@]}" );
result=$?;
[[ -n "$old_rvm_ruby_string" ]] && rvm_ruby_string=$old_rvm_ruby_string;
unset old_rvm_ruby_string
;;
rvmrc)
__rvm_rvmrc_tools "${rvm_ruby_args[@]}"
;;
config-get)
typeset __ruby __var;
__ruby=$( which ruby );
for __var in "${rvm_ruby_args[@]}";
do
__rvm_ruby_config_get "${__var}" "${__ruby}";
done
;;
gemset)
if [[ ${rvm_use_flag:-0} -eq 1 ]]; then
if rvm_is_a_shell_function; then
__rvm_gemset_use;
fi;
else
export rvm_ruby_strings;
"$rvm_scripts_path/gemsets" "${rvm_ruby_args[@]}";
result=$?;
rvm_ruby_strings="";
if rvm_is_a_shell_function no_warning; then
if [[ ${rvm_delete_flag:-0} -eq 1 ]]; then
if [[ "${GEM_HOME:-""}" == "${GEM_HOME%%${rvm_gemset_separator:-@}*}${rvm_gemset_separator:-@}${rvm_gemset_name}" ]]; then
rvm_delete_flag=0;
rvm_ruby_string="@default";
__rvm_use;
fi;
unset gem_prefix;
else
if [[ "${rvm_ruby_args[*]}" =~ ^rename ]]; then
typeset _command _from _to;
read _command _from _to <<< "${rvm_ruby_args[*]}";
if [[ "${GEM_HOME:-""}" == "${GEM_HOME%%${rvm_gemset_separator:-@}*}${rvm_gemset_separator:-@}${_from}" ]]; then
rvm_ruby_string="@${_to}";
__rvm_use;
fi;
fi;
fi;
fi;
fi
;;
reload)
rvm_reload_flag=1
;;
tests | specs)
rvm_action="rake";
__rvm_do
;;
remove)
export rvm_path;
if [[ -n "${rvm_ruby_strings}" ]]; then
__rvm_manage_wrapper "$rvm_action" "${rvm_ruby_strings//*-- }";
else
__rvm_manage_wrapper "$rvm_action";
fi;
rvm_ruby_string=default;
__rvm_use
;;
fetch | uninstall | reinstall)
export rvm_path;
if [[ -n "${rvm_ruby_strings}" ]]; then
__rvm_manage_wrapper "$rvm_action" "${rvm_ruby_strings//*-- }";
else
__rvm_manage_wrapper "$rvm_action";
fi
;;
try_install | install)
export rvm_path;
if [[ -n "${rvm_ruby_strings}" ]]; then
typeset save_ruby;
selected_ruby="$( __rvm_select && echo $rvm_env_string )";
if [[ -z "${selected_ruby}" ]]; then
rvm_error "Could not detect ruby version/name for installation, please be more specific.";
false;
else
if (( ${rvm_force_flag:-0} == 0 )) && "$rvm_scripts_path"/list strings | GREP_OPTIONS="" \grep "^${selected_ruby%${rvm_gemset_separator:-'@'}*}$" > /dev/null; then
rvm_log "Already installed ${selected_ruby%${rvm_gemset_separator:-'@'}*}.
To reinstall use:
rvm reinstall ${rvm_ruby_strings}
";
else
if [[ $(find $rvm_rubies_path -maxdepth 1 -mindepth 1 -type d 2>/dev/null | wc -l) -eq 0 ]] && rvm_is_a_shell_function no_warning; then
"$rvm_scripts_path"/requirements run force ${rvm_ruby_strings};
fi;
__rvm_manage_wrapper install "${rvm_ruby_strings}";
fi;
fi;
else
rvm_error "Can not use or install 'all' rubies.";
false;
fi
;;
mount | automount | prepare)
"${rvm_scripts_path}/external" "$rvm_action" "$rvm_ruby_string" "${rvm_ruby_args[@]}"
;;
export)
__rvm_export "$rvm_export_args"
;;
unexport)
__rvm_unset_exports
;;
error)
false
;;
answer)
source "$rvm_scripts_path/functions/fun";
__rvm_Answer_to_the_Ultimate_Question_of_Life_the_Universe_and_Everything;
result=42
;;
question)
source "$rvm_scripts_path/functions/fun";
__rvm_ultimate_question;
result=42
;;
which)
__rvm_which "${rvm_ruby_args[@]}"
;;
*)
rvm_error "unknown action '$rvm_action'";
false
;;
esac;
current_result=$?;
(( result )) || result=${current_result};
(( result )) || case "$rvm_action" in
reinstall | try_install | install)
if [[ $(find $rvm_rubies_path -maxdepth 1 -mindepth 1 -type d 2>/dev/null | wc -l) -eq 1 ]] && [[ ! -f "${rvm_environments_path}/default" ]] && rvm_is_a_shell_function no_warning; then
rvm_log "";
rvm_verbose_flag=0 rvm_default_flag=1 __rvm_use;
fi
;;
esac;
current_result=$?;
(( result )) || result=${current_result};
typeset __local_rvm_trace_flag;
__local_rvm_trace_flag=${rvm_trace_flag:-0};
if [[ ${rvm_reload_flag:-0} -eq 1 ]]; then
if [[ -s "$rvm_scripts_path/rvm" ]]; then
__rvm_project_rvmrc_lock=0;
source "$rvm_scripts_path/rvm";
else
echo "rvm not found in $rvm_path, please install and run 'rvm reload'";
__rvm_teardown;
fi;
else
__rvm_teardown;
fi;
if (( __local_rvm_trace_flag > 0 )); then
set +o verbose;
set +o xtrace;
[[ -n "${ZSH_VERSION:-""}" ]] || set +o errtrace;
fi;
return ${result:-0}
}
rvm_debug ()
{
(( ${rvm_debug_flag:-0} )) || return 0;
if rvm_pretty_print stderr; then
printf "%b" "${rvm_debug_clr:-}$*${rvm_reset_clr:-}\n";
else
printf "%b" "$*\n";
fi 1>&2
}
rvm_debug_stream ()
{
(( ${rvm_debug_flag:-0} || ${rvm_trace_flag:-0} )) || return 0;
if rvm_pretty_print stdout; then
cat - | awk '{print "'"${rvm_debug_clr:-}"'"$0"'"${rvm_reset_clr:-}"'"}';
else
cat -;
fi 1>&2
}
rvm_error ()
{
if rvm_pretty_print stderr; then
printf "%b" "${rvm_error_clr:-}$*${rvm_reset_clr:-}\n";
else
printf "%b" "$*\n";
fi 1>&2
}
rvm_error_help ()
{
rvm_error "$1";
shift;
"${rvm_scripts_path}/help" "$@"
}
rvm_fail ()
{
rvm_error "$1";
exit "${2:-1}"
}
rvm_is_a_shell_function ()
{
typeset _message;
if (( ${rvm_is_not_a_shell_function:-0} )) && [[ "${1:-}" != "no_warning" ]]; then
if rvm_pretty_print stderr; then
rvm_log "";
fi;
if rvm_pretty_print stderr; then
rvm_log "RVM is not a function, selecting rubies with '${rvm_error_clr:-}rvm use ...${rvm_notify_clr:-}' will not work." 1>&2;
else
rvm_error "RVM is not a function, selecting rubies with 'rvm use ...' will not work.";
fi;
rvm_warn '
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
';
fi;
return ${rvm_is_not_a_shell_function:-0}
}
rvm_log ()
{
if rvm_pretty_print stdout; then
printf "%b" "${rvm_notify_clr:-}$*${rvm_reset_clr:-}\n";
else
printf "%b" "$*\n";
fi
}
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
}
rvm_warn ()
{
if rvm_pretty_print stdout; then
printf "%b" "${rvm_warn_clr:-}$*${rvm_reset_clr:-}\n";
else
printf "%b" "$*\n";
fi
}
sagi ()
{
sudo apt-get -y install $1
}
sgi ()
{
sudo gem install $1
}
start_agent ()
{
echo "Initialising new SSH agent...";
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}";
echo succeeded;
chmod 600 "${SSH_ENV}";
. "${SSH_ENV}" > /dev/null;
/usr/bin/ssh-add
}
syi ()
{
sudo yum -y install $1
}
track ()
{
git branch --track $1 "origin/$1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment