Class: VagrantPlugins::Invade::InvadeModule::Plugin::WinNFSd

Inherits:
InvadeModule show all
Defined in:
lib/vagrant-invade/module/plugin/winnfsd/winnfsd.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from InvadeModule

#get_template_path

Constructor Details

#initialize(machine_name, ui, winnfsd_data, result: nil) ⇒ WinNFSd

Returns a new instance of WinNFSd.



11
12
13
14
15
16
# File 'lib/vagrant-invade/module/plugin/winnfsd/winnfsd.rb', line 11

def initialize(machine_name, ui, winnfsd_data, result: nil)
  @machine_name = machine_name
  @ui = ui
  @winnfsd_data = winnfsd_data
  @result = result
end

Instance Attribute Details

#machine_nameObject

Returns the value of attribute machine_name.



9
10
11
# File 'lib/vagrant-invade/module/plugin/winnfsd/winnfsd.rb', line 9

def machine_name
  @machine_name
end

#resultObject (readonly)

Returns the value of attribute result.



8
9
10
# File 'lib/vagrant-invade/module/plugin/winnfsd/winnfsd.rb', line 8

def result
  @result
end

#uiObject

Returns the value of attribute ui.



9
10
11
# File 'lib/vagrant-invade/module/plugin/winnfsd/winnfsd.rb', line 9

def ui
  @ui
end

#winnfsd_dataObject

Returns the value of attribute winnfsd_data.



9
10
11
# File 'lib/vagrant-invade/module/plugin/winnfsd/winnfsd.rb', line 9

def winnfsd_data
  @winnfsd_data
end

Instance Method Details

#buildObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/vagrant-invade/module/plugin/winnfsd/winnfsd.rb', line 18

def build

  if !Vagrant.has_plugin?('vagrant-winnfsd')
    @ui.error("[Invade] Plugin 'vagrant-winnfsd' not installed but defined. Use 'vagrant plugin install vagrant-winnfsd' to install it.")
    @result = ''
  else

    b = binding

    begin

      # Get machine name
      machine_name = @machine_name

      # Values for winnfsd section
      logging = @winnfsd_data['logging']
      uid = @winnfsd_data['uid']
      gid = @winnfsd_data['gid']

      eruby = Erubis::Eruby.new(File.read(self.get_template_path(__FILE__)))
      @result = eruby.result b
    rescue TypeError, SyntaxError, SystemCallError => e
      raise(e)
    end
  end
end