scripts/selector in rvm-1.0.7 vs scripts/selector in rvm-1.0.8
- old
+ new
@@ -105,11 +105,11 @@
rvm_gemstone_package_file="GemStone-${rvm_ruby_version}.${system}-${arch}"
rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "maglev_version")"}"
rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
rvm_ruby_url="${rvm_ruby_url:-"$maglev_url/${rvm_ruby_package_file}.${rvm_archive_extension}"}"
rvm_gemstone_url="${rvm_gemstone_url:-"$maglev_url/${rvm_gemstone_package_file}.${rvm_archive_extension}"}"
- export MAGLEV_HOME="$rvm_rubies_path/$rvm_ruby_string"
+ export MAGLEV_HOME="$rvm_path/rubies/$rvm_ruby_string"
fi
;;
ironruby)
rvm_ruby_patch_level=""
@@ -216,74 +216,72 @@
rvm_ruby_major_version=${rvm_ruby_version%.*} ; rvm_ruby_major_version=${rvm_ruby_major_version#*.}
rvm_ruby_minor_version="${rvm_ruby_version//*.}"
fi
rvm_ruby_package_name="${rvm_ruby_package_name:-${rvm_ruby_string//-n*}}"
- rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_string"
- rvm_ruby_log_path="$rvm_log_path/$rvm_ruby_string"
- rvm_ruby_repo_path="$rvm_repo_path/$rvm_ruby_string"
- rvm_ruby_src_path="$rvm_src_path/$rvm_ruby_string"
+ rvm_ruby_home="$rvm_path/rubies/$rvm_ruby_string"
rvm_ruby_binary="$rvm_ruby_home/bin/ruby"
rvm_ruby_irbrc="$rvm_ruby_home/.irbrc"
- rvm_ruby_gem_home="${rvm_gems_path}/${rvm_ruby_string}"
- rvm_ruby_gem_path="${rvm_ruby_gem_home}:${rvm_ruby_gem_home}@global"
if [[ "maglev" = "$rvm_ruby_interpreter" ]] ; then
export MAGLEV_HOME="$rvm_ruby_home"
export GEMSTONE_GLOBAL_DIR=$MAGLEV_HOME
fi
+ rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}"
+
if [[ ! -z "$rvm_gemset_name" ]] ; then
rvm_ruby_gem_home="${rvm_ruby_gem_home}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
- rvm_ruby_gem_path="${rvm_ruby_gem_home}:${rvm_gems_path}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}global"
+ rvm_ruby_gem_path="${rvm_ruby_gem_home}:${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}global"
fi
+ rvm_ruby_global_gems_path="${rvm_ruby_gem_home%%${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}global"
+ rvm_ruby_gem_path="${rvm_ruby_gem_home}:${rvm_ruby_global_gems_path}"
+
rvm_ruby_selected_flag=1
- \mkdir -p "$rvm_ruby_log_path"
+ if [[ ! -d "{rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string" ]] ; then
+ \mkdir -p "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string"
+ fi
- export rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_url rvm_ruby_patch_level rvm_ruby_configure rvm_configure_flags rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_ruby_release_version rvm_ruby_major_version rvm_ruby_minor_version rvm_gemset_name rvm_gems_path rvm_ruby_gem_home rvm_path rvm_src_path rvm_bin_path rvm_ruby_binary rvm_ruby_home rvm_log_path rvm_ruby_log_path rvm_src_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_string
+ export rvm_head_flag $(env | awk -F= -v ORS=' ' '/^rvm_/{print $1}')
+
else
rvm_ruby_interpreter="${rvm_ruby_interpreter:-system}"
fi
}
__rvm_use() {
- rvm_gemset_name="${rvm_gemset_name:-""}"
- rvm_ruby_gem_home="${rvm_ruby_gem_home:-""}"
- rvm_wrapper_name="${rvm_wrapper_name:-""}"
- rvm_ruby_alias="${rvm_ruby_alias:-""}"
+ local new_path binary full_binary_path rvm_ruby_gem_home
- local new_path binary full_binary_path
-
if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select "$@" ; fi
if [[ -z "${rvm_ruby_interpreter:-""}" ]] ; then rvm_ruby_interpreter="system" ; fi
if [[ "system" = "$rvm_ruby_interpreter" ]] ; then
unset GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
- new_path="$rvm_bin_path:$(__rvm_remove_rvm_from_path ; printf "$PATH")"
+ new_path="${rvm_bin_path:-"$rvm_path/bin"}:$(__rvm_remove_rvm_from_path ; printf "$PATH")"
- if [[ -s $rvm_config_path/system ]] ; then
+ if [[ -s $rvm_path/config/system ]] ; then
- \grep "MY_RUBY_HOME='$rvm_rubies_path" "$rvm_config_path/system" > /dev/null
+ \grep "MY_RUBY_HOME='$rvm_path/rubies" "$rvm_path/config/system" > /dev/null
if [[ $? -eq 0 ]] ; then
- [[ -f "$rvm_config_path/system" ]] && \rm -f $rvm_config_path/system # 'system' should *not* point to an rvm ruby.
+ [[ -f "$rvm_path/config/system" ]] && \rm -f $rvm_path/config/system # 'system' should *not* point to an rvm ruby.
else
- source "$rvm_config_path/system"
+ source "$rvm_path/config/system"
fi
fi
# Check binaries, remove under the condition they're symlinks.
if [[ "$rvm_selfcontained" = "0" ]] ; then
for binary in ruby gem irb ri rdoc rake erb testrb ; do
- full_binary_path="$rvm_bin_path/$binary"
+ full_binary_path="${rvm_bin_path:-"$rvm_path/bin"}/$binary"
[[ -L "$full_binary_path" ]] && \rm -f "$full_binary_path"
done
fi
@@ -293,11 +291,11 @@
export rvm_ruby_string="system"
else
GEM_HOME="$rvm_ruby_gem_home"
- GEM_PATH="$rvm_ruby_gem_path"
+ GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
BUNDLE_PATH="$rvm_ruby_gem_home"
MY_RUBY_HOME="$rvm_ruby_home"
RUBY_VERSION="$rvm_ruby_string"
IRBRC="$rvm_ruby_irbrc"
@@ -323,11 +321,11 @@
[[ ${rvm_verbose_flag:-0} -gt 0 ]] && \
"$rvm_path/scripts/log" "info" \
"Using ${GEM_HOME/${rvm_gemset_separator:-'@'}/ with gemset }"
- new_path="$GEM_HOME/bin:$rvm_ruby_global_gems_path/bin:$MY_RUBY_HOME/bin:$rvm_bin_path:$(__rvm_remove_rvm_from_path ; printf "$PATH")"
+ new_path="$GEM_HOME/bin:$rvm_ruby_global_gems_path/bin:$MY_RUBY_HOME/bin:${rvm_bin_path:-"$rvm_path/bin"}:$(__rvm_remove_rvm_from_path ; printf "$PATH")"
fi
# Export ruby string and gem set me for extrenal scripts to take advantage of them.
if [[ -n "${rvm_ruby_string:-""}" ]] ; then export rvm_ruby_string ; fi
@@ -343,31 +341,31 @@
local environment_id="$(__rvm_environment_identifier)"
if [[ ${rvm_default_flag:-0} -eq 1 && "default" != "${rvm_ruby_interpreter:-""}" ]] ; then
- if [[ "${rvm_selfcontained:-""}" = "0" ]] ; then
+ if [[ ${rvm_selfcontained:-""} -eq 0 ]] ; then
# Sets up the default wrappers.
"$rvm_path/scripts/wrapper" "$rvm_ruby_string" --no-prefix
else
- "$rvm_path/scripts/wrapper" "$rvm_path/scripts" "default"
+ "$rvm_path/scripts/wrapper" "$rvm_ruby_string" "default"
fi
if [[ "system" = "$rvm_ruby_interpreter" ]] ; then
"$rvm_path/scripts/alias" delete default &> /dev/null
- \find "$rvm_bin_path" -name 'default_*' -maxdepth 0 -delete
- \rm -f "$rvm_config_path/default"
- \rm -f "$rvm_environments_path/default"
- \rm -rf "$rvm_wrappers_path/default"
+ \find "${rvm_bin_path:-"$rvm_path/bin"}" -name 'default_*' -maxdepth 0 -delete
+ \rm -f "$rvm_path/config/default"
+ \rm -f "$rvm_path/environments/default"
+ \rm -rf "$rvm_path/wrappers/default"
else
RUBY_VERSION="$("$rvm_ruby_home/bin/ruby" -v | sed 's#^\(.*\) (.*$#\1#')"
export GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION
"$rvm_path/scripts/alias" delete default &> /dev/null
"$rvm_path/scripts/alias" create default "$environment_id" >& /dev/null
- \ln -nfs "$rvm_environments_path/$environment_id" "$rvm_environments_path/default"
- \ln -nfs "$rvm_wrappers_path/$environment_id" "$rvm_wrappers_path/default"
+ \ln -nfs "$rvm_path/environments/$environment_id" "$rvm_path/environments/default"
+ \ln -nfs "$rvm_path/wrappers/$environment_id" "$rvm_path/wrappers/default"
fi
fi
rvm_default_flag=0
@@ -442,12 +440,13 @@
if [[ ${#strings[@]} -eq 0 ]] ; then
if echo "${GEM_HOME:-""}" | grep -q "rvm" ; then
# Current Ruby
strings="${GEM_HOME##*\/}"
- strings=("${strings/%${rvm_gemset_separator:-"@"}*}")
- rvm_ruby_string=${strings[@]:(1)}
+ strings="${strings/%${rvm_gemset_separator:-"@"}*}"
+ rvm_ruby_string="$strings"
+ strings=(${strings//-/ })
else
strings=(system)
rvm_ruby_string="system"
fi
fi
@@ -639,11 +638,11 @@
command -v gem > /dev/null
if [[ $? -gt 0 ]] ; then return 0 ; fi # Stop if no 'gem' command is available.
rvm_ruby_gem_home=${rvm_ruby_gem_home:-""}
rvm_gemset_name=${rvm_gemset_name:-""}
- rvm_ruby_global_gems_path="$rvm_path/gems/${rvm_ruby_string:-""}${rvm_gemset_separator:-"@"}global"
+ rvm_ruby_global_gems_path="${rvm_ruby_gem_home%%${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}global"
if [[ -z "${rvm_gemset_name:-""}" ]] ; then
# No longer defaulting to 'sticky' gem sets.
# Set 'rvm_sticky_flag=1' in ~/.rvmrc to enable.
@@ -658,15 +657,15 @@
fi
fi
if ! echo "${rvm_gemset_name:-""}" | grep -q "^[[:digit:]]\.[[:digit:]]" ; then
- rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
+ rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
else
if [[ -n "${rvm_ruby_string:-""}" && "${rvm_ruby_interpreter:-""}" != "system" ]] ; then
- rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string"
+ rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/$rvm_ruby_string"
elif [[ -z "${GEM_HOME:-""}" && -n "$(command -v gem)" ]] ; then
rvm_ruby_gem_home=$(gem env gemdir)
elif [[ -n "${GEM_HOME:-""}" ]] ; then
@@ -684,14 +683,14 @@
fi
if [[ -n "${rvm_ruby_string:-""}" ]] ; then
if [[ -z "${rvm_ruby_gem_home:-""}" || -n "${gemset:-""}" ]] ; then
- rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
+ rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
elif [[ -n "${gemset:-""}" && "${rvm_gemset_name:-""}" != "${gemset:-""}" ]] ; then
- rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
+ rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
fi
else
"$rvm_path/scripts/log" "error" "Gemsets can not be used with non rvm controlled rubies (currently)."
return 1
fi
@@ -712,12 +711,12 @@
elif [[ ${rvm_delete_flag:-0} -eq 1 ]] ; then
return 1
fi
if [[ -z "${rvm_ruby_gem_home:-""}" && -n "${rvm_ruby_string:-""}" ]] ; then
- rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string"
- rvm_ruby_global_gems_path="$rvm_gems_path/$rvm_ruby_string${rvm_gemset_separator:-"@"}global"
+ rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/$rvm_ruby_string"
+ rvm_ruby_global_gems_path="${rvm_ruby_gem_home%%${rvm_gemset_separator}*}${rvm_gemset_separator:-"@"}global"
fi
rvm_ruby_gem_path="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
# Ensure that the ruby gem home exists.
@@ -757,11 +756,11 @@
fi
rvm_ruby_gem_home="${GEM_HOME//${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
GEM_HOME="$rvm_ruby_gem_home"
BUNDLE_PATH="$rvm_ruby_gem_home"
- GEM_PATH="$rvm_ruby_gem_home/bin:$(echo "$GEM_HOME" | sed 's/'${rvm_gemset_separator:-"@"}'.*$//')${rvm_gemset_separator:-"@"}global/bin"
+ GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
export rvm_ruby_gem_home GEM_HOME BUNDLE_PATH GEM_PATH
__rvm_use # Now ensure the selection takes effect for the environment.
fi
@@ -769,13 +768,13 @@
}
__rvm_gemset_clear() {
rvm_gemset_name="" ; shift # TODO: Is this shift necessary???
rvm_ruby_gem_home="${GEM_HOME//${rvm_gemset_separator:-"@"}*}"
- rvm_ruby_global_gems_path="$(echo "${GEM_HOME:-""}" | sed 's/'${rvm_gemset_separator:-"@"}'.*$//')${rvm_gemset_separator:-"@"}global"
+ rvm_ruby_global_gems_path="${rvm_ruby_gem_home%%${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}global"
GEM_HOME=$rvm_ruby_gem_home
BUNDLE_PATH="$rvm_ruby_gem_home"
- GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin"
+ GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
export rvm_ruby_gem_home rvm_ruby_global_gems_path GEM_HOME BUNDLE_PATH GEM_PATH
__rvm_use # Now ensure the selection takes effect for the environment.
}