Sha256: dfad139d1e7080173e45c9d646731f46af12ef0144e6b0384427ead5a6f154da

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

require 'config_builder/model'

# Integration with ConfigBuilder 1.x and newer
#
# @since 2.7.0
module VagrantHosts
  module ConfigBuilder
    class Model < ::ConfigBuilder::Model::Provisioner::Base

      # @!attribute [rw] hosts
      def_model_attribute :hosts
      # @!attribute [rw] autoconfigure
      def_model_attribute :autoconfigure
      # @!attribute [rw] add_localhost_hostnames
      def_model_attribute :add_localhost_hostnames
      # @!attribute [rw] sync_hosts
      def_model_attribute :sync_hosts
      # @!attribute [rw] exports
      def_model_attribute :exports
      # @!attribute [rw] exports
      def_model_attribute :imports
      # @!attribute [rw] change_hostname
      def_model_attribute :change_hostname

      # @private
      def configure_exports(config, val)
        val.each do |k, v|
          config.exports[k] ||= []
          config.exports[k] += v
        end
      end

      # @private
      def configure_imports(config, val)
        config.imports += val
        config.imports.uniq!
      end

      # @private
      def configure_hosts(config, val)
        val.each do |(address, aliases)|
          config.add_host(address, aliases)
        end
      end

      ::ConfigBuilder::Model::Provisioner.register('hosts', self)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-hosts-2.9.0 lib/vagrant-hosts/config_builder/1_x.rb