Class: ConfigurationManager::Merger

Inherits:
Object
  • Object
show all
Defined in:
lib/configuration_manager/merger.rb

Class Method Summary collapse

Class Method Details

.config(theme_name) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/configuration_manager/merger.rb', line 11

def config(theme_name)
  common = YAML.load_file "#{Rails.root}/config/application.common.dev.yml"
  theme = YAML.load_file "#{Rails.root}/config/application.#{theme_name}.dev.yml"

  {
    "development" => get(common, "development").deep_merge( get(theme, "development") ),
    "test" => get(common, "test").deep_merge( get(theme, "test") )
  }
end

.write(theme_name) ⇒ Object



5
6
7
8
9
# File 'lib/configuration_manager/merger.rb', line 5

def write(theme_name)
  File.open("#{Rails.root}/config/application.yml", "w") do |file|
    file.write config(theme_name).to_yaml
  end
end