diff options
author | James Lopez <james@jameslopez.es> | 2016-05-16 12:04:31 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-05-16 12:04:31 +0200 |
commit | 5777ad9a1f016f170585949059b08a4eeb7d19a9 (patch) | |
tree | 68dceb008558a745c24ff66c2e53437b3f81c44f /app/services/projects/import_export/export_service.rb | |
parent | f386d7a7b7f67ba8e77ee40ef6a3383d5206d0c1 (diff) | |
download | gitlab-ce-5777ad9a1f016f170585949059b08a4eeb7d19a9.tar.gz |
adding versioning to export
Diffstat (limited to 'app/services/projects/import_export/export_service.rb')
-rw-r--r-- | app/services/projects/import_export/export_service.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/services/projects/import_export/export_service.rb b/app/services/projects/import_export/export_service.rb index e6eb6f915b0..0691ca9d468 100644 --- a/app/services/projects/import_export/export_service.rb +++ b/app/services/projects/import_export/export_service.rb @@ -4,12 +4,16 @@ module Projects def execute(options = {}) @shared = Gitlab::ImportExport::Shared.new(relative_path: File.join(project.path_with_namespace, 'work')) - save_all if [save_project_tree, bundle_repo, bundle_wiki_repo].all? - notify_worker if @shared.errors.any? + save_all if [save_version, save_project_tree, bundle_repo, bundle_wiki_repo].all? + cleanup_and_notify_worker if @shared.errors.any? end private + def save_version + Gitlab::ImportExport::VersionSaver.save(shared: @shared) + end + def save_project_tree Gitlab::ImportExport::ProjectTreeSaver.new(project: project, shared: @shared).save end @@ -26,7 +30,8 @@ module Projects Gitlab::ImportExport::Saver.save(shared: @shared) end - def notify_worker + def cleanup_and_notify_worker + FileUtils.rm_rf(@shared.export_path) raise Gitlab::ImportExport::Error.new(@shared.errors.join(', ')) end end |