Module: ConfigModule

Overview

tau config module

Defined Under Namespace

Classes: TakeltauConfig

Instance Method Summary collapse

Instance Method Details

#configObject

Returns global singleton config.

Returns:

  • (Object)

    global singleton config



40
41
42
# File 'lib/takeltau/lib/config.rb', line 40

def config
  TakeltauConfig.instance
end

#configured?(config_keys) ⇒ Boolean

Returns check if config keys are configured.

Returns:

  • (Boolean)

    check if config keys are configured



45
46
47
48
49
50
51
52
# File 'lib/takeltau/lib/config.rb', line 45

def configured?(config_keys)
  @configured = true
  config_keys.each do |config_key|
    next unless _check_key_defined? config_key
    next unless _check_key_set? config_key
  end
  @configured
end

#initialize_config(workdir) ⇒ Object

Initialize config rubocop:disable Metrics/AbcSize



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/takeltau/lib/config.rb', line 24

def initialize_config(workdir)
  project_root_dir = File.expand_path _get_project_root_dir workdir

  log.debug "takelage version: #{Takeltau::VERSION}"
  log.debug "Current working directory: #{Dir.pwd}"
  log.debug "Project root directory: #{project_root_dir}" unless project_root_dir.empty?

  TakeltauConfig.instance.default = _config_read_default project_root_dir
  TakeltauConfig.instance.home = _config_read_home
  TakeltauConfig.instance.project = _config_read_project project_root_dir
  TakeltauConfig.instance.envvars = _config_read_envvars
  TakeltauConfig.instance.active = _config_merge_active
end