Class: VagrantPlugins::Invade::InvadeModule::Ssh

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from InvadeModule

#get_template_path

Constructor Details

#initialize(machine_name, ssh_data, result: nil) ⇒ Ssh

Returns a new instance of Ssh.



10
11
12
13
14
# File 'lib/vagrant-invade/module/ssh/ssh.rb', line 10

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

Instance Attribute Details

#machine_nameObject

Returns the value of attribute machine_name.



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

def machine_name
  @machine_name
end

#resultObject (readonly)

Returns the value of attribute result.



7
8
9
# File 'lib/vagrant-invade/module/ssh/ssh.rb', line 7

def result
  @result
end

#ssh_dataObject

Returns the value of attribute ssh_data.



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

def ssh_data
  @ssh_data
end

Instance Method Details

#buildObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vagrant-invade/module/ssh/ssh.rb', line 16

def build
  b = binding

  begin

    # Get machine name
    machine_name = @machine_name

    # Values for vm section
    forward_agent = @ssh_data['forward_agent']
    enabled = @ssh_data['enabled']
    path = @ssh_data['path']

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