class StackedConfig::Layers::UserLayer

Public Class Methods

user_config_root() click to toggle source
# File lib/stacked_config/layers/user_layer.rb, line 7
def self.user_config_root
  Dir.home
end

Public Instance Methods

perform_substitutions(path_part) click to toggle source
# File lib/stacked_config/layers/user_layer.rb, line 27
def perform_substitutions path_part
  res = path_part.dup
  res.gsub! '##USER_CONFIG_ROOT##', user_config_root

  exec_name = manager.nil? ? StackedConfig::Orchestrator.default_config_file_base_name : manager.config_file_base_name
  res.gsub! '##PROGRAM_NAME##', exec_name

  res
end
possible_sources() click to toggle source
# File lib/stacked_config/layers/user_layer.rb, line 16
def possible_sources
  [
      ['##USER_CONFIG_ROOT##', '.##PROGRAM_NAME##.##EXTENSION##' ],
      ['##USER_CONFIG_ROOT##', '.config', '##PROGRAM_NAME##.##EXTENSION##' ],
      ['##USER_CONFIG_ROOT##', '.config', '##PROGRAM_NAME##', 'config.##EXTENSION##' ],
      ['##USER_CONFIG_ROOT##', '.config', '##PROGRAM_NAME##', '##PROGRAM_NAME##.##EXTENSION##' ],
      ['##USER_CONFIG_ROOT##', '.##PROGRAM_NAME##', 'config.##EXTENSION##' ],
      ['##USER_CONFIG_ROOT##', '.##PROGRAM_NAME##', '##PROGRAM_NAME##.##EXTENSION##' ]
  ]
end
user_config_root() click to toggle source
# File lib/stacked_config/layers/user_layer.rb, line 11
def user_config_root
  self.class.user_config_root
end