0
|
1 |
#!/usr/bin/env bash
|
|
2 |
|
|
3 |
environment_id="ruby-2.3@arborist-fping"
|
|
4 |
|
|
5 |
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
|
6 |
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
|
7 |
then
|
|
8 |
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
|
9 |
for __hook in "${rvm_path:-$HOME/.rvm}/hooks/after_use"*
|
|
10 |
do
|
|
11 |
if [[ -f "${__hook}" && -x "${__hook}" && -s "${__hook}" ]]
|
|
12 |
then \. "${__hook}" || true
|
|
13 |
fi
|
|
14 |
done
|
|
15 |
unset __hook
|
|
16 |
if (( ${rvm_use_flag:=1} >= 2 )) # display only when forced
|
|
17 |
then
|
|
18 |
if [[ $- == *i* ]] # check for interactive shells
|
|
19 |
then printf "%b" "Using: $(tput setaf 2 2>/dev/null)$GEM_HOME$(tput sgr0 2>/dev/null)\n" # show the user the ruby and gemset they are using in green
|
|
20 |
else printf "%b" "Using: $GEM_HOME\n" # don't use colors in non-interactive shells
|
|
21 |
fi
|
|
22 |
fi
|
|
23 |
else
|
|
24 |
# If the environment file has not yet been created, use the RVM CLI to select.
|
|
25 |
rvm --create "$environment_id" || {
|
|
26 |
echo "Failed to create RVM environment '${environment_id}'."
|
|
27 |
return 1
|
|
28 |
}
|
|
29 |
fi
|