Revision 5101337c
Added by Marc Dequènes almost 14 years ago
- ID 5101337c2e892a386d5f98792ceee3aa9f44ef35
lib/cyborghood/base/config.rb | ||
---|---|---|
config = merge_into_default_config(g_default_config, g_def)
|
||
|
||
unless name.nil?
|
||
config_spc_raw = load_config_raw(name)
|
||
spc_def = parse('config', name, config_spc_raw) || {}
|
||
default_config_spc = load_default_config(name)
|
||
spc_config = merge_into_default_config(default_config_spc, spc_def)
|
||
|
||
config = merge_into_default_config(config, spc_config)
|
||
# if no default config file is present, then a cyborg-specific
|
||
# config for this model is not needed
|
||
if default_config_spc
|
||
config_spc_raw = load_config_raw(name)
|
||
spc_def = parse('config', name, config_spc_raw) || {}
|
||
spc_config = merge_into_default_config(default_config_spc, spc_def)
|
||
|
||
config = merge_into_default_config(config, spc_config)
|
||
end
|
||
end
|
||
|
||
config['bot_name'] = name
|
||
... | ... | |
exit 1
|
||
end
|
||
|
||
def self.load_default_config(type = "global")
|
||
def self.load_default_config(type = 'global')
|
||
filename = File.join(DATA_DIR, "default_config", type.downcase + ".yaml")
|
||
|
||
return unless File.exists?(filename) or type == 'global'
|
||
|
||
default_config_raw = File.read(filename)
|
||
default_config = parse(':defaults:', type, default_config_raw, false)
|
||
default_config || {}
|
Also available in: Unified diff
[evol] Config: when no default config file exist, then do not load cyborg-specific config, it is not needed