Sha256: d642d467b8e968ce7c16abd17a6f36575e1d07f35c01804c255ca3576a78a35c

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

module VagrantPlugins
  module Invade
    module Builder

      require 'erubis'

      class HostManager

        attr_reader :result
        attr_accessor :hostmanager_data

        def initialize(hostmanager_data, result: nil)
          @hostmanager_data = hostmanager_data
          @result = result
        end

        def build
          b = binding
          template_file = "#{TEMPLATE_PATH}/hostmanager.erb"

          begin

            # Values for hostmanager part
            enabled = @hostmanager_data['enabled']
            manage_host = @hostmanager_data['manage_host']
            manage_guest = @hostmanager_data['manage_guest']
            ignore_private_ip = @hostmanager_data['ignore_private_ip']
            include_offline = @hostmanager_data['include_offline']

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

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vagrant-invade-0.5.5 lib/vagrant-invade/builder/hostmanager.rb
vagrant-invade-0.5.4 lib/vagrant-invade/builder/hostmanager.rb
vagrant-invade-0.5.3 lib/vagrant-invade/builder/hostmanager.rb
vagrant-invade-0.5.2 lib/vagrant-invade/builder/hostmanager.rb
vagrant-invade-0.5.1 lib/vagrant-invade/builder/hostmanager.rb
vagrant-invade-0.5.0 lib/vagrant-invade/builder/hostmanager.rb