Class: Fission::Config

Inherits:
Object show all
Defined in:
lib/fission/config.rb

Constant Summary collapse

CONF_FILE =

Public: Path to the Fission conf file (default: ~/.fissionrc).

File.expand_path '~/.fissionrc'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Public: Initializes a Config object. This also sets the default config attributes for ‘vmrun_bin’, ‘vmrun_cmd’, ‘vm_dir’, ‘plist_file’, and ‘gui_bin’.

Examples

Fission::Config.new

Returns a new Config instance.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fission/config.rb', line 19

def initialize
  @attributes = {}

  @attributes['vm_dir'] = File.expand_path('~/Documents/Virtual Machines.localized/')
  @attributes['lease_file'] = '/var/db/vmware/vmnet-dhcpd-vmnet8.leases'
  @attributes['vmrun_bin'] = '/Library/Application Support/VMware Fusion/vmrun'
  @attributes['plist_file'] = File.expand_path('~/Library/Preferences/com.vmware.fusion.plist')
  @attributes['gui_bin'] = File.expand_path('/Applications/VMware Fusion.app/Contents/MacOS/vmware')

  load_from_file

  @attributes['vmrun_cmd'] = "'#{@attributes['vmrun_bin']}' -T fusion"
end

Instance Attribute Details

#attributesObject

Public: Gets/Sets the Hash of attributes.



5
6
7
# File 'lib/fission/config.rb', line 5

def attributes
  @attributes
end

Instance Method Details

#[](item) ⇒ Object

Public: Helper method to access config atributes. This is a shortcut for querying the config attributes.

item - The config item to query.

Examples

Fission.config['vmrun_bin']
# => '/foo/bar/vmrun'

Returns the value of the specified config item.



44
45
46
# File 'lib/fission/config.rb', line 44

def [](item)
  @attributes[item]
end