8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/martilla/cli.rb', line 8
def backup(filepath)
file_path = Pathname.new(filepath)
file_path = File.join(Dir.pwd, file_path) if file_path.relative?
begin
backup_config = YAML.load_file(file_path)
rescue Psych::SyntaxError
puts "Invalid yaml-file found, at #{file_path}"
rescue Errno::EACCES
puts "Couldn't access file due to permissions at #{file_path}"
rescue Errno::ENOENT
puts "Couldn't access non-existent file #{file_path}"
else
backup = Backup.create(backup_config)
end
end
|