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

Class Method Summary collapse

Methods included from Logging

log, log

Class Method Details

.exec(*args) ⇒ Object



635
636
637
638
639
640
641
642
643
644
645
# File 'lib/bitferry.rb', line 635

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



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

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

.obscure(plain) ⇒ Object



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

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

.reveal(token) ⇒ Object



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

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