scripts/gems in rvm-0.0.82 vs scripts/gems in rvm-0.0.83
- old
+ new
@@ -1,8 +1,10 @@
#!/usr/bin/env bash
__rvm_gems_select() {
+ if [[ -z "$(which gem 2>/dev/null)" ]] ; then return 0 ; fi
+
if [[ -z "$rvm_gem_set_name" ]] ; then
if [[ ! -z "$GEM_HOME" ]] ; then
rvm_gem_set_name=$(echo $GEM_HOME | xargs basename | awk -F'%' '{print $2}')
fi
@@ -13,16 +15,16 @@
if [[ ! -z "$rvm_gem_set_name" ]] && ! $rvm_scripts_path/match "$rvm_gem_set_name" "^[0-9]\.[0-9]" ; then
rvm_ruby_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version%$rvm_gem_set_name"
else
if [[ ! -z "$rvm_ruby_interpreter" ]] && [[ ! -z "$rvm_ruby_version" ]] && [[ "$rvm_ruby_interpreter" != "system" ]] ; then
rvm_ruby_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version"
- elif [[ -z "$GEM_HOME" ]] ; then
+ elif [[ -z "$GEM_HOME" ]] && [[ ! -z "$(which gem 2>/dev/null)" ]] ; then
rvm_ruby_gem_home=$(gem env gemdir)
elif [[ ! -z "$GEM_HOME" ]] ; then
rvm_ruby_gem_home="$GEM_HOME"
else
- $rvm_scripts_path/log "error" "Cannot select gem home, something definitely wrong :/"
+ unset rvm_ruby_gem_home
fi
fi
if [[ -z "$rvm_gem_set_name" ]] ; then unset rvm_gem_set_name ; fi
else
rvm_ruby_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version%$rvm_gem_set_name"
@@ -241,10 +243,11 @@
$rvm_scripts_path/log "error" "$rvm_file_name does not exist to load from."
fi
}
__rvm_gemdir() {
+
if [[ "$rvm_user_flag" -eq 1 ]] ; then
echo $(rvm system ; gem env | grep $HOME | awk '{print $NF}')
elif [[ "$rvm_system_flag" -eq 1 ]] ; then
echo $(rvm system ; gem env gemdir system)
elif [[ ! -z "$rvm_ruby_string" ]] ; then
@@ -257,9 +260,14 @@
}
__rvm_gems() {
unset GEM_PATH
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi
+
+ if [[ -z "$(which gem 2>/dev/null)" ]] ; then
+ $rvm_scripts_path/log "error" "'gem' was not found, cannot perform gem actions."
+ return 1
+ fi
if [[ ! -z "$rvm_clear_flag" ]] ; then
__rvm_gems_clear
elif [[ ! -z "$rvm_load_flag" ]] ; then
__rvm_gems_load