Sha256: 45a3eed97f12785c295a8247916ba021b7d4ad92b4b140e4435986c5302a33ef
Contents?: true
Size: 1.33 KB
Versions: 43
Compression:
Stored size: 1.33 KB
Contents
require 'zip' require_relative 'temp_dir' module Inferno module Terminology module Tasks class UnzipUMLS include TempDir attr_reader :version def initialize(version:) @version = version end def run # https://stackoverflow.com/questions/19754883/how-to-unzip-a-zip-file-containing-folders-and-files-in-rails-while-keeping-the Zip::File.open(umls_zip_path) do |zip_file| # Handle entries one by one zip_file.each do |entry| # Extract to file/directory/symlink Inferno.logger.info "Extracting #{entry.name}" f_path = File.join(umls_dir, entry.name) FileUtils.mkdir_p(File.dirname(f_path)) zip_file.extract(entry, f_path) unless File.exist?(f_path) end end wildcard_path = "#{umls_dir}/20*" Zip::File.open(File.expand_path("#{Dir[wildcard_path][0]}/mmsys.zip")) do |zip_file| zip_file.each do |entry| Inferno.logger.info "Extracting #{entry.name}" f_path = File.join((Dir[wildcard_path][0]).to_s, entry.name) FileUtils.mkdir_p(File.dirname(f_path)) zip_file.extract(entry, f_path) unless File.exist?(f_path) end end end end end end end
Version data entries
43 entries across 43 versions & 1 rubygems