/
base
64 lines (54 loc) · 1.28 KB
/
base
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
# Base is a collection of general files + commonly included setup functions.
export __array_start rvm_path >/dev/null
#
# Setup environment parameters.
#
if [[ -n "${ZSH_VERSION:-}" ]]
then
__array_start=1
else
__array_start=0
fi
#
# Load general scripts and functions
#
#
# Load the general scripts.
# Use rvm_base_except="selector", for example, to override the loading.
#
if [[ -z "${rvm_path:-}" ]]
then
if (( UID == 0 ))
then
rvm_path="/usr/local/rvm"
else
rvm_path="${HOME}/.rvm"
fi
fi
export rvm_path
true ${rvm_scripts_path:="$rvm_path/scripts"}
# Initialize all main RVM variables.
source "$rvm_scripts_path/initialize"
case " $rvm_base_except " in
(*[[:space:]]selector[[:space:]]*)
true # do not load.
;;
(*)
source "$rvm_scripts_path/selector"
;;
esac
declare -a scripts
scripts=(
logging utility init cleanup env rvmrc install environment gemset db bundler
)
for entry in ${scripts[@]} ; do
source "$rvm_scripts_path/functions/$entry"
done
unset scripts entry rvm_base_except
if [[ ! -t 0 ]] && command -v __rvm_cleanup_tmp >/dev/null 2>&1
then
# Cleanup RVM temporary files on exit if we are loaded from a script.
# Only cleanup if the function to do so is defined :)
trap "set +e; __rvm_cleanup_tmp '$$'" 0 1 2 3 15
fi