Class: Vm::Watcher::VmObserver
- Inherits:
-
Object
- Object
- Vm::Watcher::VmObserver
- Defined in:
- lib/vm-watcher.rb
Instance Method Summary collapse
-
#initialize(observable, script) ⇒ VmObserver
constructor
A new instance of VmObserver.
- #provision ⇒ Object
Constructor Details
#initialize(observable, script) ⇒ VmObserver
Returns a new instance of VmObserver.
9 10 11 12 13 14 15 16 17 |
# File 'lib/vm-watcher.rb', line 9 def initialize(observable, script) observable.add_observer(self, :provision) @script = script @vagrant = Vagrant::Environment.new(:ui_class => Vagrant::UI::Basic) @vagrant.cli('up', '--no-provision') @vagrant.primary_vm.channel.ready? end |
Instance Method Details
#provision ⇒ Object
19 20 21 22 23 |
# File 'lib/vm-watcher.rb', line 19 def provision @vagrant.primary_vm.channel.execute(@script, false) do |type, data| @vagrant.primary_vm.ui.info(data.to_s, :prefix => false, :new_line => false, :channel => :out) end end |