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.



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

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

Instance Attribute Details

#placeholder_filenameObject

Returns the value of attribute placeholder_filename.



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

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.



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

def resolve_options
  @resolve_options
end

Instance Method Details

#finalize!Object



14
15
16
17
18
# File 'lib/vagrant-librarian-puppet/config.rb', line 14

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

#puppetfile_pathObject



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

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

#validate(machine) ⇒ Object



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

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