Sha256: efd25c5dad09967e239808ced27f5e2d1ccdf5b9080ca9eb26c9266c681134a5

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

require 'config_builder/model'

module VagrantHosts
  module ConfigBuilder
    class Model < ::ConfigBuilder::Model::Base

      # @!attribute [rw] hosts
      attr_accessor :hosts
      # @!attribute [rw] autoconfigure
      attr_accessor :autoconfigure

      def initialize
        @hosts = []
      end

      def to_proc
        Proc.new do |vm_config|
          vm_config.provision :hosts do |h_config|
            h_config.autoconfigure = @autoconfigure if defined? @autoconfigure

            @hosts.each do |(address, aliases)|
              h_config.add_host address, aliases
            end
          end
        end
      end

      ::ConfigBuilder::ModelCollection.provisioner.register('hosts', self)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-hosts-1.1.2 lib/vagrant-hosts/config_builder.rb