Class: StackedConfig::Layers::SystemLayer

Inherits:
GenericLayer
  • Object
show all
Defined in:
lib/stacked_config/layers/system_layer.rb

Direct Known Subclasses

GlobalLayer

Constant Summary collapse

SYSTEM_CONFIG_ROOT =
{
    windows: [File.join(ENV['systemRoot'] || '', 'Config')],
    unix: '/etc'
}

Constants included from SourceHelper

SourceHelper::DEFAULT_OS_FLAVOUR, SourceHelper::EXTENSIONS, SourceHelper::OS_FLAVOURS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GenericLayer

#initialize, #possible_config_files, #rescan

Methods included from SourceHelper

included, os_flavour, #os_flavour, supported_oses, #supported_oses

Constructor Details

This class inherits a constructor from StackedConfig::Layers::GenericLayer

Class Method Details

.system_config_rootObject



11
12
13
# File 'lib/stacked_config/layers/system_layer.rb', line 11

def self.system_config_root
  SYSTEM_CONFIG_ROOT[os_flavour]
end

Instance Method Details

#perform_substitutions(path_part) ⇒ Object



27
28
29
30
31
# File 'lib/stacked_config/layers/system_layer.rb', line 27

def perform_substitutions path_part
  res = path_part.dup
  res.gsub! '##SYSTEM_CONFIG_ROOT##', system_config_root
  res
end

#possible_sourcesObject



20
21
22
23
24
25
# File 'lib/stacked_config/layers/system_layer.rb', line 20

def possible_sources
  [
      ['##SYSTEM_CONFIG_ROOT##', 'stacked_config.##EXTENSION##' ],
      ['##SYSTEM_CONFIG_ROOT##', 'stacked_config', 'config.##EXTENSION##' ]
  ]
end

#system_config_rootObject



15
16
17
# File 'lib/stacked_config/layers/system_layer.rb', line 15

def system_config_root
  self.class.system_config_root
end