Class: VagrantPlugins::ApplicationCookbooks::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



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

def initialize
  @url = UNSET_VALUE
  @ref = UNSET_VALUE
end

Instance Attribute Details

#refObject

git ref / branch to checkout



10
11
12
# File 'lib/vagrant-application-cookbooks/config.rb', line 10

def ref
  @ref
end

#urlObject

git url to clone from



8
9
10
# File 'lib/vagrant-application-cookbooks/config.rb', line 8

def url
  @url
end

Instance Method Details

#finalize!Object



25
26
27
28
29
30
31
32
# File 'lib/vagrant-application-cookbooks/config.rb', line 25

def finalize!
  @url = nil if @url == UNSET_VALUE
  if @url != nil
    @ref = 'master' if @ref == UNSET_VALUE
  else
    @ref = nil if @ref == UNSET_VALUE
  end
end

#validate(machine) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/vagrant-application-cookbooks/config.rb', line 17

def validate(machine)
  errors = _detected_errors
  if @ref != nil
    errors << "'app_cookbook.url' must be specified when 'app_cookbook.ref' is used" if @url.nil?
  end
  { "vagrant-application-cookbooks" => errors }
end