Skip to content

Commit

Permalink
Let us be more direct, shall we?
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed Sep 6, 2010
1 parent 1f96cca commit fe0bca9
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 24 deletions.
6 changes: 3 additions & 3 deletions binscripts/rvmsudo
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

prefix="PATH='$PATH'"
if [[ -n "${BUNDLE_PATH+x}" ]] ; then prefix="BUNDLE_PATH='$BUNDLE_PATH' $prefix" ; fi
if [[ -n "${GEM_HOME+x}" ]] ; then prefix="GEM_HOME='$GEM_HOME' $prefix" ; fi
if [[ -n "${GEM_PATH+x}" ]] ; then prefix="GEM_PATH='$GEM_PATH' $prefix" ; fi
if [[ -n "${BUNDLE_PATH:-""}" ]] ; then prefix="BUNDLE_PATH='$BUNDLE_PATH' $prefix" ; fi
if [[ -n "${GEM_HOME:-""}" ]] ; then prefix="GEM_HOME='$GEM_HOME' $prefix" ; fi
if [[ -n "${GEM_PATH:-""}" ]] ; then prefix="GEM_PATH='$GEM_PATH' $prefix" ; fi

eval "sudo" "/usr/bin/env $prefix $@"
# rvm_env_prefix="PATH='$PATH'"
Expand Down
2 changes: 1 addition & 1 deletion scripts/array
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

if [[ -n "${ZSH_VERSION+x}" ]] ; then __array_start=1 ; else __array_start=0 ; fi
if [[ -n "${ZSH_VERSION:-""}" ]] ; then __array_start=1 ; else __array_start=0 ; fi

# Usage: contains "a_string" "${an_array[@]}"
array_contains() {
Expand Down
2 changes: 1 addition & 1 deletion scripts/cd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# To disable this fature, set rvm_project_rvmrc=0 in $HOME/.rvmrc
rvm_project_rvmrc=${rvm_project_rvmrc:-1}
if [[ $rvm_project_rvmrc -ne 0 ]] ; then
if [[ -n "${ZSH_VERSION+x}" ]] ; then
if [[ -n "${ZSH_VERSION:-""}" ]] ; then
autoload is-at-least
if is-at-least 4.3.4 >/dev/null 2>&1; then
# On zsh, use chpwd_functions
Expand Down
4 changes: 2 additions & 2 deletions scripts/cli
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ __rvm_parse_args() {
--install) rvm_install_on_use_flag=1 ;;
--trace)
rvm_trace_flag=1
if [[ -z "${ZSH_VERSION+x}" ]] ; then
if [[ -z "${ZSH_VERSION:-""}" ]] ; then
local option="" ;
for option in verbose xtrace errexit errtrace noclobber nounset pipefail ; do
set -o $option
Expand Down Expand Up @@ -494,7 +494,7 @@ rvm() {
*) rvm_interactive_flag=0 ;;
esac ; export rvm_interactive_flag

if [[ -z "${ZSH_VERSION+x}" ]] ; then
if [[ -z "${ZSH_VERSION:-""}" ]] ; then
trap '\rm -rf "$rvm_tmp_path/$$" >/dev/null 2>&1' 0 1 2 3 15
fi

Expand Down
2 changes: 2 additions & 0 deletions scripts/env
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi

# Recursive loops, oh my!
unset rvm_default_flag

Expand Down
5 changes: 2 additions & 3 deletions scripts/hash
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# we then provide functionality of a file based hash
#

if [[ -z "$rvm_trace_flag" ]] ; then set +x ; else set -x ; fi
if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi

if [[ -n "${ZSH_VERSION+x}" ]] ; then __array_start=1 ; else __array_start=0 ; fi
if [[ -n "${ZSH_VERSION:-""}" ]] ; then __array_start=1 ; else __array_start=0 ; fi

