scripts/utility in rvm-0.1.33 vs scripts/utility in rvm-0.1.34
- old
+ new
@@ -1,10 +1,30 @@
#!/usr/bin/env bash
-# ZSH has 1 based array indexing, bash has 0 based.
-if [[ ! -z "$ZSH_VERSION" ]] ; then __shell_array_start=1 ; else __shell_array_start=0 ; fi
+__rvm_setup() {
+ # ZSH has 1 based array indexing, bash has 0 based.
+ if [[ ! -z "$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$'
+ rvm_zsh_clobber=$?
+ setopt clobber
+ else
+ __shell_array_start=0
+ fi ; export __shell_array_start
+}
+__rvm_teardown() {
+ if [[ ! -z "$ZSH_VERSION" ]] ; then
+ if [[ "$rvm_zsh_clobber" -eq 0 ]] ; then
+ setopt noclobber
+ fi ; unset rvm_zsh_clobber
+ else
+ :
+ fi
+}
+
# Query the rvm key-value database for a specific key
# Allow overrides from user specifications in $rvm_config_path/user
__rvm_db() {
key=$1 ; variable=$2
if [[ -f "$rvm_config_path/user" ]] ; then
@@ -467,28 +487,12 @@
rvm_ruby_global_gems_path="$rvm_gems_path/$rvm_ruby_string${rvm_gemset_separator}global"
fi
rvm_ruby_gem_path="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
- # Careful not to nuke system gems cache.
- if [[ ! -z "$rvm_ruby_gem_home" ]] && [[ ! -z "$(echo $rvm_ruby_gem_home | awk '/rvm/')" ]] ; then
- # Ensure that the ruby gem home exists.
- mkdir -p "$rvm_ruby_gem_home"
-
- # If there is a cache *directory* already,
- # move all the gems to the global cache directory and remove it.
- if [[ -d "$rvm_ruby_gem_home/cache" ]] && [[ ! -L "$rvm_ruby_gem_home/cache" ]] ; then
- if [[ ! -z "$(\ls -A "$rvm_ruby_gem_home"/cache/)" ]] ; then
- mv "$rvm_ruby_gem_home"/cache/* "$HOME"/.gem/cache/
- fi
- rmdir "$rvm_ruby_gem_home"/cache
- fi
-
- # If the ruby's gems cache directory is not a symlink to the global cache, symlink it
- if [[ ! -L "$rvm_ruby_gem_home/cache" ]] ; then
- ln -nfs "$HOME/.gem/cache" "$rvm_ruby_gem_home/cache"
- fi
- fi ; export rvm_ruby_gem_path rvm_ruby_gem_home
+ # Ensure that the ruby gem home exists.
+ mkdir -p "$rvm_ruby_gem_home"
+ export rvm_ruby_gem_path rvm_ruby_gem_home
}
# Use a gemset specified by 'rvm_ruby_gem_home'
__rvm_gemset_use() {
#if [[ -z "$(echo $rvm_ruby_gem_home | grep "rvm")" ]] ; then