Class: Vagrant::VSshFs::Builders::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/valkyrie-sshfs/builders/base.rb

Direct Known Subclasses

Guest, Host

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(machine, ui) ⇒ Base

Returns a new instance of Base.



7
8
9
# File 'lib/valkyrie-sshfs/builders/base.rb', line 7

def initialize(machine, ui)
  @machine, @ui = machine, ui
end

Instance Attribute Details

#machineObject (readonly)

Returns the value of attribute machine.



5
6
7
# File 'lib/valkyrie-sshfs/builders/base.rb', line 5

def machine
  @machine
end

#uiObject (readonly)

Returns the value of attribute ui.



5
6
7
# File 'lib/valkyrie-sshfs/builders/base.rb', line 5

def ui
  @ui
end

Instance Method Details

#ask(key, *args) ⇒ Object



32
33
34
# File 'lib/valkyrie-sshfs/builders/base.rb', line 32

def ask(key, *args)
  ui.ask(i18n("ask.#{key}", *args), :new_line => true)
end

#error(key, *args) ⇒ Object

Raises:



36
37
38
39
# File 'lib/valkyrie-sshfs/builders/base.rb', line 36

def error(key, *args)
  ui.error(i18n("error.#{key}", *args))
  raise Error, :base
end

#i18n(key, *args) ⇒ Object



41
42
43
# File 'lib/valkyrie-sshfs/builders/base.rb', line 41

def i18n(key, *args)
  I18n.t("vagrant.config.vsshfs.#{key}", *args)
end

#info(key, *args) ⇒ Object



28
29
30
# File 'lib/valkyrie-sshfs/builders/base.rb', line 28

def info(key, *args)
  ui.info(i18n("info.#{key}", *args))
end

#mountObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/valkyrie-sshfs/builders/base.rb', line 20

def mount
  raise NotImplementedError
end

#mount!Object



11
12
13
14
15
16
17
18
# File 'lib/valkyrie-sshfs/builders/base.rb', line 11

def mount!
  paths.each do |src, target|
    info("unmounting", src: target)
    unmount(target)
    info("mounting", src: src, target: target)
    mount(src, target)
  end
end

#pathsObject



24
25
26
# File 'lib/valkyrie-sshfs/builders/base.rb', line 24

def paths
  machine.config.vsshfs.paths
end