# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure("2") do |config| | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.network "forwarded_port", guest: 3000, host: 3000 | |
# runs as root | |
config.vm.provision "shell", inline: <<-SHELL | |
apt-get update | |
git --version || apt-get install -y git | |
rails --version || apt-get install -y ruby-railties-4.0 | |
nodejs --version || apt-get install -y nodejs | |
SHELL | |
# runs as non-root user "vagrant" | |
config.vm.provision "shell", privileged: false, inline: <<-SCRIPT | |
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 | |
curl -sSL https://get.rvm.io | bash -s stable --rails | |
source /home/vagrant/.rvm/scripts/rvm | |
rbenv install 2.0.0-p353 | |
rbenv global 2.0.0-p353 | |
yes | gem update | |
gem install rdoc | |
gem install rails pg | |
if [ ! -d "/vagrant/toy_app" ]; then | |
(cd /vagrant && rails new toy_app) | |
fi | |
(cd /vagrant/toy_app && bundle install) | |
SCRIPT | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment