Class: Gitlab::ImportExport::Saver

Inherits:
Object
  • Object
show all
Includes:
CommandLineUtil
Defined in:
lib/gitlab/import_export/saver.rb

Constant Summary

Constants included from CommandLineUtil

CommandLineUtil::CLEAN_DIR_IGNORE_FILE_NAMES, CommandLineUtil::CommandLineUtilError, CommandLineUtil::DEFAULT_DIR_MODE, CommandLineUtil::FileOversizedError, CommandLineUtil::HardLinkError, CommandLineUtil::UNTAR_MASK

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CommandLineUtil

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

Constructor Details

#initialize(exportable:, shared:) ⇒ Saver

Returns a new instance of Saver.



12
13
14
15
# File 'lib/gitlab/import_export/saver.rb', line 12

def initialize(exportable:, shared:)
  @exportable = exportable
  @shared = shared
end

Class Method Details

.save(*args, **kwargs) ⇒ Object



8
9
10
# File 'lib/gitlab/import_export/saver.rb', line 8

def self.save(*args, **kwargs)
  new(*args, **kwargs).save
end

Instance Method Details

#saveObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gitlab/import_export/saver.rb', line 17

def save
  if compress_and_save
    log_export_results('Export archive saved')

    save_upload

    log_export_results('Export archive uploaded')
  else
    @shared.error(Gitlab::ImportExport::Error.new(error_message))

    false
  end
rescue StandardError => e
  @shared.error(e)
  log_export_results('Export archive saver failed')

  false
ensure
  remove_archive_tmp_dir
end