Class: VagrantPlugins::VagrantWinNFSd::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-winnfsd/host.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Host

Returns a new instance of Host.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vagrant-winnfsd/host.rb', line 10

def initialize(*args)
  super

  @logger = Log4r::Logger.new("vagrant::hosts::windows")

  executable = VagrantWinNFSd.get_path_for_file("nfsservice.bat")
  @nfs_check_command = "\"#{executable}\" status"
  @nfs_start_command = "\"#{executable}\" start"
  @nfs_stop_command = "\"#{executable}\" halt"
  @nfs_path_file = ".vagrant\\nfspaths"
end

Class Method Details

.match?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/vagrant-winnfsd/host.rb', line 6

def self.match?
  Vagrant::Util::Platform.windows?
end

Instance Method Details

#nfs?Boolean

Windows does not support NFS

Returns:

  • (Boolean)


23
24
25
# File 'lib/vagrant-winnfsd/host.rb', line 23

def nfs?
  true
end

#nfs_export(id, ips, folders) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/vagrant-winnfsd/host.rb', line 27

def nfs_export(id, ips, folders)
  @ui.info I18n.t("vagrant_winnfsd.hosts.windows.nfs_export")
  sleep 0.5

  folders.each do |k, opts|
    hostpath = opts[:hostpath].dup
    hostpath.gsub!("'", "'\\\\''")
    hostpath.gsub('/', '\\')
    system("echo #{hostpath} >>#@nfs_path_file")
  end

  system("#@nfs_start_command .\\#@nfs_path_file")
  sleep 2
end

#nfs_prune(valid_ids) ⇒ Object



42
43
44
45
46
# File 'lib/vagrant-winnfsd/host.rb', line 42

def nfs_prune(valid_ids)
  @ui.info I18n.t("vagrant_winnfsd.hosts.windows.nfs_prune")
  @logger.info("Pruning invalid NFS entries...")
  nfs_cleanup()
end