20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/dependency_spy/helper/config_file.rb', line 20
def self.get_config(config_file_path = nil)
if !config_file_path.nil? && !File.file?(config_file_path)
puts 'Config file specified but not found.'
exit(10)
end
begin
file_path = config_file_path || '.depspy.yml'
config = YAML.load_file(file_path) || {}
config.slice(*SAFE_CONFIG_PARAMS)
rescue Errno::ENOENT
{}
rescue Psych::SyntaxError => e
puts 'Config File Parsing Error:'
puts e.message
exit(10)
end
end
|