Class: VagrantPlugins::LibrarianPuppet::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-librarian-puppet/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
16
# File 'lib/vagrant-librarian-puppet/config.rb', line 10

def initialize
  @puppetfile_dir = UNSET_VALUE
  @placeholder_filename = UNSET_VALUE
  @use_v1_api = UNSET_VALUE
  @destructive = UNSET_VALUE
  @resolve_options = UNSET_VALUE
end

Instance Attribute Details

#destructiveObject

Returns the value of attribute destructive.



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

def destructive
  @destructive
end

#placeholder_filenameObject

Returns the value of attribute placeholder_filename.



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

def placeholder_filename
  @placeholder_filename
end

#puppetfile_dirObject

Returns the value of attribute puppetfile_dir.



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

def puppetfile_dir
  @puppetfile_dir
end

#resolve_optionsObject

Returns the value of attribute resolve_options.



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

def resolve_options
  @resolve_options
end

#use_v1_apiObject

Returns the value of attribute use_v1_api.



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

def use_v1_api
  @use_v1_api
end

Instance Method Details

#destructObject



42
43
44
# File 'lib/vagrant-librarian-puppet/config.rb', line 42

def destruct
  @destruct ||= true
end

#finalize!Object



18
19
20
21
22
23
24
# File 'lib/vagrant-librarian-puppet/config.rb', line 18

def finalize!
  @puppetfile_dir = '.' if @puppetfile_dir == UNSET_VALUE
  @placeholder_filename = '.PLACEHOLDER' if @placeholder_filename == UNSET_VALUE
  @resolve_options = {} if @resolve_options == UNSET_VALUE
  @use_v1_api = '1' if @use_v1_api == UNSET_VALUE
  @destructive = true if @destructive == UNSET_VALUE
end

#puppetfile_path(puppetfile_dir) ⇒ Object



34
35
36
# File 'lib/vagrant-librarian-puppet/config.rb', line 34

def puppetfile_path(puppetfile_dir)
  @puppetfile_path ||= puppetfile_dir ? File.join(puppetfile_dir, 'Puppetfile') : 'Puppetfile'
end

#validate(machine) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/vagrant-librarian-puppet/config.rb', line 26

def validate(machine)
  errors = []
  if not @resolve_options.kind_of?(Hash)
    errors << '`resolve_options` must be a hash'
  end
  return { 'vagrant-librarian-puppet' => errors }
end