Sha256: 04ab4af9533e807a1954a5e606ab877d64b78651095e6b534ad8ab1c3c29150a

Contents?: true

Size: 755 Bytes

Versions: 5

Compression:

Stored size: 755 Bytes

Contents

module Landrush
  class Config < Vagrant.plugin('2', :config)
    attr_accessor :hosts

    def initialize
      @hosts = {}
      @enabled = false
    end

    def enable(enabled=true)
      @enabled = true
    end

    def disable
      @enabled = false
    end

    def enabled?
      @enabled
    end

    def host(hostname, ip_address)
      @hosts[hostname] = ip_address
    end

    def merge(other)
      super.tap do |result|
        result.hosts = @hosts.merge(other.hosts)
      end
    end

    def validate(machine)
      if enabled?
        unless machine.config.vm.hostname.to_s.length > 0
          return { 'landrush' => ['you must specify a hostname so we can make a DNS entry for it'] }
        end
      end
      {}
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
landrush-0.9.0 lib/landrush/config.rb
landrush-0.8.0 lib/landrush/config.rb
landrush-0.7.1 lib/landrush/config.rb
landrush-0.7.0 lib/landrush/config.rb
landrush-0.6.0 lib/landrush/config.rb