class Martilla::CLI

Public Instance Methods

backup(filepath) click to toggle source
# 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
setup(filename = 'martilla.yml') click to toggle source
# File lib/martilla/cli.rb, line 25
def setup(filename = 'martilla.yml')
  file_path = File.join(Dir.pwd, filename)
  File.write(file_path, Backup.sample_config.to_yaml)
end
version() click to toggle source
# File lib/martilla/cli.rb, line 31
def version
  puts VERSION
end