Sha256: 467a23d25f12c57745ad40242621a86c6fcd7318ab046dd4eb00a019a41adab5

Contents?: true

Size: 434 Bytes

Versions: 4

Compression:

Stored size: 434 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(file) == '.tar'
      `tar -xf #{file}`
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trafficbroker-mandy-0.2.4.3 lib/packer.rb
trafficbroker-mandy-0.2.4.4 lib/packer.rb
trafficbroker-mandy-0.2.4.5 lib/packer.rb
trafficbroker-mandy-0.2.4.6 lib/packer.rb