Sha256: 8cfc8de4bd56fe3beb4b799a889fb15767afb1513a83207198928087e85f7cdf

Contents?: true

Size: 723 Bytes

Versions: 14

Compression:

Stored size: 723 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::Model::Provisioner.register('hosts', self)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
vagrant-hosts-2.2.3 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-2.2.2 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-2.2.1 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-2.2.0 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-2.1.5 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-2.1.4 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-2.1.3 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-2.1.2 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-2.1.1 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-2.1.0 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-2.0.0 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-2.0.0rc1 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-1.1.5 lib/vagrant-hosts/config_builder.rb
vagrant-hosts-1.1.4 lib/vagrant-hosts/config_builder.rb