Sha256: 048de993975e6436777c854f2e38b1bea6d01114782a045927b51b18ca941fc9

Contents?: true

Size: 1.26 KB

Versions: 21

Compression:

Stored size: 1.26 KB

Contents

module VagrantPlugins
  module Invade
    module Builder
      module Provider

        require 'erubis'

        class VirtualBox

          attr_reader :result
          attr_accessor :machine_name, :virtualbox_data

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

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

            begin

              # Get machine name
              machine_name = @machine_name

              # Values for provider section
              @virtualbox_data['name'] ? name = @virtualbox_data['name'] : name = @machine_name
              type = @virtualbox_data['type']
              cpus = @virtualbox_data['cores']
              memory = @virtualbox_data['memory']
              nicspeed = @virtualbox_data['nicspeed']
              natdns = @virtualbox_data['natdns']

              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
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
vagrant-invade-0.5.5 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.5.4 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.5.3 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.5.2 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.5.1 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.5.0 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.4.8 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.4.7 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.4.6 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.4.5 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.4.4 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.4.3 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.4.2 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.4.1 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.4.0 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.4.0.pre.alpha lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.3.4 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.3.3 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.3.2 lib/vagrant-invade/builder/provider/virtualbox.rb
vagrant-invade-0.3.0 lib/vagrant-invade/builder/provider/virtualbox.rb