forked from BattleBrisket/rails-force-reload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision.sh
61 lines (52 loc) · 2.06 KB
/
provision.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Shell user settings.
USER_NAME=vagrant
USER_HOME=/home/$USER_NAME
DEFAULT_RUBY='2.5.1'
###############################################################################
# Functions
###############################################################################
# DRY wrapper for sudo commands.
as_user() {
echo "$USER_NAME:~$ > ${*}"
su -l $USER_NAME -c "$*"
}
###############################################################################
# Base System
###############################################################################
apt-get -y update
apt-get -yfV dist-upgrade
###############################################################################
# rbenv & ruby-build, and Rubies
# From https://github.com/sstephenson/rbenv
# and https://github.com/sstephenson/ruby-build
###############################################################################
# Install dependencies.
apt-get install -yfV \
build-essential \
curl \
git-core \
libcurl4-openssl-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
libyaml-dev \
python-software-properties \
sqlite3 \
zlib1g-dev \
# Install rbenv and ruby-build.
as_user "git clone https://github.com/sstephenson/rbenv.git $USER_HOME/.rbenv"
as_user "git clone https://github.com/sstephenson/ruby-build.git $USER_HOME/.rbenv/plugins/ruby-build"
# Setup bash to use rbenv for $USER_NAME.
truncate -s 0 $USER_HOME/.bashrc
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $USER_HOME/.bashrc
echo 'eval "$(rbenv init -)"' >> $USER_HOME/.bashrc
echo 'cd /vagrant' >> $USER_HOME/.bashrc
echo 'gem: --no-document' > $USER_HOME/.gemrc
# Install the requested version of Ruby, with Bundler.
as_user "rbenv install -s $DEFAULT_RUBY"
as_user "rbenv global $DEFAULT_RUBY"
as_user "RBENV_VERSION=$DEFAULT_RUBY gem install bundler"
as_user "cd /vagrant && bin/setup"