Module: Doing::Util::Backup

Extended by:
Backup
Includes:
Doing::Util
Included in:
Backup
Defined in:
lib/doing/util_backup.rb

Overview

Backup utils

Instance Method Summary collapse

Methods included from Doing::Util

#args_for_editor, #deep_merge_hashes, #deep_merge_hashes!, #default_editor, #duplicable?, #duplicate_frozen_values, #editor_with_args, #exec_available, #find_default_editor, #first_available_exec, #mergable?, #merge_default_proc, #merge_values, #safe_load_file, #user_home, #write_to_file

Instance Method Details

#last_backup(filename = nil, count: 1) ⇒ String

Retrieve the most recent backup

Parameters:

  • filename (defaults to: nil)

    The filename

Returns:

#prune_backups(filename, limit = 10) ⇒ Object

Delete all but most recent 5 backups

Parameters:

  • limit (defaults to: 10)

    Maximum number of backups to retain

#redo_backup(filename = nil, count: 1) ⇒ Object

Undo last undo

Parameters:

  • filename (defaults to: nil)

    The filename

Raises:

  • (HistoryLimitError)

#restore_last_backup(filename = nil, count: 1) ⇒ Object

Restore the most recent backup. If a filename is provided, only backups of that filename will be used.

Parameters:

  • filename (defaults to: nil)

    The filename to restore, if different from default

Raises:

  • (HistoryLimitError)

#select_backup(filename = nil) ⇒ Object

Select from recent backups. If a filename is provided, only backups of that filename will be used.

Parameters:

  • filename (defaults to: nil)

    The filename to restore

Raises:

  • (MissingBackupFile)

#select_redo(filename = nil) ⇒ Object

Select from recent undos. If a filename is provided, only backups of that filename will be used.

Parameters:

  • filename (defaults to: nil)

    The filename to restore

Raises:

  • (HistoryLimitError)

#write_backup(filename = nil) ⇒ Object

Writes a copy of the content to a dated backup file in a hidden directory

Parameters:

  • filename (String) (defaults to: nil)

    The filename