diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-07-06 16:21:22 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-07-11 12:22:57 +0300 |
commit | a4b6707e63ca10eb64a92d45797eaad49e9c9f46 (patch) | |
tree | d2faaa1ca8504ba7148feebba00a3f8d8218fed4 /lib/gitlab/manifest_import | |
parent | 85b0240c4b58a49b22c9dbff9451127ae817652a (diff) |
Refactor manifest import code
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/gitlab/manifest_import')
-rw-r--r-- | lib/gitlab/manifest_import/project_creator.rb (renamed from lib/gitlab/manifest_import/importer.rb) | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/gitlab/manifest_import/importer.rb b/lib/gitlab/manifest_import/project_creator.rb index 8ffeb0a4143..9ccd32c3a3b 100644 --- a/lib/gitlab/manifest_import/importer.rb +++ b/lib/gitlab/manifest_import/project_creator.rb @@ -1,21 +1,15 @@ module Gitlab module ManifestImport - class Importer - attr_reader :repository, :destination, :user + class ProjectCreator + attr_reader :repository, :destination, :current_user - def initialize(repository, destination, user) + def initialize(repository, destination, current_user) @repository = repository @destination = destination - @user = user + @current_user = current_user end def execute - import_project - end - - private - - def import_project group_full_path, _, project_path = repository[:path].rpartition('/') group_full_path = File.join(destination.full_path, group_full_path) if destination group = Group.find_by_full_path(group_full_path) || @@ -30,16 +24,18 @@ module Gitlab visibility_level: destination.visibility_level } - Projects::CreateService.new(user, params).execute + Projects::CreateService.new(current_user, params).execute end + private + def create_group_with_parents(full_path) params = { group_path: full_path, visibility_level: destination.visibility_level } - Groups::NestedCreateService.new(user, params).execute + Groups::NestedCreateService.new(current_user, params).execute end end end |