Class: Jfrog::Saas::Log::Unzip

Inherits:
Object
  • Object
show all
Defined in:
lib/jfrog/saas/log/unzipper.rb

Instance Method Summary collapse

Instance Method Details

#extract(solution, source_file, target_path, target_file_name, gzip_content) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jfrog/saas/log/unzipper.rb', line 14

def extract(solution, source_file, target_path, target_file_name, gzip_content)
  file_mgr = FileManager.new
  sol_tgt_path = file_mgr.check_and_create_dir(solution, target_path)
  unless gzip_content.nil?
    File.open("#{sol_tgt_path}/#{target_file_name}", 'a') do |fp|
      fp.write(Zlib::GzipReader.new(StringIO.new(gzip_content)).read)
    end
    MessageUtils.instance.log_message(MessageUtils::EXTRACT_LOG_FILE_SUCCESS, { "param1": source_file.to_s,
                                                                                "param2": "#{sol_tgt_path}/#{target_file_name}",
                                                                                "#{MessageUtils::LOG_LEVEL}": CommonUtils::LOG_INFO,
                                                                                "#{MessageUtils::SOLUTION}": solution })
  end
end