scripts/cli in rvm-0.1.27 vs scripts/cli in rvm-0.1.29
- old
+ new
@@ -6,11 +6,11 @@
if echo "$@" | grep -q 'trace' ; then echo "$@" ; __rvm_version ; fi
while [[ $# -gt 0 ]] ; do
rvm_token="$1" ; shift
case "$rvm_token" in
- fetch|version|srcdir|reset|debug|reload|implode|seppuku|update|monitor|notes)
+ fetch|version|srcdir|reset|debug|reload|update|monitor|notes|implode|seppuku|question|answer)
rvm_action=$rvm_token
;;
package)
rvm_action="$rvm_token"
@@ -18,11 +18,11 @@
rvm_parse_break=1
;;
use)
rvm_action=$rvm_token
- export rvm_verbose_flag=1
+ rvm_verbose_flag=1
if [[ "ruby" = "$1" ]] ; then shift ; fi
;;
inspect)
rvm_action=$rvm_token
@@ -35,117 +35,117 @@
rvm_action=$rvm_token
;;
rm|remove)
rvm_action="remove"
- export rvm_remove_flag=1
+ rvm_remove_flag=1
;;
# Can likely remove this due to the *) case
jruby|ree|macruby|rbx|rubinius|mput|shyouhei|ironruby|default|maglev|all)
- export rvm_ruby_interpreter="$rvm_token"
- export rvm_ruby_string="$rvm_token"
+ rvm_ruby_interpreter="$rvm_token"
+ rvm_ruby_string="$rvm_token"
rvm_action="${rvm_action:-use}"
if $rvm_scripts_path/match "$1" "^[0-9]\.[0-9]" ; then rvm_ruby_version=$1 ; shift ; fi
;;
gemset)
rvm_action=$rvm_token
- export rvm_ruby_gem_home="$GEM_HOME"
+ rvm_ruby_gem_home="$GEM_HOME"
if [[ "clear" = "$1" ]] ; then
__rvm_gemset_clear
rvm_ruby_args="clear"
elif [[ "use" = "$1" ]] ; then
rvm_use_flag=1
rvm_ruby_args="$@" ; shift
- export rvm_use_flag rvm_ruby_args
- rvm_gemset_name="$1"; shift
+ rvm_gemset_name="$1" ; shift
if [[ ! -z "$(echo $rvm_gemset_name | grep $rvm_gemset_separator)" ]] ; then
rvm_ruby_string=$(echo $rvm_gemset_name | sed 's/\(.*\)'${rvm_gemset_separator}'.*/\1/')
rvm_gemset_name=$(echo $rvm_gemset_name | sed 's/.*'${rvm_gemset_separator}'\(.*\)/\1/')
if [[ "$rvm_ruby_string" != "$rvm_gemset_name" ]] ; then
- export rvm_ruby_string="$rvm_ruby_string${rvm_gemset_separator}$rvm_gemset_name"
- else
- unset rvm_ruby_string
+ rvm_ruby_string="$rvm_ruby_string${rvm_gemset_separator}$rvm_gemset_name"
fi
- export rvm_ruby_gem_home="$rvm_ruby_gem_home${rvm_gemset_separator}$rvm_gemset_name"
+ rvm_ruby_gem_home="$rvm_ruby_gem_home${rvm_gemset_separator}$rvm_gemset_name"
fi
- if [[ ! -z "$rvm_gemset_name" ]] ; then export rvm_gemset_name ; fi
elif [[ "delete" = "$1" ]] ; then
rvm_delete_flag=1
rvm_ruby_args="$@" ; shift
rvm_gemset_name="$1"; shift
- export rvm_delete_flag rvm_ruby_args rvm_gemset_name
if [[ ! -z "$(echo $rvm_gemset_name | grep $rvm_gemset_separator)" ]] ; then
rvm_ruby_string=$(echo $rvm_gemset_name | sed 's/\(.*\)'${rvm_gemset_separator}'.*/\1/')
rvm_gemset_name=$(echo $rvm_gemset_name | sed 's/.*'${rvm_gemset_separator}'\(.*\)/\1/')
if [[ "$rvm_ruby_string" != "$rvm_gemset_name" ]] ; then
- export rvm_ruby_string="$rvm_ruby_string${rvm_gemset_separator}$rvm_gemset_name"
- else
- unset rvm_ruby_string
+ rvm_ruby_string="$rvm_ruby_string${rvm_gemset_separator}$rvm_gemset_name"
fi
- export rvm_ruby_gem_home="$rvm_ruby_gem_home${rvm_gemset_separator}$rvm_gemset_name"
+ rvm_ruby_gem_home="$rvm_ruby_gem_home${rvm_gemset_separator}$rvm_gemset_name"
fi
- if [[ ! -z "$rvm_gemset_name" ]] ; then export rvm_gemset_name ; fi
else
if [[ -z "$1" ]] ; then
rvm_action="error"
rvm_error_message="'gemset' must be followed by a gemset action, see http://rvm.beginrescueend.com/gemsets/ for details."
else
- if [[ "$rvm_ruby_string" != "$rvm_gemset_name" ]] ; then export rvm_ruby_string ; else unset rvm_ruby_string ; fi
- rvm_ruby_args="$@" ; export rvm_ruby_args
+ if [[ "$rvm_ruby_string" != "$rvm_gemset_name" ]] ; then __rvm_ruby_string ; fi
+ rvm_ruby_args="$@"
fi
fi
rvm_parse_break=1
;;
gemdir)
rvm_action=$rvm_token
rvm_gemdir_flag=1
- if [[ "system" = "$1" ]] ; then export rvm_system_flag=1 ; shift ; fi
- if [[ "user" = "$1" ]] ; then export rvm_user_flag=1 ; shift ; fi
+ if [[ "system" = "$1" ]] ; then rvm_system_flag=1 ; shift ; fi
+ if [[ "user" = "$1" ]] ; then rvm_user_flag=1 ; shift ; fi
;;
- list|info|strings)
+ list|info|docs|alias)
rvm_action="$rvm_token"
- export rvm_ruby_args="$@"
+ rvm_ruby_args="$@"
rvm_parse_break=1
;;
-S)
rvm_action="ruby"
- export rvm_ruby_args="$rvm_token $@"
+ rvm_ruby_args="$rvm_token $@"
rvm_parse_break=1
;;
-e)
rvm_action="ruby"
- export rvm_ruby_args="$rvm_token \"$@\""
+ rvm_ruby_args="$rvm_token \"$@\""
rvm_parse_break=1
;;
do|ruby|rake|gem|rubydo|rakedo|gemdo)
if [[ "do" = "$rvm_action" ]] ; then rvm_action="ruby" ; fi
- export rvm_action=$(echo $rvm_token | sed 's#do##g')
+ rvm_action=$(echo $rvm_token | sed 's#do##g')
if [[ "rake" = "$rvm_action" ]] || [[ "gem" = "$rvm_action" ]] || [[ "ruby" = "$rvm_action" ]] ; then
if [[ -z "$1" ]] ; then
- if [[ "gem" = "$rvm_action" ]] || [[ "ruby" = "$rvm_action" ]] ; then
+ if [[ "gem" = "$rvm_action" ]] ; then
rvm_action="error"
- rvm_error_message="the '$rvm_action' actions must be followed by arguments."
+ rvm_error_message="'rvm $rvm_action' must be followed by arguments."
+ elif [[ "ruby" = "$rvm_action" ]] ; then
+ if [[ -z "$(echo "$rvm_ruby_version" | awk '/,/')" ]] ; then
+ rvm_action="ruby"
+ rvm_ruby_args=""
+ else
+ rvm_action="error"
+ rvm_error_message="rvm X,Y,Z '$rvm_action' must be followed by arguments."
+ fi
fi
elif [[ "-S" = "$1" ]] ; then
- export rvm_action="ruby"
- export rvm_ruby_args="$flag $@"
+ rvm_action="ruby"
+ rvm_ruby_args="$flag $@"
rvm_parse_break=1
elif [[ "-e" = "$1" ]] ; then
- export rvm_action="ruby"
- export rvm_ruby_args="$flag '$@'"
+ rvm_action="ruby"
+ rvm_ruby_args="$flag '$@'"
rvm_parse_break=1
else
- export rvm_ruby_args="$*"
+ rvm_ruby_args="$*"
rvm_parse_break=1
fi
else
if $rvm_scripts_path/match "$1" "^-" ; then
unset rvm_ruby_version
@@ -194,25 +194,25 @@
rvm_error_message="--ree-options *must* be followed by... well... options."
fi
;;
# For use with --patch
- --patch-name) export rvm_ruby_patch_name="$1" ; shift ;;
+ --patch-name) rvm_ruby_patch_name="$1" ; shift ;;
-h|--patch)
if [[ -z "$rvm_ruby_patch" ]] ; then
- export rvm_ruby_patch="$1"
+ rvm_ruby_patch="$1"
else
- export rvm_ruby_patch="$rvm_ruby_patch,$1";
+ rvm_ruby_patch="$rvm_ruby_patch,$1";
fi ; shift
rvm_action="${rvm_action:-use}"
;;
- --head) export rvm_head_flag=1 ;;
+ --head) rvm_head_flag=1 ;;
--bin)
if [[ "update" = "$rvm_action" ]] ; then
- export rvm_bin_flag=1
+ rvm_bin_flag=1
else
rvm_bin_path="$1" ; shift
fi
;;
@@ -226,11 +226,11 @@
fi
;;
-C|--configure)
if [[ ! -z "$1" ]] ; then
- export rvm_ruby_configure_flags="$(echo $1 | tr ',' ' ')"
+ rvm_ruby_configure_flags="$(echo $1 | tr ',' ' ')"
shift
else
rvm_action="error"
rvm_error_message="--configure *must* be followed by configure flags."
fi
@@ -254,23 +254,33 @@
rvm_ruby_load_path="$rvm_ruby_load_path:$1"
shift
fi
;;
+ --rdoc|--yard)
+ rvm_docs_type="$rvm_token"
+ rvm_docs_type
+ ;;
+
-f|--file)
rvm_action="ruby"
rvm_ruby_file="$1"
shift
;;
system|default)
rvm_action=${rvm_action:-use}
- export rvm_ruby_interpreter="$rvm_token"
- export rvm_ruby_string="$rvm_token"
+ rvm_ruby_interpreter="$rvm_token"
+ rvm_ruby_string="$rvm_token"
;;
- -h|--help|usage|help) rvm_action=help ;;
+ help)
+ rvm_action="$rvm_token"
+ rvm_ruby_args="$@"
+ rvm_parse_break=1
+ ;;
+ -h|--help|usage) rvm_action=help ;;
-G|--gems) rvm_gems_path="$1" ; shift ;;
--source) rvm_src_path="$1" ; shift ;;
--archives) rvm_archives_path="$1" ; shift ;;
--make) rvm_ruby_make="$1" ; shift ;;
--make-install) rvm_ruby_make_install="$1" ; shift ;;
@@ -278,56 +288,65 @@
-l|--level) rvm_ruby_patch_level="p$1" ; shift ;;
# TODO: handle this below better (if $1 is null)
--sdk) rvm_sdk="$1" ; shift ;;
--archflags) rvm_archflags="$1" ; shift ;;
--symlink) rvm_symlink_name="$1" ; shift ;;
- --install) export rvm_install_on_use_flag=1 ;;
- --trace) export rvm_trace_flag=1 ; set -x ;;
- --proxy) export rvm_proxy="$1" ; shift ;;
- --disable-llvm|--disable-jit) export rvm_llvm_flag=0 ;;
- --enable-llvm|--enable-jit) export rvm_llvm_flag=1 ;;
+ --install) rvm_install_on_use_flag=1 ;;
+ --trace) rvm_trace_flag=1 ; set -x ;;
+ --proxy) rvm_proxy="$1" ; shift ;;
+ --disable-llvm|--disable-jit) rvm_llvm_flag=0 ;;
+ --enable-llvm|--enable-jit) rvm_llvm_flag=1 ;;
+
+ --name)
+ rvm_ruby_name="$1"
+ shift
+ ;;
+
reboot|damnit|wtf|argh|BOOM|boom|wth) $rvm_action="reboot" ;;
--self|--gem|--rubygems|--reconfigure|--default|--debug|--force|--export|--summary|--latest|--yaml|--json|--archive|--shebang|--env|--path|--tail|--delete|--verbose|--import|--rvmrc|--passenger|--editor|--sticky|--create|--rvmrc|--gems)
export rvm_$(echo $rvm_token | sed 's#-##g')_flag=1
- if [[ "--debug" = "$rvm_token" ]] ; then export rvm_debug_flag ; fi
+ if [[ "--debug" = "$rvm_token" ]] ; then rvm_debug_flag ; fi
;;
--) rvm_ruby_args="$*" ; rvm_parse_break=1 ;;
*)
if [[ ! -z "$rvm_token" ]] ; then
if [[ "gemset" = "$rvm_action" ]] ; then
if $rvm_scripts_path/match "$rvm_token" "^.+${rvm_gemset_separator}.+$" ; then
- export rvm_gemset_name="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $2}')"
- export rvm_ruby_string="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $1}')"
+ rvm_gemset_name="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $2}')"
+ rvm_ruby_string="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $1}')"
elif [[ ! -z "$(echo "$rvm_token" | awk '/\.gems$/')" ]] ; then
- export rvm_file_name="$(echo "$rvm_token" | sed 's#\.gems##g').gems"
+ rvm_file_name="$(echo "$rvm_token" | sed 's#\.gems##g').gems"
# elif [[ ! -z "$(echo "$rvm_token" | awk '/\.gems$/')" ]] ; then
else
- export rvm_gemset_name="$(echo "$rvm_token" | sed 's#\.gems##g')"
- export rvm_file_name="$rvm_gemset_name.gems"
+ rvm_gemset_name="$(echo "$rvm_token" | sed 's#\.gems##g')"
+ rvm_file_name="$rvm_gemset_name.gems"
fi
elif [[ ! -z "$(echo "$rvm_token" | awk '/,/')" ]] ; then
- export rvm_ruby_version="$rvm_token"
+ rvm_ruby_version="$rvm_token"
if [[ -z "$rvm_action" ]] ; then
rvm_action="ruby" # Not sure if we really want to do this but we'll try it out.
fi
elif $rvm_scripts_path/match "$rvm_token" "^.+${rvm_gemset_separator}.+$" ; then
- export rvm_gemset_name="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $2}')"
- export rvm_ruby_string="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $1}')"
+ rvm_gemset_name="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $2}')"
+ rvm_ruby_string="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $1}')"
elif $rvm_scripts_path/match "$rvm_token" "-" ; then
- export rvm_ruby_string="$rvm_token"
+ rvm_ruby_string="$rvm_token"
elif $rvm_scripts_path/match "$rvm_token" "^[0-9].[0-9]" ; then
- export rvm_ruby_string="$rvm_token"
- export rvm_action="${rvm_action:-use}"
+ rvm_ruby_string="$rvm_token"
+ rvm_action="${rvm_action:-use}"
elif $rvm_scripts_path/match "$rvm_token" "^ree-" ; then
- export rvm_ruby_string="$rvm_token"
- export rvm_action="${rvm_action:-use}"
+ rvm_ruby_string="$rvm_token"
+ rvm_action="${rvm_action:-use}"
+ elif [[ -L "$rvm_rubies_path/$rvm_token" ]] ; then # Alias
+ rvm_ruby_string=$rvm_token
+ rvm_action="${rvm_action:-use}"
else
if $rvm_scripts_path/match "$rvm_token" "\.rb$" ; then # we have a specified ruby script
- export rvm_ruby_args=$rvm_token
- export rvm_ruby_file=$rvm_token
+ rvm_ruby_args=$rvm_token
+ rvm_ruby_file=$rvm_token
if [[ -z "$rvm_action" ]] ; then
rvm_action="ruby"
fi
else
rvm_action="error"
@@ -370,35 +389,45 @@
__rvm_load_rvmrc
__rvm_initialize
__rvm_load_defaults
__rvm_parse_args $@
+ export BUNDLE_PATH GEM_HOME GEM_PATH rvm_action rvm_bin_flag rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_file_name rvm_gemset_name rvm_head_flag rvm_install_on_use_flag rvm_interactive rvm_llvm_flag rvm_make_flags rvm_proxy rvm_remove_flag rvm_ruby_args rvm_ruby_configure_flags rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_name rvm_ruby_patch rvm_ruby_patch_name rvm_ruby_string rvm_ruby_version rvm_system_flag rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag
+ export rvm_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator rvm_symlink_path
+
result=0
case "$rvm_action" in
- use) __rvm_use ; result=$? ;;
- srcdir) __rvm_source_dir ; result=$? ;;
- list) __rvm_list ; result=$? ;;
- strings) __rvm_strings ; result=$? ;;
- info) __rvm_info ; result=$? ;;
- debug) __rvm_debug ; result=$? ;;
- version) __rvm_version ; result=$? ;;
- reset) __rvm_reset ; result=$? ;;
- update) __rvm_update ; result=$? ;;
- reboot) __rvm_reboot ; result=$? ;;
- usage|help) __rvm_usage ; result=$? ;;
- benchmark) __rvm_benchmark ; result=$? ;;
- inspect) __rvm_inspect ; result=$? ;;
- implode|seppuku) __rvm_implode ; result=$? ;;
+ use) __rvm_use ; result=$? ;;
+ srcdir) __rvm_source_dir ; result=$? ;;
+ list) __rvm_list ; result=$? ;;
+ strings) __rvm_strings ; result=$? ;;
+ info) __rvm_info ; result=$? ;;
+ debug) __rvm_debug ; result=$? ;;
+ version) __rvm_version ; result=$? ;;
+ reset) __rvm_reset ; result=$? ;;
+ update) __rvm_update ; result=$? ;;
+ reboot) __rvm_reboot ; result=$? ;;
+ usage) __rvm_usage ; result=$? ;;
+ benchmark) __rvm_benchmark ; result=$? ;;
+ inspect) __rvm_inspect ; result=$? ;;
+ implode|seppuku) __rvm_implode ; result=$? ;;
+ docs) $rvm_scripts_path/docs ; result=$? ;;
+ alias) $rvm_scripts_path/alias ; result=$? ;;
+ help) $rvm_scripts_path/help $rvm_ruby_args ; result=$? ;;
+ answer) __rvm_Answer_to_the_Ultimate_Question_of_Life_the_Universe_and_Everything ; result=42 ;;
+ question) __rvm_ultimate_question ; result=42 ;;
+
gemdir)
$rvm_scripts_path/gemsets gemdir
result=$?
;;
ruby|gem|rake)
$rvm_scripts_path/set $rvm_action $rvm_ruby_args
result=$?
;;
+
gemset)
#if $rvm_scripts_path/match $rvm_ruby_args use ; then
if [[ "$rvm_use_flag" -eq 1 ]] ; then
__rvm_gemset_select
result=$? ; if [[ $result -eq 0 ]] ; then