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

Class Method Details

.exec(*args) ⇒ Object



963
964
965
966
967
968
969
970
971
972
973
# File 'lib/bitferry.rb', line 963

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



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

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