def self.load(app)
conf_file = $CONFIG_FILE || "/etc/#{app.to_s.downcase}/config.yml"
puts "Loading configuration for #{app} from '#{conf_file}'..."
begin
conf_file = etc_conf = conf_file
unless File.exists? conf_file
conf_file = File.dirname(File.expand_path(__FILE__))+"/../../config.yml"
end
unless File.exists? conf_file
copy_example_config_file(app, etc_conf)
end
loaded_conf = HashWithIndifferentAccess.new(YAML.load_file(conf_file))
if $CONF
$CONF = HashWithIndifferentAccess.new($CONF)
$CONF = $CONF.merge(loaded_conf)
else
$CONF = loaded_conf
end
$CONF[:log][:file] = STDOUT unless $CONF[:log][:file]
rescue
raise "Your #{app} configuration may be invalid."+
" Please double-check check your config.yml file."+
" Make sure that you are using spaces instead of tabs for your indentation!!" +
"\n\nTHE UNDERLYING ERROR WAS:\n#{$!}"
end
end