Class: VagrantPlugins::Soa::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-soa/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



7
8
9
10
# File 'lib/vagrant-soa/config.rb', line 7

def initialize
  @services = UNSET_VALUE
  @github_base = UNSET_VALUE
end

Instance Attribute Details

#github_baseObject

Returns the value of attribute github_base.



5
6
7
# File 'lib/vagrant-soa/config.rb', line 5

def github_base
  @github_base
end

#servicesObject

Returns the value of attribute services.



4
5
6
# File 'lib/vagrant-soa/config.rb', line 4

def services
  @services
end

Instance Method Details

#finalize!Object



12
13
14
15
# File 'lib/vagrant-soa/config.rb', line 12

def finalize!
  @services = nil if @services == UNSET_VALUE
  @github_base = nil if @github_base == UNSET_VALUE
end

#validate(machine) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vagrant-soa/config.rb', line 17

def validate(machine)
  errors = []

  if @services
    if not @services.kind_of?(Hash)
      errors << '`services` must be a hash of form service => {service config hash}'
    end
    @services.each_pair do |service, config|
      if not config.kind_of?(Hash)
        errors << "Invalid configuration for #{service}, config must be a hash, not #{config}"
      end
    end
  end

  return { 'soa' => errors }
end