Class: ConfigBuilder::Model::Provider::VMware

Inherits:
Base
  • Object
show all
Defined in:
lib/config_builder/model/provider/vmware.rb

Overview

Direct Known Subclasses

VMwareFusion, VMwareWorkstation

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#eval_overrides, #instance_id

Methods inherited from Base

#attr, #attrs=, #call, #configure!, def_model_attribute, def_model_delegator, def_model_id, def_model_option, #eval_models, #instance_id, #instance_options, model_attributes, model_delegators, #model_delegators, model_options, new_from_hash, #with_attr

Constructor Details

#initializeVMware

Returns a new instance of VMware.



17
18
19
20
21
22
23
24
# File 'lib/config_builder/model/provider/vmware.rb', line 17

def initialize
  @defaults = {
    :gui => false,
    :vmx => {},
  }

  @providers ||= %w[vmware_fusion vmware_workstation]
end

Instance Attribute Details

#guiBoolean

Returns Whether the GUI should be launched when the VM is created.

Returns:

  • (Boolean)

    Whether the GUI should be launched when the VM is created



15
# File 'lib/config_builder/model/provider/vmware.rb', line 15

def_model_attribute :gui

#vmxHash<String, String>

Returns A hash of VMX options for the given VM.

Examples:

model.vmx = {
  'memsize'  => '1024',
  'numvcpus' => '2',
}

Returns:

  • (Hash<String, String>)

    A hash of VMX options for the given VM



11
# File 'lib/config_builder/model/provider/vmware.rb', line 11

def_model_attribute :vmx

Instance Method Details

#to_procObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/config_builder/model/provider/vmware.rb', line 26

def to_proc
  Proc.new do |vm_config|
    @providers.each do |vmware_provider|
      vm_config.provider vmware_provider do |provider, override|
        provider.gui = attr(:gui)
        attr(:vmx).each_pair do |key, value|
          provider.vmx[key] = value
        end

        eval_models([provider, override])
      end
    end
  end
end