hash() {
hash_name=$1 ; hash_key=$2 ; hash_value=$3
Expand All @@ -32,6 +32,5 @@ hash() {
eval "_hash_${hash_name}_keys[$index]=\"$hash_key\""
eval "_hash_${hash_name}_values[$index]=\"$hash_value\""
fi
set +x
}

2 changes: 2 additions & 0 deletions scripts/info
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi

source "$rvm_scripts_path/base"
source "$rvm_scripts_path/version"

Expand Down
2 changes: 1 addition & 1 deletion scripts/maglev
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; fi
if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi

system="$(uname -s)"
if [[ $system = "SunOS" ]] && [[ "$(uname -m)" = "i86pc" ]] ; then system="Solaris-x86" ; fi
Expand Down
2 changes: 2 additions & 0 deletions scripts/manage
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi

original_ruby_version=$rvm_ruby_version
original_ruby_string=$rvm_ruby_string

Expand Down
2 changes: 1 addition & 1 deletion scripts/md5
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

if [[ "$rvm_trace_flag" -eq 1 ]] ; then set -x ; export rvm_trace_flag ; fi
if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi

args=($*)
file="${args[0]}"
Expand Down
3 changes: 3 additions & 0 deletions scripts/package
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash

if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi

rvm_base_except="selector"
source "$rvm_scripts_path/base"

Expand Down
6 changes: 3 additions & 3 deletions scripts/selector
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ __rvm_gemset_select() {
# No longer defaulting to 'sticky' gem sets.
# Set 'rvm_sticky_flag=1' in ~/.rvmrc to enable.
if [[ $rvm_sticky_flag -eq 1 ]] ; then
if [[ -n "${GEM_HOME+x}" ]] ; then
if [[ -n "${GEM_HOME:-""}" ]] ; then
rvm_gemset_name=$(echo $GEM_HOME | xargs basename | awk -F${rvm_gemset_separator} '{print $2}')
fi

Expand All @@ -565,9 +565,9 @@ __rvm_gemset_select() {
else
if [[ -n "$rvm_ruby_string" ]] && [[ "$rvm_ruby_interpreter" != "system" ]] ; then
rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string"
elif [[ -z "${GEM_HOME+x}" ]] && [[ -n "$(command -v gem)" ]] ; then
elif [[ -z "${GEM_HOME:-""}" ]] && [[ -n "$(command -v gem)" ]] ; then
rvm_ruby_gem_home=$(gem env gemdir)
elif [[ -n "${GEM_HOME+x}" ]] ; then
elif [[ -n "${GEM_HOME:-""}" ]] ; then
rvm_ruby_gem_home="$GEM_HOME"
else
rvm_ruby_gem_home=""
Expand Down
6 changes: 3 additions & 3 deletions scripts/set
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ __rvm_summary() {
summary="$summary \033[0;31m${#errors[*]} errors: $(echo "${errors[*]}" | sed 's# #, #g')\033[0m\n"
fi
total=${#rubies[*]}
if [[ -n "${ZSH_VERSION+x}" ]] ; then array_start=1 ; else array_start=0 ; fi
if [[ -n "${ZSH_VERSION:-""}" ]] ; then array_start=1 ; else array_start=0 ; fi

printf "$summary" | tee -a log/summary.log
return ${#errors[*]}
Expand All @@ -115,7 +115,7 @@ __rvm_yaml() {
for var in ${errors[*]} ; do yaml="$yaml\n - $var" ; done
yaml="$yaml\nrubies:"
total=${#rubies[*]}
if [[ -n "${ZSH_VERSION+x}" ]] ; then array_start=1 ; else array_start=0 ; fi
if [[ -n "${ZSH_VERSION:-""}" ]] ; then array_start=1 ; else array_start=0 ; fi
for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
if [[ ! -z "$rvm_debug_flag" ]] ; then
"$rvm_scripts_path/log" "debug" "${rubies[$index]}: ${statuses[$index]}"
Expand All @@ -137,7 +137,7 @@ __rvm_json() {
json="$json\n \"rubies\": {"

total=${#rubies[*]}
if [[ -n "${ZSH_VERSION+x}" ]] ; then array_start=1 ; else array_start=0 ; fi
if [[ -n "${ZSH_VERSION:-""}" ]] ; then array_start=1 ; else array_start=0 ; fi

for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
if [[ ! -z "$rvm_debug_flag" ]] ; then
Expand Down
10 changes: 5 additions & 5 deletions scripts/utility
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__rvm_setup() {
# ZSH has 1 based array indexing, bash has 0 based.
if [[ -n "${ZSH_VERSION+x}" ]] ; then
if [[ -n "${ZSH_VERSION:-""}" ]] ; then
__shell_array_start=1
# Set clobber for zsh users, for compatibility with bash's append operator ( >> file ) behavior
setopt | \grep -qs '^noclobber$'
Expand All @@ -18,7 +18,7 @@ __rvm_teardown() {
declare rvm_clang_flag=${rvm_clang_flag:-0}
declare rvm_prior_cc=${rvm_prior_cc:-""}

if [[ -n "${ZSH_VERSION+x}" ]] ; then
if [[ -n "${ZSH_VERSION:-""}" ]] ; then
if [[ "$rvm_zsh_clobber" -eq 0 ]] ; then
setopt noclobber
fi ; unset rvm_zsh_clobber
Expand Down Expand Up @@ -85,8 +85,8 @@ __rvm_ruby_string_paths_under() {
__rvm_db() {
local value="" key="" variable=""

key=${1+x}
variable=${2+x}
key=${1:-""}
variable=${2:-""}

if [[ -f "$rvm_config_path/user" ]] ; then
value="$($rvm_scripts_path/db "$rvm_config_path/user" "$key")"
Expand All @@ -97,7 +97,7 @@ __rvm_db() {
fi

if [[ -n "$value" ]] ; then
if [[ -z $variable ]] ; then
if [[ -z "$variable" ]] ; then
echo $value
else
eval "$variable='$value'"
Expand Down
2 changes: 1 addition & 1 deletion test/btu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Public Methods
#

if [[ -n "${ZSH_VERSION+x}" ]] ; then __array_start=1 ; else __array_start=0 ; fi
if [[ -n "${ZSH_VERSION:-""}" ]] ; then __array_start=1 ; else __array_start=0 ; fi

btu_push() {
array=$1 ; shift ; item=$2
Expand Down

0 comments on commit fe0bca9

Please sign in to comment.