Class: VagrantPlugins::Recipe::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



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

def initialize
  @env     = {}
  @bundler = UNSET_VALUE
  @chef  = UNSET_VALUE
  @json = UNSET_VALUE
end

Instance Attribute Details

#bundlerObject

Returns the value of attribute bundler.



6
7
8
# File 'lib/vagrant-recipe/config.rb', line 6

def bundler
  @bundler
end

#chefObject

Returns the value of attribute chef.



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

def chef
  @chef
end

#envObject (readonly)

Returns the value of attribute env.



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

def env
  @env
end

#jsonObject

Returns the value of attribute json.



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

def json
  @json
end

Instance Method Details

#finalize!Object



25
26
27
28
29
# File 'lib/vagrant-recipe/config.rb', line 25

def finalize!
  @chef  = '/tmp/vagrant-chef-1/solo.rb' if @chef  == UNSET_VALUE
  @json  = '/tmp/vagrant-chef-1/dna.json' if @json  == UNSET_VALUE
  @bundler = false      if @bundler == UNSET_VALUE
end

#validate(_) ⇒ Object



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

def validate(_)
  return { 'exec' => ['bundler should be boolean'] } unless [true, false].include?(@bundler)
  return { 'exec' => ['chef should be a string'] } unless @chef.is_a?(String)
  return { 'exec' => ['json should be a string'] } unless @json.is_a?(String)

  {}
end