diff --git a/.gitignore b/.gitignore index 04a01b562..225e014d6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ # Vagrant stuff acceptance_config.yml boxes/* -/Vagrantfile /.vagrant /website/docs/.vagrant /website/www/.vagrant diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 000000000..075157ed9 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,54 @@ +# This Vagrantfile can be used to develop Vagrant. Note that VirtualBox +# doesn't run in VirtualBox so you can't actually _run_ Vagrant within +# the VM created by this Vagrantfile, but you can use it to develop the +# Ruby, run unit tests, etc. + +Vagrant.configure("2") do |config| + config.vm.box = "hashicorp/precise64" + + ["virtualbox", "vmware_fusion", "vmware_workstation"].each do |provider| + config.vm.provider provider do |v, override| + v.memory = "1024" + end + end + + config.vm.provision "shell", inline: $shell +end + +$shell = <<-CONTENTS +MARKER_FILE="/usr/local/etc/vagrant_provision_marker" + +# Only provision once +if [ -f "${MARKER_FILE}" ]; then + exit 0 +fi + +# Update apt +apt-get update + +# Install basic dependencies +apt-get install -y build-essential bsdtar curl + +# Install RVM +su -l -c 'curl -L https://get.rvm.io | bash -s stable' vagrant + +# Add the vagrant user to the RVM group +#usermod -a -G rvm vagrant + +# Install some Rubies +su -l -c 'rvm install 2.1.1' vagrant +su -l -c 'rvm --default use 2.1.1' vagrant + +# Output the Ruby version (for sanity) +su -l -c 'ruby --version' vagrant + +# Install Git +apt-get install -y git + +# Automatically move into the shared folder, but only add the command +# if it's not already there. +grep -q 'cd /vagrant' /home/vagrant/.bash_profile || echo 'cd /vagrant' >> /home/vagrant/.bash_profile + +# Touch the marker file so we don't do this again +touch ${MARKER_FILE} +CONTENTS