Module: VagrantWindows::Helper

Instance Method Summary collapse

Instance Method Details

#is_vmware(machine) ⇒ Boolean

Checks to see if the specified machine is using VMWare Fusion or Workstation.

Returns:

  • (Boolean)


28
29
30
# File 'lib/vagrant-windows/helper.rb', line 28

def is_vmware(machine)
  machine.provider_name.to_s().start_with?('vmware')
end

#win_friendly_path(path) ⇒ String

Makes a path Windows guest friendly. Turns ‘/vagrant’ into ‘c:vagrant’

Returns:

  • (String)


9
10
11
12
13
14
15
# File 'lib/vagrant-windows/helper.rb', line 9

def win_friendly_path(path)
  if path
    new_path = path.gsub('/', '\\')
    new_path = "c:#{new_path}" if new_path =~ /^\\/
  end
  new_path
end

#win_friendly_share_id(shared_folder_name) ⇒ String

Makes Vagrant share names Windows guest friendly. Turns ‘/vagrant’ into ‘vagrant’ or turns ”/a/b/c/d/e’ into ‘a_b_c_d_e’

Returns:

  • (String)


21
22
23
# File 'lib/vagrant-windows/helper.rb', line 21

def win_friendly_share_id(shared_folder_name)
  return shared_folder_name.gsub(/[\/\/]/,'_').sub(/^_/, '')
end