Module: DockerSync::ConfigLocator

Defined in:
lib/docker-sync/config/config_locator.rb

Overview

helps us loading our config files, GlobalConfig and ProjectConfig

Constant Summary collapse

ERROR_MISSING_PROJECT_CONFIG =
'No docker-sync.yml configuration found in your path ( traversing up ) '\
'Did you define it for your project?'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.global_config_pathObject

Returns the value of attribute global_config_path.



11
12
13
# File 'lib/docker-sync/config/config_locator.rb', line 11

def global_config_path
  @global_config_path
end

Class Method Details

.current_global_config_pathString

Returns The path to the global config location.

Returns:

  • (String)

    The path to the global config location



13
14
15
16
17
# File 'lib/docker-sync/config/config_locator.rb', line 13

def current_global_config_path
  path = global_config_path
  path = File.expand_path('~/.docker-sync-global.yml') if path.nil?
  path
end

.lookup_project_config_pathString

Returns the path to the project configuration found.

Returns:

  • (String)

    the path to the project configuration found

Raises:



20
21
22
23
24
25
26
# File 'lib/docker-sync/config/config_locator.rb', line 20

def lookup_project_config_path
  files = project_config_find

  raise ERROR_MISSING_PROJECT_CONFIG if files.empty?

  files.pop
end