Module: Superset::FileUtilities

Included in:
Dashboard::Export
Defined in:
lib/superset/file_utilities.rb

Instance Method Summary collapse

Instance Method Details

#unzip_file(zip_file, destination) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/superset/file_utilities.rb', line 5

def unzip_file(zip_file, destination)
  entries = []
  Zip::File.open(zip_file) do |zip|
    zip.each do |entry|
      entry_path = File.join(destination, entry.name)
      entries << entry_path
      FileUtils.mkdir_p(File.dirname(entry_path))
      zip.extract(entry, entry_path)
    end
  end
  puts entries
  entries # return array of extracted files
end