Sha256: 335e1c3d53e2d77558ca94f5166f5c9923219cd3dbe1da15b9cf35d2e43edf58

Contents?: true

Size: 1.12 KB

Versions: 21

Compression:

Stored size: 1.12 KB

Contents

module VagrantPlugins
  module Invade
    module Builder
      module Network
        require 'erubis'

        class PublicNetwork

          attr_reader :result
          attr_accessor :machine_name, :public_network_data

          def initialize(machine_name, public_network_data, result: nil)
            @machine_name = machine_name
            @public_network_data = public_network_data
            @result = result
          end

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

            begin

              # Get machine name
              machine_name = @machine_name

              # Values for network section
              ip = @public_network_data['ip']
              dhcp = @public_network_data['dhcp']
              bridge = @public_network_data['bridge']
              auto_config = @public_network_data['auto_config']

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

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
vagrant-invade-0.2.0 lib/vagrant-invade/builder/network/public_network.rb