From 0e05f77fb7b7e2aa535ec8879ae1f90d531680f1 Mon Sep 17 00:00:00 2001 From: g0tmi1k Date: Mon, 14 May 2018 13:37:34 +0100 Subject: [PATCH] Made offline extraction more verbose --- lib/common/common_helper.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/common/common_helper.rb b/lib/common/common_helper.rb index a9a9aa88..37a134f2 100644 --- a/lib/common/common_helper.rb +++ b/lib/common/common_helper.rb @@ -102,8 +102,18 @@ end def extract_db_zip Zip::File.open(DATA_FILE) do |zip_file| zip_file.each do |f| + # Feedback to the user + puts "[+] Extracting: #{File.basename(f.name)}" if verbose f_path = File.join(DATA_DIR, File.basename(f.name)) + + # Create folder FileUtils.mkdir_p(File.dirname(f_path)) + + # Delete if already there + puts "[+] Deleting: #{File.basename(f.name)}" if verbose and File.exist?(f_path) + FileUtils.rm(f_path) if File.exist?(f_path) + + # Extract zip_file.extract(f, f_path) end end