diff options
author | James Lopez <james@jameslopez.es> | 2018-09-07 14:42:49 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-09-07 14:42:49 +0300 |
commit | 27442862cf81881c81552e64d0b4d3354535c45e (patch) | |
tree | a05e89cdad1f455971748b74f4092ca3992de8b8 /lib | |
parent | a2aa505805478540b3150b2f9093c8658e18597d (diff) |
refactor code based on feedback
Diffstat (limited to 'lib')
5 files changed, 8 insertions, 8 deletions
diff --git a/lib/api/project_export.rb b/lib/api/project_export.rb index 8954a0c0a4c..9163887ac61 100644 --- a/lib/api/project_export.rb +++ b/lib/api/project_export.rb @@ -21,8 +21,8 @@ module API detail 'This feature was introduced in GitLab 10.6.' end get ':id/export/download' do - if user_project.export_project_object_exists? - present_carrierwave_file!(user_project.import_export_upload.export_file) + if user_project.export_project_exists? + present_carrierwave_file!(user_ project.export_file) else render_api_error!('404 Not found or has expired', 404) end diff --git a/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb b/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb index 83134bb0769..21624cad43a 100644 --- a/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb +++ b/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb @@ -84,7 +84,7 @@ module Gitlab end def object_storage? - project.export_project_object_exists? + project.export_project_exists? end end end diff --git a/lib/gitlab/import_export/after_export_strategies/web_upload_strategy.rb b/lib/gitlab/import_export/after_export_strategies/web_upload_strategy.rb index 064092681f8..01c1bca7ec9 100644 --- a/lib/gitlab/import_export/after_export_strategies/web_upload_strategy.rb +++ b/lib/gitlab/import_export/after_export_strategies/web_upload_strategy.rb @@ -44,7 +44,7 @@ module Gitlab end def export_file - project.import_export_upload.export_file.open + project.export_file.open end def send_file_options @@ -59,7 +59,7 @@ module Gitlab end def export_size - project.import_export_upload.export_file.file.size + project.export_file.file.size end end end diff --git a/lib/gitlab/import_export/saver.rb b/lib/gitlab/import_export/saver.rb index a66f32f91d2..59a74083395 100644 --- a/lib/gitlab/import_export/saver.rb +++ b/lib/gitlab/import_export/saver.rb @@ -18,7 +18,7 @@ module Gitlab Rails.logger.info("Saved project export #{archive_file}") - save_on_object_storage + save_upload else @shared.error(Gitlab::ImportExport::Error.new(error_message)) false @@ -49,7 +49,7 @@ module Gitlab @archive_file ||= File.join(@shared.archive_path, Gitlab::ImportExport.export_filename(project: @project)) end - def save_on_object_storage + def save_upload upload = ImportExportUpload.find_or_initialize_by(project: @project) File.open(archive_file) { |file| upload.export_file = file } diff --git a/lib/tasks/gitlab/update_templates.rake b/lib/tasks/gitlab/update_templates.rake index 3c873ba3a20..be22032287c 100644 --- a/lib/tasks/gitlab/update_templates.rake +++ b/lib/tasks/gitlab/update_templates.rake @@ -54,7 +54,7 @@ namespace :gitlab do end Projects::ImportExport::ExportService.new(project, admin).execute - download_or_copy_upload(project.import_export_upload.export_file, template.archive_path) + download_or_copy_upload( project.export_file, template.archive_path) Projects::DestroyService.new(admin, project).execute puts "Exported #{template.name}".green end |