require 'securerandom' module DevenvBuild module Files class Vagrantfile < Base def filename File.join(options[:destination_directory], 'Vagrantfile') end def template <<-EOF # -*- mode: ruby -*- # vi: set ft=ruby : # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "ubuntu/trusty64" config.vm.network "private_network", ip: "192.168.50.4" config.vm.network "forwarded_port", guest: 3000, host: 3000 config.ssh.forward_agent = true config.vm.synced_folder ".", "/vagrant", type: "nfs" config.vm.provision "shell", path: "provision/provision.sh" config.vm.provider "virtualbox" do |v| v.name = "#{box_name}" v.memory = 1024 v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] end end EOF end private def box_name options[:box_name] || "Development Environment #{SecureRandom.uuid}" end end end end