Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More cleanup.

  • Loading branch information...
commit 17c75a98c45cc282794b4815bc4f3ee5e93a8e71 1 parent 737c4fc
@wayneeseguin authored
View
26 scripts/cli
@@ -672,24 +672,15 @@ __rvm_parse_args()
--trace|--debug)
local option
- set -o noclobber
- set -o nounset
-
- if [[ -z "${ZSH_VERSION:-""}" ]] ; then
- set -o errtrace
- fi
+ [[ -n "${ZSH_VERSION:-""}" ]] || set -o errtrace
# errexit pipefail
- if [[ "$rvm_token" = "--trace" ]] ; then
-
+ if [[ "$rvm_token" = "--trace" ]]
+ then
export rvm_trace_flag=1
-
set -o xtrace
-
- if [[ -z "${ZSH_VERSION:-""}" ]] ; then
+ [[ -n "${ZSH_VERSION:-""}" ]] ||
export PS4="+ \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
-
- fi
fi
;;
@@ -934,16 +925,13 @@ rvm()
fi
- if [[ ${rvm_trace_flag:-0} -eq 1 ]] ; then
+ if (( ${rvm_trace_flag:-0} == 1 ))
+ then
rvm_trace_flag=0
set +o verbose
- set +o noclobber
- set +o nounset
set +o xtrace
- if [[ -z "${ZSH_VERSION:-""}" ]] ; then
- set +o errtrace
- fi
+ [[ -n "${ZSH_VERSION:-""}" ]] || set +o errtrace
fi
__rvm_teardown
View
8 scripts/functions/env
@@ -4,6 +4,14 @@
# Environment manipulation functions.
#
+__rvm_default_flags()
+{
+ :\
+ ${rvm_head_flag:=0} ${rvm_ruby_string:=0} ${rvm_clang_flag:=0} \
+ ${rvm_ruby_string:=0} ${rvm_clang_flag:=0} ${rvm_delete_flag:=0} \
+ ${rvm_clang_flag:=0}
+}
+
__rvm_nuke_rvm_variables()
{
unset rvm_head_flag $(env | awk -F= '/^rvm_/{print $1" "}')
View
62 scripts/initialize
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
# Ensure that the extended globs feature is turned on.
-if [[ -n "${ZSH_VERSION:-}" ]] ; then
+if [[ -n "${ZSH_VERSION:-}" ]]
+then
setopt extendedglob
setopt kshglob # This is necessary to gain the capabilities of the bash extglob which are used throught RVM
@@ -14,7 +15,8 @@ if [[ -n "${ZSH_VERSION:-}" ]] ; then
rvm_zsh_nomatch=$?
setopt no_nomatch
else
- if [[ -n "${BASH_VERSION:-}" ]] ; then
+ if [[ -n "${BASH_VERSION:-}" ]]
+ then
shopt -s extglob # Extended globs
else
printf "%s\n" "What the heck kind of shell are you running here???"
@@ -32,7 +34,8 @@ command -v __rvm_load_rvmrc >/dev/null 2>&1 || \
# configurable by the end users for whatever their needs may be.
# They should be set in /etc/rvmrc and then $HOME/.rvmrc
#
-if [[ ${rvm_user_install:-1} -eq 0 ]] ; then
+if (( ${rvm_user_install:-1} == 0 ))
+then
true "${rvm_bin_path:="${rvm_prefix}bin"}"
true "${rvm_man_path:="${rvm_prefix}share/man"}"
true "${rvm_rc_files:="/etc/profile /etc/zshenv"}"
@@ -42,47 +45,48 @@ else
true "${rvm_rc_files:="$HOME/.bash_profile $HOME/.bashrc $HOME/.zshenv"}"
fi
-true ${rvm_archives_path:="$rvm_path/archives"}
-true ${rvm_config_path:="$rvm_path/config"}
-true ${rvm_docs_path:="$rvm_path/docs"}
-true ${rvm_environments_path:="$rvm_path/environments"}
-true ${rvm_examples_path:="$rvm_path/examples"}
-true ${rvm_gems_path:="$rvm_path/gems"}
-true ${rvm_gemsets_path:="$rvm_path/gemsets"}
-true ${rvm_help_path:="$rvm_path/help"}
-true ${rvm_hooks_path:="$rvm_path/hooks"}
-true ${rvm_lib_path:="$rvm_path/lib"}
-true ${rvm_log_path:="$rvm_path/log"}
-true ${rvm_patches_path:="$rvm_path/patches"}
-true ${rvm_repos_path:="$rvm_path/repos"}
-true ${rvm_rubies_path:="$rvm_path/rubies"}
-true ${rvm_rubygems_path:="$rvm_path/rubygems"}
-true ${rvm_src_path:="$rvm_path/src"}
-true ${rvm_tmp_path:="$rvm_path/tmp"}
-true ${rvm_user_path:="$rvm_path/user"}
-true ${rvm_usr_path:="$rvm_path/usr"}
-true ${rvm_wrappers_path:="$rvm_path/wrappers"}
+: \
+ ${rvm_archives_path:="$rvm_path/archives"} \
+ ${rvm_config_path:="$rvm_path/config"} \
+ ${rvm_docs_path:="$rvm_path/docs"} \
+ ${rvm_environments_path:="$rvm_path/environments"} \
+ ${rvm_examples_path:="$rvm_path/examples"} \
+ ${rvm_gems_path:="$rvm_path/gems"} \
+ ${rvm_gemsets_path:="$rvm_path/gemsets"} \
+ ${rvm_help_path:="$rvm_path/help"} \
+ ${rvm_hooks_path:="$rvm_path/hooks"} \
+ ${rvm_lib_path:="$rvm_path/lib"} \
+ ${rvm_log_path:="$rvm_path/log"} \
+ ${rvm_patches_path:="$rvm_path/patches"} \
+ ${rvm_repos_path:="$rvm_path/repos"} \
+ ${rvm_rubies_path:="$rvm_path/rubies"} \
+ ${rvm_rubygems_path:="$rvm_path/rubygems"} \
+ ${rvm_src_path:="$rvm_path/src"} \
+ ${rvm_tmp_path:="$rvm_path/tmp"} \
+ ${rvm_user_path:="$rvm_path/user"} \
+ ${rvm_usr_path:="$rvm_path/usr"} \
+ ${rvm_wrappers_path:="$rvm_path/wrappers"}
[[ -n "${rvm_archflags:-}" ]] && rvm_make_flags_flag=1
rvm_gems_cache_path="${rvm_gems_cache_path:-"${rvm_gems_path:-"$rvm_path/gems"}/cache"}"
-if [[ ${rvm_trace_flag:-0} -gt 0 ]]; then
-
+if (( ${rvm_trace_flag:-0} > 0 ))
+then
export rvm_trace_flag=1
set -o xtrace
# set -o errexit
- # set -o noclobber
- # set -o nounset
- if [[ -z "${ZSH_VERSION:-}" ]] ; then
+ if [[ -z "${ZSH_VERSION:-}" ]]
+ then
# set -o errtrace
# set -o pipefail
export PS4="+ \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
fi
-elif [[ ${rvm_debug_flag:-0} > 0 ]] ; then
+elif [[ ${rvm_debug_flag:-0} > 0 ]]
+then
rvm_debug_flag=0
fi
View
18 scripts/selector
@@ -21,17 +21,17 @@ __rvm_select()
rvm_archive_extension="tar.gz"
- if [[ -z "${rvm_ruby_interpreter:-""}" ]] ; then
+ [[ -n "${rvm_ruby_interpreter:-""}" ]] ||
rvm_ruby_interpreter="${rvm_ruby_string//-*/}"
- fi
case "$rvm_ruby_interpreter" in
macruby)
if [[ "Darwin" = "$(uname)" ]] ; then
- rvm_ruby_package_name=${rvm_ruby_interpreter}-${rvm_ruby_version}
+ rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
- if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
+ if (( rvm_head_flag == 1 ))
+ then
rvm_ruby_version="" ; rvm_ruby_tag=""
rvm_ruby_revision="head"
__rvm_db "macruby_repo_url" "rvm_ruby_repo_url"
@@ -61,7 +61,8 @@ __rvm_select()
rvm_ruby_version=${rvm_ruby_version:-$(__rvm_db "rbx_version")}
rvm_ruby_repo_url=${rvm_rbx_repo_url:-$(__rvm_db "rubinius_repo_url")}
- if [[ ${rvm_head_flag:-0} -eq 0 ]] ; then
+ if (( rvm_head_flag == 0 ))
+ then
rvm_ruby_patch_level=${rvm_ruby_patch_level:-$(__rvm_db "rbx_patch_level")}
rvm_ruby_string="${rvm_ruby_string/-prc/-rc}"
rvm_ruby_string="$(echo "$rvm_ruby_string" | \sed 's#-p*#-#')"
@@ -78,7 +79,7 @@ __rvm_select()
jruby)
rvm_ruby_patch_level=""
- if (( rvm_head_flag == 1))
+ if (( rvm_head_flag == 1 ))
then
rvm_ruby_version="head"
rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
@@ -214,7 +215,7 @@ __rvm_select()
current)
ruby_binary="$(command -v ruby)"
- if [[ $? -eq 0 ]] && match "$ruby_binary" "*rvm*"
+ if (( $? == 0)) && match "$ruby_binary" "*rvm*"
then
rvm_ruby_string="$(dirname "$ruby_binary" | xargs dirname | xargs basename)"
else
@@ -398,7 +399,7 @@ __rvm_use()
local environment_id="$(__rvm_environment_identifier)"
- if (( rvm_default_flag == 1 )) && "default" != "${rvm_ruby_interpreter:-""}" ]]
+ if (( rvm_default_flag == 1 )) && [[ "default" != "${rvm_ruby_interpreter:-""}" ]]
then
if [[ ${rvm_user_install:-""} -eq 0 ]]
then
@@ -496,6 +497,7 @@ __rvm_ruby_string()
# * rvm_ruby_tag
local ruby_string gemset_name
+ __rvm_default_flags
rvm_expanding_aliases=${rvm_expanding_aliases:-0}
Please sign in to comment.
Something went wrong with that request. Please try again.