Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Hook code cleanup.

  • Loading branch information...
commit e7cfa7a9b5764da9250f52af0c47feba98adc82a 1 parent d461f56
@wayneeseguin wayneeseguin authored
Showing with 22 additions and 11 deletions.
  1. +19 −10 scripts/hook
  2. +3 −1 scripts/initialize
View
29 scripts/hook
@@ -1,23 +1,32 @@
#!/usr/bin/env bash
-declare rvm_verbose_flag=${rvm_verbose_flag:-0}
+declare rvm_verbose_flag rvm_debug_flag rvm_hook
-declare rvm_hook=${rvm_hook:-""}
+true ${rvm_verbose_flag:=0} ${rvm_debug_flag:=0} "${rvm_hook:=}"
-if [[ -n "$rvm_hook" ]] ; then
-
- if [[ "$PWD/.rvm/hooks/$rvm_hook" = "$rvm_hooks_path/$rvm_hook" ]] ; then
+if [[ -n "$rvm_hook" ]]
+then
+ if [[ "$PWD/.rvm/hooks/$rvm_hook" = "$rvm_hooks_path/$rvm_hook" ]]
+ then
hooks=( "$rvm_hooks_path/$rvm_hook")
else
hooks=("$PWD/.rvm/hooks/$rvm_hook" "$rvm_hooks_path/$rvm_hook")
fi
- for hook in "${hooks[@]}" ; do
- [[ -s "$hook" ]] || continue
- [[ ${rvm_verbose_flag:-0} -gt 0 || ${rvm_debug_flag:-0} -gt 0 ]] &&
- rvm_log "Running $hook"
+ for hook in "${hooks[@]}"
+ do
+ if [[ -s "$hook" ]]
+ then
+ if (( rvm_verbose_flag > 0 )) || (( rvm_debug_flag > 0 ))
+ then
+ rvm_log "Running $hook"
+ fi
+
+ source "$hook"
+ else
+ continue
+ fi
- source "$hook"
done
fi
View
4 scripts/initialize
@@ -68,7 +68,9 @@ fi
${rvm_tmp_path:="$rvm_path/tmp"} \
${rvm_user_path:="$rvm_path/user"} \
${rvm_usr_path:="$rvm_path/usr"} \
- ${rvm_wrappers_path:="$rvm_path/wrappers"}
+ ${rvm_wrappers_path:="$rvm_path/wrappers"} \
+ ${rvm_verbose_flag:=0} \
+ ${rvm_debug_flag:=0}
if [[ -n "${rvm_archflags:-}" ]]
then
Please sign in to comment.
Something went wrong with that request. Please try again.