diff options
author | James Lopez <james@jameslopez.es> | 2016-06-03 13:56:29 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-06-03 13:56:29 +0300 |
commit | 9d0038f2d7663419c34eda7675d15d1a40478947 (patch) | |
tree | 17ea0769c841f6dd111abd4e6c899bfb610b326c /app/services/projects/import_export | |
parent | 398f0071a6b77a7e26e612b38105ae4bd702ef22 (diff) |
started refactoring a bunch of stuff based on feedback
Diffstat (limited to 'app/services/projects/import_export')
-rw-r--r-- | app/services/projects/import_export/export_service.rb | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/app/services/projects/import_export/export_service.rb b/app/services/projects/import_export/export_service.rb index 1a23a4ede97..25524c1c060 100644 --- a/app/services/projects/import_export/export_service.rb +++ b/app/services/projects/import_export/export_service.rb @@ -2,36 +2,39 @@ module Projects module ImportExport class ExportService < BaseService - def execute(options = {}) + def execute(_options = {}) @shared = Gitlab::ImportExport::Shared.new(relative_path: File.join(project.path_with_namespace, 'work')) - save_all if [save_version, save_project_tree, save_uploads, bundle_repo, bundle_wiki_repo].all? - cleanup_and_notify_worker if @shared.errors.any? + save_all end private - def save_version - Gitlab::ImportExport::VersionSaver.save(shared: @shared) + def save_all + if [version_saver, project_tree_saver, uploads_saver, repo_saver, wiki_repo_saver].all?(&:save) + Gitlab::ImportExport::Saver.save(shared: @shared) + else + cleanup_and_notify_worker + end end - def save_project_tree - Gitlab::ImportExport::ProjectTreeSaver.new(project: project, shared: @shared).save + def version_saver + Gitlab::ImportExport::VersionSaver.new(shared: @shared) end - def save_uploads - Gitlab::ImportExport::UploadsSaver.save(project: project, shared: @shared) + def project_tree_saver + Gitlab::ImportExport::ProjectTreeSaver.new(project: project, shared: @shared) end - def bundle_repo - Gitlab::ImportExport::RepoBundler.new(project: project, shared: @shared).bundle + def uploads_saver + Gitlab::ImportExport::UploadsSaver.new(project: project, shared: @shared) end - def bundle_wiki_repo - Gitlab::ImportExport::WikiRepoBundler.new(project: project, shared: @shared).bundle + def repo_saver + Gitlab::ImportExport::RepoSaver.new(project: project, shared: @shared) end - def save_all - Gitlab::ImportExport::Saver.save(shared: @shared) + def wiki_repo_saver + Gitlab::ImportExport::WikiRepoSaver.new(project: project, shared: @shared) end def cleanup_and_notify_worker |