Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bugfix: rvm gems(et) commands now work again.

  • Loading branch information...
commit b01edc740adc95eec95753df9a1d4aff4d8a0751 1 parent 5fa9bf2
@wayneeseguin wayneeseguin authored
Showing with 42 additions and 32 deletions.
  1. +15 −11 scripts/cli
  2. +19 −17 scripts/gems
  3. +8 −4 scripts/utility
View
26 scripts/cli
@@ -58,11 +58,11 @@ __rvm_parse_args() {
gems|gemset)
rvm_action="gems"
- if [[ "name" = "$1" ]] || [[ "dir" = "$1" ]] || [[ "list" = "$1" ]] || [[ "empty" = "$1" ]] || [[ "delete" = "$1" ]] ; then
- export rvm_${1}_flag=1 ; shift
- elif [[ "dump" = "$1" ]] || [[ "$1" = "load" ]] ; then
- export rvm_${1}_flag=1 ; shift
+ if [[ "name" = "$1" ]] || [[ "dir" = "$1" ]] || [[ "list" = "$1" ]] || [[ "empty" = "$1" ]] || [[ "delete" = "$1" ]] || [[ "dump" = "$1" ]] || [[ "load" = "$1" ]] ; then
+ rvm_ruby_args="$*"
+ #export rvm_${1}_flag=1 ; shift
else
+ rvm_gem_set_name="$1" ; shift
export rvm_use_flag=1 # Default is to use the (named) gem set.
fi
;;
@@ -74,11 +74,6 @@ __rvm_parse_args() {
if [[ "user" = "$1" ]] ; then export rvm_user_flag=1 ; shift ; fi
;;
- --load|load|dump|clear)
- rvm_action="gems"
- export rvm_${rvm_token}_flag=1
- ;;
-
-S|-e)
rvm_action="ruby"
rvm_ruby_args="$rvm_token $@"
@@ -362,7 +357,6 @@ rvm() {
result=0
case "$rvm_action" in
use) __rvm_use ; result=$? ;;
- gemdir) $rvm_scripts_path/gems gemdir ; result=$? ;;
srcdir) __rvm_source_dir ; result=$? ;;
list) __rvm_list ; result=$? ;;
version) __rvm_version ; result=$? ;;
@@ -373,8 +367,18 @@ rvm() {
usage|help) __rvm_usage ; result=$? ;;
benchmark) __rvm_benchmark ; result=$? ;;
inspect) __rvm_inspect ; result=$? ;;
- gems) $rvm_scripts_path/gems ${rvm_ruby_file:-$rvm_ruby_args} ; result=$? ;;
ruby|gem|rake) __rvm_do ; result=$? ;;
+ gemdir) $rvm_scripts_path/gems gemdir ; result=$? ;;
+ gems)
+ if [[ "$rvm_use_flag" -eq 1 ]] ; then
+ __rvm_gems_select
+ __rvm_gems_use
+ else
+ $rvm_scripts_path/gems $rvm_ruby_args
+ fi
+ result=$?
+ ;;
+
monitor)
export rvm_ruby_version rvm_ruby_string
$rvm_scripts_path/monitor ; result=$?
View
36 scripts/gems
@@ -1,8 +1,10 @@
#!/usr/bin/env bash
-source $rvm_path/scripts/rvm
-#source $rvm_path/scripts/utility
-#source $rvm_path/scripts/selector
+#source $rvm_path/scripts/rvm
+source $rvm_path/scripts/utility
+source $rvm_path/scripts/selector
+rvm_ruby_string="${rvm_ruby_string:-system}"
+__rvm_select
if [[ "$rvm_trace_flag" -eq 1 ]] ; then set -x ; export rvm_trace_flag ; fi
@@ -17,9 +19,11 @@ __rvm_gems_dir() {
}
__rvm_gems_list() {
- for gemdir in "$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version%"* ; do
- echo "$gemdir" | awk -F'%' '{print $2}'
- done
+ if [[ $rvm_dir =~ rvm ]] ; then
+ for gemdir in $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version%* ; do
+ echo "$gemdir" | awk -F'%' '{print $2}'
+ done
+ fi
}
__rvm_gems_delete() {
@@ -235,24 +239,22 @@ if [[ -z "$(which gem 2>/dev/null)" ]] ; then
return 1
fi
-if [[ "$rvm_clear_flag" -eq 1 ]] ; then
- __rvm_gems_clear
-elif [[ "$rvm_load_flag" -eq 1 ]] ; then
+if [[ "load" = "$1" ]] ; then
__rvm_gems_load
-elif [[ "$rvm_dump_flag" -eq 1 ]] ; then
+elif [[ "dump" = "$1" ]] ; then
__rvm_gems_dump
-elif [[ "$rvm_delete_flag" -eq 1 ]] ; then
+elif [[ "delete" = "$1" ]] ; then
__rvm_gems_delete
-elif [[ "$rvm_name_flag" -eq 1 ]] ; then
+elif [[ "name" = "$1" ]] ; then
__rvm_gems_name
-elif [[ "$rvm_dir_flag" -eq 1 ]] ; then
+elif [[ "dir" = "$1" ]] ; then
__rvm_gems_dir
-elif [[ "$rvm_list_flag" -eq 1 ]] ; then
+elif [[ "list" = "$1" ]] ; then
__rvm_gems_list
-elif [[ "$rvm_gemdir_flag" -eq 1 ]] ; then
+elif [[ "gemdir" = "$1" ]] ; then
__rvm_gems_gemdir
-elif [[ "$rvm_install_flag" -eq 1 ]] ; then
+elif [[ "install" = "$1" ]] ; then
__rvm_gem_install
else
- gem $*
+ $rvm_scripts_path/log "error" "gems must be passed an action as the first parameter {load,dump,delete,name,list,gemdir,install}"
fi
View
12 scripts/utility
@@ -681,10 +681,14 @@ __rvm_gems_select() {
}
__rvm_gems_use() {
- mkdir -p "$rvm_ruby_gem_home"
- GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME
- GEM_PATH="$GEM_HOME" ; export GEM_PATH
- __rvm_use
+ if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi
+
+ if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
+ mkdir -p "$rvm_ruby_gem_home"
+ GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME
+ GEM_PATH="$GEM_HOME" ; export GEM_PATH
+ __rvm_use
+ fi
}
__rvm_gems_clear() {
Please sign in to comment.
Something went wrong with that request. Please try again.