module Rozporek::Extract

Public Instance Methods

call(file_hash, dest, root) click to toggle source
# File lib/rozporek/extract.rb, line 5
def call(file_hash, dest, root)
  Zip::File.open(file_hash[:tempfile].path) do |zip_file|
    zip_file.each do |f|
      f_path = File.join("#{root}/public/#{env_prefix}#{dest}", f.name)
      FileUtils.mkdir_p(File.dirname(f_path))
      zip_file.extract(f, f_path)
    end
  end
end
env_prefix() click to toggle source
# File lib/rozporek/extract.rb, line 15
def env_prefix
  if ENV['RACK_ENV'] == 'test'
    'test'
  else
    ''
  end
end