class MetaBuild::Helper::ZipHelper
Public Class Methods
extract(file, path, target)
click to toggle source
# File lib/meta_build/helper/zip_helper.rb, line 7 def extract(file, path, target) Zip::File.open(file) do |zip_file| zip_file.each do |entry| next unless entry.name.start_with? path target_file = File.join(target, entry.name) if entry.directory? FileUtils.makedirs target_file next end dir = File.dirname target_file FileUtils.makedirs dir unless File.exist? dir File.open(target_file, 'wb') { |io| io.write entry.get_input_stream.read } end end end