Class: Vagrant::VSshFs::Builders::Base
- Inherits:
-
Object
- Object
- Vagrant::VSshFs::Builders::Base
- Defined in:
- lib/valkyrie-sshfs/builders/base.rb
Instance Attribute Summary collapse
-
#machine ⇒ Object
readonly
Returns the value of attribute machine.
-
#ui ⇒ Object
readonly
Returns the value of attribute ui.
Instance Method Summary collapse
- #ask(key, *args) ⇒ Object
- #error(key, *args) ⇒ Object
- #i18n(key, *args) ⇒ Object
- #info(key, *args) ⇒ Object
-
#initialize(machine, ui) ⇒ Base
constructor
A new instance of Base.
- #mount ⇒ Object
- #mount! ⇒ Object
- #paths ⇒ Object
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
#machine ⇒ Object (readonly)
Returns the value of attribute machine.
5 6 7 |
# File 'lib/valkyrie-sshfs/builders/base.rb', line 5 def machine @machine end |
#ui ⇒ Object (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
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 |
#mount ⇒ Object
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 |
#paths ⇒ Object
24 25 26 |
# File 'lib/valkyrie-sshfs/builders/base.rb', line 24 def paths machine.config.vsshfs.paths end |