Permalink
Browse files

Rounded out new package feature.

  • Loading branch information...
1 parent e1e22a4 commit b98ac080050ac9df79b8ee3b5ee8aebf7780d156 @wayneeseguin wayneeseguin committed Feb 27, 2010
Showing with 19 additions and 12 deletions.
  1. +12 −7 scripts/package
  2. +7 −5 scripts/utility
View
@@ -7,11 +7,10 @@
source $rvm_scripts_path/initialize
source $rvm_scripts_path/utility
-action=$1 ; shift ; library=$1 ; shift ; args="$*"
+trap "rm -f $rvm_tmp_path/$$* > /dev/null 2>&1 ; exit" 0 1 2 3 15
+if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
-if [[ -z "$action" ]] ; then
- echo "Usage: package {install,uninstall} {openssl,zlib,readline,iconv,ncurses}"
-fi
+action="$1" ; shift ; library="$1" ; shift ; args="$*"
install_package() {
@@ -140,6 +139,12 @@ llvm() {
__rvm_pushpop
}
-
-${action}
-
+if [[ ! -z "$library" ]] && is_a_function ${library} ; then
+ ${library}
+else
+ if [[ ! -z "$library" ]] ; then
+ $rvm_scripts_path/log "error" "Package '${library}' is unknown."
+ fi
+ $rvm_scripts_path/log "info" "Usage: 'rvm package {install,uninstall} {openssl,zlib,readline,iconv,ncurses}'"
+ exit 1
+fi
View
@@ -22,6 +22,8 @@ __rvm_db() {
unset key value variable
}
+is_a_function() { type $1 | head -n 1 | grep -q "function" ; }
+
# Ouput rvm environment information.
__rvm_info() {
@@ -123,8 +125,8 @@ __rvm_strings() {
results="$results $(__rvm_select ; echo $rvm_ruby_string)"
unset rvm_ruby_string
fi
- done
- echo $results
+ done
+ echo $results
unset results
return 0
}
@@ -215,7 +217,7 @@ __rvm_benchmark() {
rvm_benchmark_flag=1
action="ruby"
if [[ ! -z "$rvm_debug_flag" ]] ; then echo -e "$rvm_tmp_path/$$.rb:\n$(cat $rvm_tmp_path/$$.rb)" ; fi
- $rvm_scripts_path/set $rvm_action $rvm_ruby_args
+ $rvm_scripts_path/set $rvm_action $rvm_ruby_args
}
@@ -364,7 +366,7 @@ __rvm_list_strings() {
# This is not meant to be used with scripting. This is for interactive mode usage only.
__rvm_list() {
action="$(echo $rvm_ruby_args | awk '{print $1}')"
-
+
if [[ "known" = "$action" ]] ; then
__rvm_list_known
elif [[ "default" = "$action" ]] ; then
@@ -653,7 +655,7 @@ __rvm_gemset_select() {
fi
# If the gemset does not exist, then notify the user as such and abort the action.
- if [[ ! -d "$rvm_ruby_gem_home" ]] && [[ ! -z "$rvm_gemset_name" ]] && [[ -z "$rvm_create_flag" ]]; then
+ if [[ ! -d "$rvm_ruby_gem_home" ]] && [[ ! -z "$rvm_gemset_name" ]] && [[ -z "$rvm_create_flag" ]]; then
$rvm_scripts_path/log "error" "Gemset '$rvm_gemset_name' does not exist, rvm gems create '$rvm_gemset_name' first."
return 1
fi

0 comments on commit b98ac08

Please sign in to comment.