36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/tddium/cli/config.rb', line 36
def load_config
config = nil
root = @scm.root
cfgfile_pair = pick_config_pair(root, Config::CONFIG_PATHS)
cfgfile_pair_depr = pick_config_pair(root, Config::CONFIG_PATHS_DEPRECATED)
if cfgfile_pair && cfgfile_pair_depr then
abort Text::Error::CONFIG_PATHS_COLLISION % [cfgfile_pair, cfgfile_pair_depr]
end
cfgfile_pair = cfgfile_pair_depr if cfgfile_pair.nil?
if cfgfile_pair && cfgfile_pair.first then
cfgfile = cfgfile_pair.first
@config_filename = cfgfile_pair[1]
begin
rawconfig = File.read(cfgfile)
if rawconfig && rawconfig !~ /\A\s*\z/ then
config = YAML.load(rawconfig)
config = hash_stringify_keys(config)
config = config['solano'] || config['tddium'] || config
end
rescue Exception => e
warn(Text::Warning::YAML_PARSE_FAILED % cfgfile)
end
end
config ||= Hash.new
return config
end
|