diff options
author | Sarah Mei <sarahmei@gmail.com> | 2011-05-25 22:07:29 +0400 |
---|---|---|
committer | Sarah Mei <sarahmei@gmail.com> | 2011-05-25 22:07:29 +0400 |
commit | c6d61c68c01bbc7d2841b83771339b1bb3de35d1 (patch) | |
tree | 4dc501d45f3308d3a7a8b9a2c153f833265fe547 /lib | |
parent | f29a605a7c453b5ec537bbea304a1465c9e0fdcb (diff) |
Backfill some tests for app config, refactor base file name so people copy it instead of moving it
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app_config.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/app_config.rb b/lib/app_config.rb index 58683bea0..a23769f22 100644 --- a/lib/app_config.rb +++ b/lib/app_config.rb @@ -5,7 +5,12 @@ class AppConfig cattr_accessor :config_vars - + cattr_accessor :base_file_path + + def self.base_file_path + @@base_file_path || File.join(Rails.root, "config", "app_base.yml") + end + def self.[](key) config_vars[key] end @@ -27,10 +32,10 @@ class AppConfig end def self.load_config_for_environment(env) - if File.exist? "#{Rails.root}/config/app.yml.example" - all_envs = load_config_yaml "#{Rails.root}/config/app.yml.example" + if File.exist?(base_file_path) + all_envs = load_config_yaml(base_file_path) else - $stderr.puts "ERROR: Why have you deleted config/app.yml.example?" + $stderr.puts "OH NO! Required file #{base_file_path} doesn't exist! Did you move it?" all_envs = {} end if File.exist? "#{Rails.root}/config/app.yml" |