Module: Bitferry::Restic

Extended by:
Logging
Includes:
Logging
Defined in:
lib/bitferry.rb

Defined Under Namespace

Classes: Backup, Restore, Task

Class Method Summary collapse

Methods included from Logging

log, log, log=

Class Method Details

.exec(*args) ⇒ Object



1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
# File 'lib/bitferry.rb', line 1037

def self.exec(*args)
  cmd = [executable] + args
  log.debug(cmd.collect(&:shellescape).join(' '))
  stdout, status = Open3.capture2(*cmd)
  unless status.success?
    msg = "restic exit code #{status.to_i}"
    log.error(msg)
    raise RuntimeError, msg
  end
  stdout.strip
end

.executableObject



1034
# File 'lib/bitferry.rb', line 1034

def self.executable = @executable ||= (restic = ENV['RESTIC']).nil? ? 'restic' : restic