diff options
author | George Tsiolis <tsiolis.g@gmail.com> | 2018-02-12 15:57:25 +0200 |
---|---|---|
committer | George Tsiolis <tsiolis.g@gmail.com> | 2018-02-12 17:45:12 +0200 |
commit | ca5b4e3de225673ff3fbf27f38f83a1d843c152d (patch) | |
tree | 0ad09a15021a1f6879ddd2e2cf5e9a5dc5aca05c /app/services | |
parent | 7611ec4eef7d543b9e32894a015c5b0a4c5caeec (diff) | |
download | gitlab-ce-ca5b4e3de225673ff3fbf27f38f83a1d843c152d.tar.gz |
Update projects import service
- Remove Gitlab::ImportExport::ProjectCreator from GitlabProjectsImportService
- Override ::Projects::CreateService params
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/create_from_template_service.rb | 10 | ||||
-rw-r--r-- | app/services/projects/gitlab_projects_import_service.rb | 14 |
2 files changed, 13 insertions, 11 deletions
diff --git a/app/services/projects/create_from_template_service.rb b/app/services/projects/create_from_template_service.rb index 87d9ed7a0e6..a549cfbabea 100644 --- a/app/services/projects/create_from_template_service.rb +++ b/app/services/projects/create_from_template_service.rb @@ -5,11 +5,15 @@ module Projects end def execute - params[:file] = Gitlab::ProjectTemplate.find(params[:template_name]).file + template_name = params.delete(:template_name) + file = Gitlab::ProjectTemplate.find(template_name).file + + params[:file] = file + + GitlabProjectsImportService.new(current_user, params).execute - GitlabProjectsImportService.new(@current_user, @params).execute ensure - params[:file]&.close + file&.close end end end diff --git a/app/services/projects/gitlab_projects_import_service.rb b/app/services/projects/gitlab_projects_import_service.rb index a3d7f5cbed5..a68ecb4abe1 100644 --- a/app/services/projects/gitlab_projects_import_service.rb +++ b/app/services/projects/gitlab_projects_import_service.rb @@ -11,12 +11,14 @@ module Projects def execute FileUtils.mkdir_p(File.dirname(import_upload_path)) + + file = params.delete(:file) FileUtils.copy_entry(file.path, import_upload_path) - Gitlab::ImportExport::ProjectCreator.new(params[:namespace_id], - current_user, - import_upload_path, - params[:path]).execute + params[:import_type] = 'gitlab_project' + params[:import_source] = import_upload_path + + ::Projects::CreateService.new(current_user, params).execute end private @@ -28,9 +30,5 @@ module Projects def tmp_filename SecureRandom.hex end - - def file - params[:file] - end end end |