Module: Bitferry::Rclone

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

Defined Under Namespace

Classes: Copy, Decrypt, Encrypt, Encryption, Equalize, Synchronize, Task, Update

Constant Summary collapse

ROUTE =
{
  encrypt: Encrypt,
  decrypt: Decrypt
}

Class Method Summary collapse

Methods included from Logging

log, log

Class Method Details

.exec(*args) ⇒ Object



669
670
671
672
673
674
675
676
677
678
679
# File 'lib/bitferry.rb', line 669

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

.executableObject



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

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

.obscure(plain) ⇒ Object



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

def self.obscure(plain) = exec('obscure', '--', plain)

.reveal(token) ⇒ Object



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

def self.reveal(token) = exec('reveal', '--', token)