-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathrbenv-installer.sh
executable file
·46 lines (36 loc) · 1001 Bytes
/
rbenv-installer.sh
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
#!/usr/bin/env bash
# Verify Git is installed, otherwise suggest running bootstrap:
if [ ! $(which git) ]; then
echo "Git is not installed."
exit
fi
RBENV_ROOT="$HOME/.rbenv"
# Install rbenv:
if [ ! -d "$RBENV_ROOT" ] ; then
git clone git://github.com/sstephenson/rbenv.git $RBENV_ROOT
else
pushd $RBENV_ROOT; git pull; popd
fi
# Install plugins:
PLUGINS=( "sstephenson:rbenv-vars"
"sstephenson:ruby-build" )
for plugin in ${PLUGINS[@]} ; do
KEY=${plugin%%:*}
VALUE=${plugin#*:}
RBENV_PLUGIN_ROOT="${RBENV_ROOT}/plugins/$VALUE"
if [ ! -d "$RBENV_PLUGIN_ROOT" ] ; then
git clone git://github.com/$KEY/$VALUE.git $RBENV_PLUGIN_ROOT
else
pushd $RBENV_PLUGIN_ROOT; git pull; popd
fi
done
# Show help if `.rbenv` is not in the path:
if [ ! $(which rbenv) ]; then
echo "
Seems you still have not added 'rbenv' to the load path:
if [[ -d \$HOME/.rbenv ]]; then
export PATH=\"\$HOME/.rbenv/bin:\$PATH\"
eval \"\$(rbenv init -)\"
fi
"
fi