Sha256: 07ebe2bc8bc532ff4bc07c01ddeeb342509ba88a16ad1554307b0225326c1142

Contents?: true

Size: 435 Bytes

Versions: 1

Compression:

Stored size: 435 Bytes

Contents

require "fileutils"

module Mandy
  class Packer
    TMP_DIR = '/tmp/mandy'
    
    def self.pack(dir)
      return dir if File.file?(dir)
      FileUtils.mkdir_p(TMP_DIR)
      tmp_path = "#{TMP_DIR}/packed-job-#{Time.now.to_i}.tar"
      `tar -cf #{tmp_path} #{dir}`
      tmp_path
    end
    
    def self.unpack(file)
      return false unless File.extname(payload) == '.tar'
      `tar -xf --overwrite #{file}`
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trafficbroker-mandy-0.2.2 lib/packer.rb