Module: Backup::CommandHelper

Included in:
Adapters::Base, Backup::Connection::S3, Record::Local, Storage::Base
Defined in:
lib/backup/command_helper.rb

Instance Method Summary collapse

Instance Method Details

#log(command) ⇒ Object



10
11
12
# File 'lib/backup/command_helper.rb', line 10

def log(command)
  puts "Backup (#{Time.now.strftime("%Y-%m-%d %H:%M:%S %Z")}) => #{command}"
end

#run(command, opts = {}) ⇒ Object



3
4
5
6
7
8
# File 'lib/backup/command_helper.rb', line 3

def run(command, opts={})
  opts[:exit_on_failure] ||= false
  output = `#{command}`
  exit 1 if opts[:exit_on_failure] && !$?.success?
  output
end