Class: TerraspaceBundler::Extract::Zip

Inherits:
Object
  • Object
show all
Defined in:
lib/terraspace_bundler/extract/zip.rb

Class Method Summary collapse

Class Method Details

.extract(file, dest) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/terraspace_bundler/extract/zip.rb', line 6

def self.extract(file, dest)
  ::Zip::File.open(file) { |zip_file|
    zip_file.each { |f|
      f_path=File.join(dest, f.name)
      FileUtils.mkdir_p(File.dirname(f_path))
      zip_file.extract(f, f_path) unless File.exist?(f_path)
    }
  }
end