Vagrant.configure(2) do |config| config.vm.box = "ubuntu/trusty64" config.vm.provider "virtualbox" do |v| host = RbConfig::CONFIG['host_os'] # Give VM 1/4 system memory linux = RUBY_PLATFORM =~ /linux/ osx = RUBY_PLATFORM =~ /darwin/ windows = (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil if osx cpus = `sysctl -n hw.ncpu`.to_i mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 end if linux cpus = `nproc`.to_i mem = `sed -n -e '/^MemTotal/s/^[^0-9]*//p' /proc/meminfo`.to_i / 1024 end if windows cpus = `wmic computersystem get numberofprocessors`.split("\n")[2].to_i mem = `wmic OS get TotalVisibleMemorySize`.split("\n")[2].to_i / 1024 end mem = mem / 4 v.customize ["modifyvm", :id, "--memory", mem] v.customize ["modifyvm", :id, "--cpus", cpus] end if File.expand_path(File.dirname(__FILE__)).include? "prelert-legacy/vagrant" puts "Syncing host's source directory [" + File.expand_path("../") + "] to [/home/vagrant/prelert/src]" config.vm.synced_folder "../", "/home/vagrant/prelert/src", mount_options: ["dmode=777,fmode=777"] else puts "Syncing host's source directory [" + File.expand_path(ENV['PRELERT_SRC_HOME']) + "] to [/home/vagrant/prelert/src] (via $PRELERT_SRC_HOME)" config.vm.synced_folder ENV['PRELERT_SRC_HOME'], "/home/vagrant/prelert/src", mount_options: ["dmode=777,fmode=777"] end config.vm.provision :shell, path: "provision.sh" end