Sha256: f5eb617e7c2f52570ce94b31f59672e0fbae7ca41b03b784c05d598b671562d3

Contents?: true

Size: 443 Bytes

Versions: 1

Compression:

Stored size: 443 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"
      Dir.chdir(dir) { `tar -cf #{tmp_path} *` }
      tmp_path
    end
    
    def self.unpack(file)
      return false unless File.extname(payload) == '.tar'
      throw `tar -xf #{file}`
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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