Class: TarsnapPruner::Tarsnap

Inherits:
Object
  • Object
show all
Defined in:
lib/tarsnap_pruner/tarsnap.rb

Overview

A class to encapsulate invoking the command-line tarsnap commands.

Instance Method Summary collapse

Constructor Details

#initialize(key_file) ⇒ Tarsnap

Returns a new instance of Tarsnap.



6
7
8
# File 'lib/tarsnap_pruner/tarsnap.rb', line 6

def initialize(key_file)
  @key_file = key_file
end

Instance Method Details

#delete(archive, cache_directory) ⇒ Object



18
19
20
# File 'lib/tarsnap_pruner/tarsnap.rb', line 18

def delete(archive, cache_directory)
  system "#{tarsnap} -d --keyfile #{@key_file} --cachedir #{cache_directory} -f #{archive.name} > /dev/null"
end

#fsck(cache_directory) ⇒ Object



14
15
16
# File 'lib/tarsnap_pruner/tarsnap.rb', line 14

def fsck(cache_directory)
  system "#{tarsnap} --fsck --keyfile #{@key_file} --cachedir #{cache_directory} > /dev/null"
end

#list_archivesObject



10
11
12
# File 'lib/tarsnap_pruner/tarsnap.rb', line 10

def list_archives
  `#{tarsnap} --list-archives --keyfile #{@key_file}`
end