diff options
author | James Lopez <james@jameslopez.es> | 2016-06-13 20:35:57 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-06-13 20:35:57 +0200 |
commit | 903da377553d37ac3263055fcc634351cc4750d4 (patch) | |
tree | 9f8db98779f462876fd0d69739fb426fbeb40dd1 /lib | |
parent | f449eeb6f1d56c1a00f4d9043680ee8033a78afe (diff) | |
download | gitlab-ce-903da377553d37ac3263055fcc634351cc4750d4.tar.gz |
WIP - starting refactoring import/export to use services
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/gitlab_import/project_creator.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/import_export/project_creator.rb | 29 |
2 files changed, 30 insertions, 3 deletions
diff --git a/lib/gitlab/gitlab_import/project_creator.rb b/lib/gitlab/gitlab_import/project_creator.rb index 77c33db4b59..3d0418261bb 100644 --- a/lib/gitlab/gitlab_import/project_creator.rb +++ b/lib/gitlab/gitlab_import/project_creator.rb @@ -11,7 +11,7 @@ module Gitlab end def execute - project = ::Projects::CreateService.new( + ::Projects::CreateService.new( current_user, name: repo["name"], path: repo["path"], @@ -22,8 +22,6 @@ module Gitlab import_source: repo["path_with_namespace"], import_url: repo["http_url_to_repo"].sub("://", "://oauth2:#{@session_data[:gitlab_access_token]}@") ).execute - - project end end end diff --git a/lib/gitlab/import_export/project_creator.rb b/lib/gitlab/import_export/project_creator.rb new file mode 100644 index 00000000000..b8424cb9719 --- /dev/null +++ b/lib/gitlab/import_export/project_creator.rb @@ -0,0 +1,29 @@ +module Gitlab + module ImportExport + class ProjectCreator + + def initialize(namespace_id, current_user, ) + @repo = repo + @namespace = Namespace.find_by_id(namespace_id) + @current_user = current_user + @user_map = user_map + end + + def execute + ::Projects::CreateService.new( + current_user, + name: repo.name, + path: repo.name, + description: repo.summary, + namespace: namespace, + creator: current_user, + visibility_level: Gitlab::VisibilityLevel::PUBLIC, + import_type: "google_code", + import_source: repo.name, + import_url: repo.import_url, + import_data: { data: { 'repo' => repo.raw_data, 'user_map' => user_map } } + ).execute + end + end + end +end |