Module: ConfigHelper

Defined in:
lib/helpers/config_helper.rb

Class Method Summary collapse

Class Method Details

.get_namespace_and_projectObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/helpers/config_helper.rb', line 2

def self.get_namespace_and_project
  namespace_path = "../.byld/config.yml"
  project_path = ".byld/config.yml"

  namespace_config = Config.load("../.byld/config.yml") if File.exist?(namespace_path)
  project_config = Config.load(".byld/config.yml") if File.exist?(project_path)

  if namespace_config.nil? or project_config.nil?
    puts "\n 🚫Config is missing! Note: command is valid only within block or gate root folder \n\n"
    exit
  end

  namespace_id = namespace_config['namespace']['id']
  project_id = project_config['project']['id']

  [namespace_id, project_id]
end