I need to detect which platform is running vagrant. (We have vagrant windows/mac users) and need to setup some initial variable values for some of the configuration parameters.
--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I need to detect which platform is running vagrant. (We have vagrant windows/mac users) and need to setup some initial variable values for some of the configuration parameters.
--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
if Gem.win_platform?
--
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/lhd9_WfySXo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
if RUBY_PLATFORM.include? 'linux'
b.vm.network :bridged, :bridge => "eth0"
elseif RUBY_PLATFORM.include? 'darwin'
b.vm.network :bridged, :bridge => "en1: Wi-Fi (AirPort)"
end require 'rubygems'
require 'facter'
Facter.loadfacts
config.vm.provider "virtualbox" do |v|
# Give VM 25% of system cpu cores
v.customize ["modifyvm", :id, "--cpus", [((Facter.processorcount) / 4).to_i, 1].max ]
endconfig.vm.provider "virtualbox" do |v|
# Give VM 25% of system cpu cores
if @cores
v.customize ["modifyvm", :id, "--cpus", @cores/4.to_i ] end
end
# Give VM 25% of system cpu cores, with a minimum of 1
if @cores
puts "Detected " + @cores + " CPU cores"
v.customize ["modifyvm", :id, "--cpus", max([@cores/4.to_i, 1]) ]
else
puts "Unable to detect CPU cores, will assign 1 CPU to the VM"
end