forked from mingle/elasticsearch-opsworks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_rbenv
executable file
·61 lines (50 loc) · 2 KB
/
init_rbenv
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
#!/bin/bash
export RBENV_VERSION=$(cat .ruby-version)
export RBENV_ROOT=$HOME/.rbenv
unset GEM_PATH
unset GEM_HOME
if [ ! -d $RBENV_ROOT ]; then
echo "Installing rbenv."
git clone git://github.com/sstephenson/rbenv.git $RBENV_ROOT
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
echo 'eval "$(rbenv init -)"' >> ~/.profile
source ~/.profile
fi
if [ ! -d $RBENV_ROOT/plugins/rbenv-update ]; then
echo "Installing rbenv-update plugin."
git clone https://github.com/rkh/rbenv-update.git $RBENV_ROOT/plugins/rbenv-update
fi
if [ ! -d $RBENV_ROOT/plugins/ruby-build ]; then
echo "Installing ruby-build plugin."
git clone https://github.com/sstephenson/ruby-build.git $RBENV_ROOT/plugins/ruby-build
fi
if [ ! -d $RBENV_ROOT/plugins/rbenv-gemset ]; then
echo "Installing rbenv-gemset plugin."
git clone https://github.com/jf/rbenv-gemset.git $RBENV_ROOT/plugins/rbenv-gemset
fi
if [ ! -d $RBENV_ROOT/plugins/rbenv-vars ]; then
echo "Installing rbenv-vars plugin."
git clone https://github.com/sstephenson/rbenv-vars.git $RBENV_ROOT/plugins/rbenv-vars
fi
if [ ! -d $RBENV_ROOT/versions/$RBENV_VERSION ]; then
echo "Installing ruby ${RBENV_VERSION}."
$RBENV_ROOT/bin/rbenv update
$RBENV_ROOT/bin/rbenv install $RBENV_VERSION
echo "done"
elif [[ ("true" = "${RBENV_UPDATE:-false}") || ($(uname -a) =~ Darwin) ]]; then
echo "Updating rbenv..."
$RBENV_ROOT/bin/rbenv update
else
echo "Environment up to date, ruby version: $RBENV_VERSION"
fi
if ! (echo $PATH | grep -F ".rbenv/bin" > /dev/null 2>&1); then
echo "Adding rbenv to PATH - you need to restart your shell"
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.bash_profile
fi
if ! (type rbenv > /dev/null 2>&1); then
echo "Initializing rbenv in your .bash_profile - you need to restart your shell"
echo 'eval "$(rbenv init -)"' >> $HOME/.bash_profile
fi
$RBENV_ROOT/bin/rbenv exec gem install --no-ri --no-rdoc bundler
$RBENV_ROOT/bin/rbenv exec bundle install
$RBENV_ROOT/bin/rbenv rehash