Class: CfDeployer::ConfigLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/cf_deployer/config_loader.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.component_json(component, config) ⇒ Object

Raises:



4
5
6
7
8
# File 'lib/cf_deployer/config_loader.rb', line 4

def self.component_json component, config
  json_file = File.join(config[:config_dir], "#{component}.json")
  raise ApplicationError.new("#{json_file} is missing") unless File.exists?(json_file)
  ERB.new(File.read(json_file)).result(binding)
end

Instance Method Details

#load(options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cf_deployer/config_loader.rb', line 10

def load(options)
  config_text = File.read(options[:'config-file'])
  erbed_config = erb_with_environment_and_region(config_text, options[:environment], options[:region])
  yaml = symbolize_all_keys(load_yaml(erbed_config))
  @config = options.merge(yaml)
  @config[:components] ||= {}
  @config[:settings] ||= {}
  @config[:environments] ||= {}
  @config[:tags] ||= {}
  get_targets
  copy_config_dir
  merge_section(:settings)
  merge_section(:inputs)
  merge_section(:tags)
  copy_region_app_env_component
  get_cf_template_keys('Parameters')
  get_cf_template_keys('Outputs')
  set_default_settings
  @config.delete(:settings)
  @config
end