85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/sqa/config.rb', line 85
def from_file
return if config_file.nil?
if File.exist?(config_file) &&
File.file?(config_file) &&
File.readable?(config_file)
type = File.extname(config_file).downcase
else
type = "invalid"
end
if ".json" == type
incoming = form_json
elsif %w[.yml .yaml].include?(type)
incoming = from_yaml
elsif ".toml" == type
incoming = from_toml
else
raise BadParameterError, "Invalid Config File: #{config_file}"
end
if incoming.has_key? :data_dir
incoming[:data_dir] = incoming[:data_dir].gsub(/^~/, Nenv.home)
end
merge! incoming
end
|