Module: EPC::Command::Config::InstanceMethods

Defined in:
lib/epc/modules/config.rb

Instance Method Summary collapse

Instance Method Details

#extract_configuration_level(path, target) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/epc/modules/config.rb', line 10

def extract_configuration_level(path, target)
  config_type, config_id = target rescue [nil, nil]

  if config_id.nil?
    if EPC::Config.is_project_dir?(path)
      config_id = EPC::Config.get_project_value(path, "id")
      config_type = "Project"
    elsif EPC::Config.is_solution_dir?(path)
      config_id = EPC::Config.get_solution_value(path, "id")
      config_type = "Solution"
    end
  end

  return [config_type, config_id]
end

#parse_config_value_file(file, config_type, config_id) ⇒ Object



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

def parse_config_value_file(file, config_type, config_id)
  params = []
  params = EPC::Config.read_content_as_json(file)
  params.each do |param|
    if param[:configurable_type].nil? || param[:configurable_id].nil?
      param[:configurable_type] = config_type
      param[:configurable_id] = config_id
    end
  end
  params
end