Class: Gitlab::ImportExport::RepoSaver

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

Direct Known Subclasses

DesignRepoSaver, SnippetRepoSaver, WikiRepoSaver

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

Instance Attribute 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:) ⇒ RepoSaver

Returns a new instance of RepoSaver.



11
12
13
14
# File 'lib/gitlab/import_export/repo_saver.rb', line 11

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

Instance Attribute Details

#exportableObject (readonly)

Returns the value of attribute exportable.



9
10
11
# File 'lib/gitlab/import_export/repo_saver.rb', line 9

def exportable
  @exportable
end

#sharedObject (readonly)

Returns the value of attribute shared.



9
10
11
# File 'lib/gitlab/import_export/repo_saver.rb', line 9

def shared
  @shared
end

Instance Method Details

#repositoryObject



25
26
27
# File 'lib/gitlab/import_export/repo_saver.rb', line 25

def repository
  @repository ||= @exportable.repository
end

#saveObject



16
17
18
19
20
21
22
23
# File 'lib/gitlab/import_export/repo_saver.rb', line 16

def save
  with_duration_measuring do
    # it's ok to have no repo
    break true unless repository_exists?

    bundle_to_disk
  end
end