-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
hook
executable file
·37 lines (30 loc) · 1.02 KB
/
hook
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
# need additional step to not redefine variables value if already set
typeset old_rvm_verbose_flag old_rvm_debug_flag >/dev/null 2>/dev/null
old_rvm_verbose_flag=${rvm_verbose_flag:-0}
old_rvm_debug_flag=${rvm_debug_flag:-0}
# silence ZSH redefinitions
typeset rvm_verbose_flag rvm_debug_flag hooks >/dev/null 2>/dev/null
true rvm_verbose_flag:${rvm_verbose_flag:=${old_rvm_verbose_flag}} \
rvm_debug_flag:${rvm_debug_flag:=${old_rvm_debug_flag}} rvm_hook:${rvm_hook:=}
if
[[ -n "$rvm_hook" ]]
then
hooks=( "$rvm_hooks_path")
[[ "$PWD/.rvm/hooks" == "$rvm_hooks_path" ]] ||
hooks+=( "$PWD/.rvm/hooks" )
_hooks_list=($(
find -L "${hooks[@]}" -iname "$rvm_hook*" -type f 2>/dev/null
))
for hook in "${_hooks_list[@]}"
do
if [[ -x "${hook}" || "${hook##*/}" == "$rvm_hook" ]]
then
if (( rvm_verbose_flag )) || (( rvm_debug_flag ))
then rvm_log "Running $hook"
fi
__rvm_conditionally_do_with_env . "${hook}" >&2
fi
done
fi
unset rvm_hook hooks _hooks_list hook