scripts/cli in rvm-0.1.38 vs scripts/cli in rvm-0.1.39
- old
+ new
@@ -2,11 +2,14 @@
__rvm_usage() { cat "${rvm_path:-$HOME/.rvm}/README" | ${PAGER:-less} ; }
__rvm_parse_args() {
- echo "$@" >> $HOME/.rvm_history
+ # TODO:
+ # Make this more robust '__rvm_history' so that it stores *unique* rvm commands.
+ # Otherwise this file gets big rather fast.
+ #echo "$@" >> $HOME/.rvm_history
if echo "$@" | grep -q 'trace' ; then echo "$@" ; __rvm_version ; fi
while [[ $# -gt 0 ]] ; do
rvm_token="$1" ; shift
@@ -32,16 +35,10 @@
env)
rvm_action=$rvm_token
;;
- inspect)
- rvm_action=$rvm_token
- rvm_ruby_args="$@"
- rvm_parse_break=1
- ;;
-
install|uninstall)
export ${rvm_token}_flag=1
rvm_action=$rvm_token
;;
@@ -104,11 +101,11 @@
rvm_gemdir_flag=1
if [[ "system" = "$1" ]] ; then rvm_system_flag=1 ; shift ; fi
if [[ "user" = "$1" ]] ; then rvm_user_flag=1 ; shift ; fi
;;
- list|info|alias|docs)
+ rubygems|inspect|list|info|alias|docs)
rvm_action="$rvm_token"
rvm_ruby_args="$@"
rvm_parse_break=1
;;
@@ -122,10 +119,16 @@
rvm_action="ruby"
rvm_ruby_args="$rvm_token \"$@\""
rvm_parse_break=1
;;
+ exec)
+ rvm_action="exec";
+ rvm_ruby_args="$(__rvm_quote_args "$@")"
+ rvm_parse_break=1
+ ;;
+
do|ruby|rake|gem|rubydo|rakedo|gemdo)
if [[ "do" = "$rvm_action" ]] ; then rvm_action="ruby" ; fi
rvm_action=$(echo $rvm_token | sed 's#do##g')
if [[ "rake" = "$rvm_action" ]] || [[ "gem" = "$rvm_action" ]] || [[ "ruby" = "$rvm_action" ]] ; then
if [[ -z "$1" ]] ; then
@@ -223,50 +226,20 @@
else
rvm_bin_path="$1" ; shift
fi
;;
- -j)
- if [[ ! -z "$1" ]] ; then
- rvm_make_flags="$rvm_make_flags -j$1"
- shift
- else
- rvm_action="error"
- rvm_error_message="-j *must* be followed by an integer (normally the # of CPU's in your machine)."
- fi
- ;;
-
- -C|--configure)
- if [[ ! -z "$1" ]] ; then
- rvm_ruby_configure_flags="$(echo $1 | tr ',' ' ')"
- shift
- else
- rvm_action="error"
- rvm_error_message="--configure *must* be followed by configure flags."
- fi
- ;;
-
-r|--require)
if [[ -z "$1" ]] ; then
rvm_action="error"
rvm_error_message="-r|--require *must* be followed by a library name."
else
rvm_ruby_require="$rvm_ruby_require -r$1"
shift
fi
;;
- -I|--include)
- if [[ -z "$1" ]] ; then
- rvm_action="error"
- rvm_error_message="-I|--include *must* be followed by a path."
- else
- rvm_ruby_load_path="$rvm_ruby_load_path:$1"
- shift
- fi
- ;;
-
--rdoc|--yard)
rvm_docs_type="$rvm_token"
rvm_docs_type
;;
@@ -305,18 +278,20 @@
shift
;;
wrapper)
rvm_action="$rvm_token"
- rvm_ruby_string="$1" ; shift
- rvm_wrapper_name="$1" ; shift
+ rvm_ruby_string="$1" ;
+ [[ -n "$1" ]] && shift
+ rvm_wrapper_name="$1"
+ [[ -n "$1" ]] && shift
rvm_ruby_args="$@" # list of binaries, or none
rvm_parse_break=1
;;
-h|--help|usage) rvm_action=help ;;
- -G|--gems) rvm_gems_path="$1" ; shift ;;
+ -G) 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 ;;
--nice) rvm_niceness="$1" ; shift ;;
@@ -337,14 +312,58 @@
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|--sticky|--create|--rvmrc|--gems|--docs)
export rvm_$(echo $rvm_token | sed 's#-##g')_flag=1
- if [[ "--debug" = "$rvm_token" ]] ; then rvm_debug_flag ; fi
;;
+ -j)
+ if [[ ! -z "$1" ]] ; then
+ rvm_make_flags="$rvm_make_flags -j$1"
+ shift
+ else
+ rvm_action="error"
+ rvm_error_message="-j *must* be followed by an integer (normally the # of CPU's in your machine)."
+ fi
+ ;;
+
+ -C|--configure)
+ if [[ ! -z "$1" ]] ; then
+ rvm_ruby_configure_flags="$(echo $1 | tr ',' ' ')"
+ shift
+ else
+ rvm_action="error"
+ rvm_error_message="--configure *must* be followed by configure flags."
+ fi
+ ;;
+
+ --with-*)
+ rvm_ruby_configure_flags="$rvm_ruby_configure_flags $rvm_token"
+ ;;
+ --without-*)
+ rvm_ruby_configure_flags="$rvm_ruby_configure_flags $rvm_token"
+ ;;
+ --enable-*)
+ rvm_ruby_configure_flags="$rvm_ruby_configure_flags $rvm_token"
+ ;;
+ --disable-*)
+ rvm_ruby_configure_flags="$rvm_ruby_configure_flags $rvm_token"
+ ;;
+
+
+ -I|--include)
+ if [[ -z "$1" ]] ; then
+ rvm_action="error"
+ rvm_error_message="-I|--include *must* be followed by a path."
+ else
+ rvm_ruby_load_path="$rvm_ruby_load_path:$1"
+ shift
+ 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
rvm_gemset_name="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $2}')"
@@ -411,11 +430,11 @@
}
rvm() {
__rvm_setup
- if [[ ! -z "$PS1" ]] ; then export rvm_interactive=1 ; else unset rvm_interactive ; fi
+ if [[ -n "$PS1" ]] ; then export rvm_interactive=1 ; else unset rvm_interactive ; fi
if [[ -z "$ZSH_VERSION" ]] ; then
trap 'rm -rf "$rvm_tmp_path/$$" >/dev/null 2>&1' 0 1 2 3 15
fi
@@ -458,13 +477,14 @@
else
$rvm_scripts_path/info $rvm_ruby_args
fi
result=$?
;;
- docs) $rvm_scripts_path/docs $rvm_ruby_args ; result=$? ;;
- alias) $rvm_scripts_path/alias $rvm_ruby_args ; result=$? ;;
- help) $rvm_scripts_path/help $rvm_ruby_args ; result=$? ;;
+ docs) $rvm_scripts_path/docs $rvm_ruby_args ; result=$? ;;
+ alias) $rvm_scripts_path/alias $rvm_ruby_args ; result=$? ;;
+ help) $rvm_scripts_path/help $rvm_ruby_args ; result=$? ;;
+ rubygems) $rvm_scripts_path/rubygems $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 ;;
env)
@@ -481,18 +501,18 @@
gemdir|gemhome|gempath)
$rvm_scripts_path/gemsets $rvm_action
result=$?
;;
- ruby|gem|rake)
+ ruby|gem|rake|exec)
old_rvm_ruby_string=$rvm_ruby_string
unset rvm_ruby_string
export rvm_ruby_strings
$rvm_scripts_path/set $rvm_action $rvm_ruby_args
+ result=$?
# Restore the state pre-sets.
[[ -n "$old_rvm_ruby_string" ]] && rvm_ruby_string=$old_rvm_ruby_string
unset old_rvm_ruby_string
- result=$?
;;
gemset)
#if $rvm_scripts_path/match $rvm_ruby_args use ; then
if [[ "$rvm_use_flag" -eq 1 ]] ; then