12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/anonymise/resource.rb', line 12
def content
if @path.nil?
puts 'Path to config file is required'.colorize(:red)
exit
end
if @path.start_with?('http')
yml_file = ''
elsif File.exist?(@path)
yml_file = File.open(@path)
else
puts 'File does not exist'.colorize(:red)
exit
end
content = YAML.safe_load(yml_file)
yml_file.close
if content.empty?
puts 'Config file is empty kindly check https://github.com/thirunjuguna/anonymise/blob/master/anonymise.yml'
exit
end
content
end
|