set -e -x

apt-get update
apt-get install -y unzip curl
wget https://releases.hashicorp.com/terraform/0.6.12/terraform_0.6.12_linux_amd64.zip
sudo unzip -d /usr/local/bin terraform_0.6.12_linux_amd64.zip
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo pip install awscli

apt-get install -y libssl-dev libreadline-dev zlib1g-dev bison flex

git clone https://github.com/sstephenson/rbenv.git /home/vagrant/.rbenv
git clone https://github.com/sstephenson/ruby-build.git /home/vagrant/ruby-build

/home/vagrant/ruby-build/install.sh

echo 'export PATH="/home/vagrant/.rbenv/bin:$PATH"' >> /home/vagrant/.profile
echo 'eval "$(rbenv init -)"' >> /home/vagrant/.profile

chown -R vagrant:vagrant /home/vagrant/.rbenv

su vagrant << EOF
	git config --global user.email "vagrant@godev"

	source /home/vagrant/.profile

	go get -u github.com/jteeuwen/go-bindata/...
	
	rbenv install 2.3.0
	rbenv rehash
	rbenv global 2.3.0
	gem install bundler
	rbenv rehash
EOF