Class: Gitlab::ImportExport::Importer
- Inherits:
-
Object
- Object
- Gitlab::ImportExport::Importer
- Includes:
- Allowable, Utils::StrongMemoize
- Defined in:
- lib/gitlab/import_export/importer.rb
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project) ⇒ Importer
constructor
A new instance of Importer.
Methods included from Allowable
Constructor Details
#initialize(project) ⇒ Importer
Returns a new instance of Importer.
13 14 15 16 17 18 |
# File 'lib/gitlab/import_export/importer.rb', line 13 def initialize(project) @archive_file = project.import_source @current_user = project.creator @project = project @shared = project.import_export_shared end |
Class Method Details
.imports_repository? ⇒ Boolean
9 10 11 |
# File 'lib/gitlab/import_export/importer.rb', line 9 def self.imports_repository? true end |
Instance Method Details
#execute ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gitlab/import_export/importer.rb', line 20 def execute if import_file && check_version! && restorers.all?(&:restore) && overwrite_project project else raise Projects::ImportService::Error, shared.errors.to_sentence end rescue StandardError => e # If some exception was raised could mean that the SnippetsRepoRestorer # was not called. This would leave us with snippets without a repository. # This is a state we don't want them to be, so we better delete them. remove_non_migrated_snippets raise Projects::ImportService::Error, e. ensure remove_base_tmp_dir remove_import_file end |