Sha256: fadb7d3f70621ffc855064caf6b51e6d1f63f9fab2d819ac26e536364d8a3446

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

module VagrantPlugins
  module Invade
    module Builder

      require 'erubis'

      class Machine

        attr_reader :result
        attr_accessor :machine_data

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

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

          begin

            # Machine name
            machine_name = @machine_name

            # Data to build machine entry
            vm = @machine_data['vm']
            network = @machine_data['network']
            ssh = @machine_data['ssh']
            provider = @machine_data['provider']
            synced_folder = @machine_data['synced_folder']
            plugin = @machine_data['plugin']
            provision = @machine_data['provision']

            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/machine.rb
vagrant-invade-0.5.4 lib/vagrant-invade/builder/machine.rb
vagrant-invade-0.5.3 lib/vagrant-invade/builder/machine.rb
vagrant-invade-0.5.2 lib/vagrant-invade/builder/machine.rb
vagrant-invade-0.5.1 lib/vagrant-invade/builder/machine.rb
vagrant-invade-0.5.0 lib/vagrant-invade/builder/machine.rb