module Utilities

Constants

Error
ExecError

Public Instance Methods

exec(cmd, logger) click to toggle source
# File lib/github_snapshot/utilities.rb, line 7
def exec(cmd, logger)
  out, err, status = Open3.capture3 cmd
  if err.empty?
    logger.debug out unless out.empty?
  else
    logger.error "Open3 error:\n#{'='*79}\n#{err}Command was:\n#{cmd}\n#{'='*79}\n"
    raise Utilities::ExecError
  end
end
tar(file, logger) click to toggle source
# File lib/github_snapshot/utilities.rb, line 17
def tar(file, logger)
  if File.exists? file
    Utilities.exec "tar zcf #{file}.tar.gz #{file}", logger
  else
    logger.error "Unable to tar #{file}"
  end
end