28
29
30
31
32
33
34
35
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
|
# File 'lib/solano/cli/config.rb', line 28
def read_config(raise_error)
config = nil
raw_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
raw_config = File.read(cfgfile)
if raw_config && raw_config !~ /\A\s*\z/ then
config = YAML.load(raw_config)
config = hash_stringify_keys(config)
config = config['solano'] || config['tddium'] || config
end
rescue Exception => e
message = Text::Warning::YAML_PARSE_FAILED % cfgfile
if raise_error then
raise ::Solano::SolanoError.new(message)
else
say message
end
end
end
config ||= Hash.new
raw_config ||= ''
return [config, raw_config]
end
|