Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu-12.04-amd64-docker-1426195046"
  config.vm.box_url = "http://devtools-vagrant-images.s3.amazonaws.com/ubuntu-12.04-amd64-docker-1426195046.box"
  config.ssh.forward_agent = true
  config.vm.provision :shell, inline: "apt-get update && apt-get -y install manta"

  config.vm.provision :shell, inline: <<-EOS
    apt-get -y install zlib1g-dev libsasl2-dev libxslt1-dev libxml2-dev libcurl4-openssl-dev libpq-dev libpq5 libqt4-dev libreadline-dev

    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

    export HOME=/home/vagrant

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

    rbenv install 2.1.5
    rbenv rehash
    rbenv global 2.1.5
    gem install bundler
    rbenv rehash

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

  config.vm.provider :virtualbox do |vb|
    vb.memory = 2048
    vb.cpus = 4
  end
end
