Add shortcut for setting the memory size for VirtualBox VM

This commit is contained in:
Teemu Matilainen 2013-10-28 00:43:33 -03:00
parent eb6256316c
commit 3368ef610a
2 changed files with 17 additions and 0 deletions

View File

@ -76,6 +76,14 @@ module VagrantPlugins
@network_adapters[slot] = [type, args]
end
# Shortcut for setting memory size for the virtual machine.
# Calls #customize internally.
#
# @param size [Integer, String] the memory size in MB
def memory=(size)
customize "pre-boot", ["modifyvm", :id, "--memory", size]
end
# This is the hook that is called to finalize the object before it
# is put into use.
def finalize!

View File

@ -61,3 +61,12 @@ more than 50% would be used on your own host machine. Some details:
* Multiple `customize` directives can be used. They will be executed in the
order given.
There is also a shortcut for specifying the memory size (MB) for the virtual
machine:
```ruby
config.vm.provider "virtualbox" do |v|
v.memory = 1024
end
```