Class: Gitlab::ImportExport::RepoRestorer
- Inherits:
-
Object
- Object
- Gitlab::ImportExport::RepoRestorer
- Includes:
- CommandLineUtil
- Defined in:
- lib/gitlab/import_export/repo_restorer.rb
Direct Known Subclasses
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
-
#importable ⇒ Object
readonly
Returns the value of attribute importable.
Instance Method Summary collapse
-
#initialize(importable:, shared:, path_to_bundle:) ⇒ RepoRestorer
constructor
A new instance of RepoRestorer.
- #repository ⇒ Object
- #restore ⇒ Object
Methods included from CommandLineUtil
#gunzip, #gzip, #gzip_with_options, #mkdir_p, #tar_cf, #tar_czf, #untar_xf, #untar_zxf
Constructor Details
#initialize(importable:, shared:, path_to_bundle:) ⇒ RepoRestorer
Returns a new instance of RepoRestorer.
10 11 12 13 14 |
# File 'lib/gitlab/import_export/repo_restorer.rb', line 10 def initialize(importable:, shared:, path_to_bundle:) @path_to_bundle = path_to_bundle @shared = shared @importable = importable end |
Instance Attribute Details
#importable ⇒ Object (readonly)
Returns the value of attribute importable.
8 9 10 |
# File 'lib/gitlab/import_export/repo_restorer.rb', line 8 def importable @importable end |
Instance Method Details
#repository ⇒ Object
30 31 32 |
# File 'lib/gitlab/import_export/repo_restorer.rb', line 30 def repository @repository ||= importable.repository end |
#restore ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gitlab/import_export/repo_restorer.rb', line 16 def restore return true unless File.exist?(path_to_bundle) ensure_repository_does_not_exist! repository.create_from_bundle(path_to_bundle) update_importable_repository_info true rescue StandardError => e shared.error(e) false end |