Class: VagrantWindows::Guest::Windows

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-windows/guest/windows.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(machine = nil) ⇒ Windows

Returns a new instance of Windows.



17
18
19
20
# File 'lib/vagrant-windows/guest/windows.rb', line 17

def initialize(machine = nil)
  super(machine) unless machine == nil
  @machine = machine
end

Instance Attribute Details

#machineObject (readonly)

Vagrant 1.1.x compatibility methods Implement the 1.1.x methods and call through to the new 1.2.x capabilities



15
16
17
# File 'lib/vagrant-windows/guest/windows.rb', line 15

def machine
  @machine
end

Instance Method Details

#change_host_name(name) ⇒ Object



22
23
24
# File 'lib/vagrant-windows/guest/windows.rb', line 22

def change_host_name(name)
  VagrantWindows::Guest::Cap::ChangeHostName.change_host_name(@machine, name)
end

#configure_networks(networks) ⇒ Object



44
45
46
# File 'lib/vagrant-windows/guest/windows.rb', line 44

def configure_networks(networks)
  VagrantWindows::Guest::Cap::ConfigureNetworks.configure_networks(@machine, networks)
end

#detect?(machine) ⇒ Boolean

Vagrant 1.2.x compatibility methods

Returns:

  • (Boolean)


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/vagrant-windows/guest/windows.rb', line 51

def detect?(machine)
  
  # uname -o | grep Solaris
  # uname -s | grep 'Linux'
  # uname -s | grep 'FreeBSD'
  # cat /etc/redhat-release
  # uname -s | grep 'OpenBSD'
  # cat /etc/gentoo-release
  # cat /proc/version | grep 'Debian'
  # cat /etc/arch-release
  # cat /proc/version | grep 'Ubuntu'
  # cat /etc/SuSE-release
  # cat /etc/pld-release
  # grep 'Fedora release 1[678]' /etc/redhat-release
  
  # see if the Windows directory is present
  machine.communicate.test("test -d $Env:SystemRoot")
end

#distro_dispatchObject



26
27
28
# File 'lib/vagrant-windows/guest/windows.rb', line 26

def distro_dispatch
  :windows
end

#haltObject



30
31
32
# File 'lib/vagrant-windows/guest/windows.rb', line 30

def halt
  VagrantWindows::Guest::Cap::Halt.halt(@machine)
end

#mount_shared_folder(name, guestpath, options) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/vagrant-windows/guest/windows.rb', line 34

def mount_shared_folder(name, guestpath, options)
  if VagrantWindows::Helper.is_vmware(@machine) then
    VagrantWindows::Guest::Cap::MountSharedFolder.mount_vmware_shared_folder(
      @machine, name, guestpath, options)
  else
    VagrantWindows::Guest::Cap::MountSharedFolder.mount_virtualbox_shared_folder(
      @machine, name, guestpath, options)
  end
end