lib/vagrant-invade/module/plugin/hostmanager/hostmanager.rb in vagrant-invade-0.6.0 vs lib/vagrant-invade/module/plugin/hostmanager/hostmanager.rb in vagrant-invade-0.6.1

- old
+ new

@@ -3,45 +3,40 @@ module InvadeModule module Plugin class Hostmanager < InvadeModule + require 'vagrant' + attr_reader :result attr_accessor :machine_name, :ui, :hostmanager_data - def initialize(machine_name, ui, hostmanager_data, result: nil) + def initialize(machine_name, hostmanager_data, result: nil) @machine_name = machine_name @hostmanager_data = hostmanager_data - @ui = ui @result = result end def build - if Vagrant.has_plugin?('vagrant-hostmanager') + b = binding - b = binding + begin - begin + # Get machine name + machine_name = @machine_name - # Get machine name - machine_name = @machine_name + # Values for hostmanager section + enabled = @hostmanager_data['enabled'] + manage_host = @hostmanager_data['manage_host'] + ignore_private_ip = @hostmanager_data['ignore_private_ip'] + include_offline =@hostmanager_data['include_offline'] + aliases = @hostmanager_data['aliases'] - # Values for hostmanager section - enabled = @hostmanager_data['enabled'] - manage_host = @hostmanager_data['manage_host'] - ignore_private_ip = @hostmanager_data['ignore_private_ip'] - include_offline =@hostmanager_data['include_offline'] - aliases = @hostmanager_data['aliases'] - - eruby = Erubis::Eruby.new(File.read(self.get_template_path(__FILE__))) - @result = eruby.result b - rescue TypeError, SyntaxError, SystemCallError => e - raise(e) - end - else - @ui.error("[Invade] Plugin 'vagrant-hostmanager' not installed but defined. Use 'vagrant plugin install vagrant-hostmanager' to install it.") - @result = '' + 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 end end