Module: Nucleus::Adapters::ArchiveConverter
- Extended by:
- Logging
- Defined in:
- lib/nucleus/core/file_handling/archive_converter.rb
Overview
The ArchiveConverter shall be used within the adapters to prepare application containers for deployment on the endpoint, by converting archives, e.g. from tar.gz to zip, to match the endpoint APIs requirements.
Class Method Summary collapse
-
.convert(file, current_format, destination_format, sanitize = false) ⇒ StringIO
Convert an archived application, the
file, from thecurrent_formatto thedestination_format.
Methods included from Logging
configure_logger_for, log, logger_for
Class Method Details
.convert(file, current_format, destination_format, sanitize = false) ⇒ StringIO
Convert an archived application, the file, from the current_format to the destination_format.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/nucleus/core/file_handling/archive_converter.rb', line 15 def self.convert(file, current_format, destination_format, sanitize = false) extraction_dir = "#{Dir.tmpdir}/nucleus.app.convert.cf.deploy.#{SecureRandom.uuid}" ArchiveExtractor.new.extract(file, extraction_dir, current_format) # sanitize if desired ApplicationRepoSanitizer.new.sanitize(extraction_dir) if sanitize return Archiver.new.compress(extraction_dir, destination_format) ensure # now delete the tmp directory again FileUtils.rm_rf(extraction_dir) if extraction_dir end |