Class: Bricolage::ConfigLoader

Inherits:
Object
  • Object
show all
Includes:
EmbeddedCodeAPI
Defined in:
lib/bricolage/configloader.rb

Direct Known Subclasses

DataSourceFactory::Loader

Constant Summary

Constants included from VacuumLock

VacuumLock::DEFAULT_VACUUM_LOCK_FILE, VacuumLock::DEFAULT_VACUUM_LOCK_TIMEOUT

Instance Method Summary collapse

Methods included from VacuumLock

cleanup_vacuum_lock, create_lockfile_cmd, create_vacuum_lock_file, enable_vacuum_lock?, locking?, psql_serialize_vacuum_begin, psql_serialize_vacuum_end, serialize_vacuum, using, #using_vacuum_lock, vacuum_lock_parameters

Constructor Details

#initialize(app_home) ⇒ ConfigLoader

Returns a new instance of ConfigLoader.



13
14
15
16
# File 'lib/bricolage/configloader.rb', line 13

def initialize(app_home)
  @app_home = app_home
  @base_dir = Pathname('.')
end

Instance Method Details

#eruby(text, path) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/bricolage/configloader.rb', line 34

def eruby(text, path)
  erb = ERB.new(text, nil, '%-')
  erb.filename = path.to_s
  push_base_dir(path) {
    erb.result(binding())
  }
end

#load_eruby(path) ⇒ Object Also known as: load_text



22
23
24
# File 'lib/bricolage/configloader.rb', line 22

def load_eruby(path)
  eruby(load_file(path), path)
end

#load_file(path) ⇒ Object



28
29
30
31
32
# File 'lib/bricolage/configloader.rb', line 28

def load_file(path)
  File.read(path)
rescue SystemCallError => err
  raise ParameterError, "could not read file: #{err.message}"
end

#load_yaml(path) ⇒ Object



18
19
20
# File 'lib/bricolage/configloader.rb', line 18

def load_yaml(path)
  parse_yaml(load_eruby(path), path)
end