forked from yule/poker-croupier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
55 lines (38 loc) · 1.25 KB
/
Vagrantfile
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
BOX = RUBY_PLATFORM.index("x86_64").nil? ? "precise32" : "precise64"
PROVISION_SCRIPT = <<END
install_package()
{
PACKAGE=$1
if ! dpkg -l "$PACKAGE" | grep ^ii; then
apt-get install -y $PACKAGE
fi
}
LAST_UPDATE=$(stat --format %Y /var/cache/apt/pkgcache.bin)
CURRENT_TIME=$(date +%s)
if [ "$LAST_UPDATE" -lt $(($CURRENT_TIME-24*60*60)) ]; then
apt-get update
fi
install_package git
install_package curl
if ! [ -f /usr/local/rvm/scripts/rvm ]; then
curl -L https://get.rvm.io | bash -s stable --ruby=2.1.0
echo "" >> /etc/bashrc
echo ". /usr/local/rvm/scripts/rvm" >> /etc/bashrc
. /usr/local/rvm/scripts/rvm
fi
if ! [ /usr/local/rvm/gems/ruby-2.1.0/bin/bundle ]; then
gem install bundler
fi
cd /home/vagrant/poker-croupier && bundle install
END
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = BOX
config.vm.box_url = "http://files.vagrantup.com/#{BOX}.box"
config.vm.provision :shell, :inline => PROVISION_SCRIPT
config.vm.synced_folder ".", "/home/vagrant/poker-croupier"
config.vm.network :private_network, ip: "10.1.0.101"
end