Class: BulkImports::ArchiveExtractionService

Inherits:
Object
  • Object
show all
Includes:
Gitlab::ImportExport::CommandLineUtil
Defined in:
app/services/bulk_imports/archive_extraction_service.rb

Constant Summary

Constants included from Gitlab::ImportExport::CommandLineUtil

Gitlab::ImportExport::CommandLineUtil::DEFAULT_DIR_MODE, Gitlab::ImportExport::CommandLineUtil::FileOversizedError, Gitlab::ImportExport::CommandLineUtil::UNTAR_MASK

Instance Method Summary collapse

Methods included from Gitlab::ImportExport::CommandLineUtil

#gunzip, #gzip, #gzip_with_options, #mkdir_p, #tar_cf, #tar_czf, #untar_xf, #untar_zxf

Constructor Details

#initialize(tmpdir:, filename:) ⇒ ArchiveExtractionService

Returns a new instance of ArchiveExtractionService.


24
25
26
27
28
# File 'app/services/bulk_imports/archive_extraction_service.rb', line 24

def initialize(tmpdir:, filename:)
  @tmpdir = tmpdir
  @filename = filename
  @filepath = File.join(@tmpdir, @filename)
end

Instance Method Details

#executeObject


30
31
32
33
34
35
36
37
38
# File 'app/services/bulk_imports/archive_extraction_service.rb', line 30

def execute
  validate_tmpdir
  validate_filepath
  validate_symlink

  extract_archive
  remove_symlinks
  tmpdir
end