Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-06-14 13:47:07 +0300
committerJames Lopez <james@jameslopez.es>2016-06-14 13:47:07 +0300
commit3f7ed550110daaec8a76af7146b701dfc0210e60 (patch)
tree25fa93f0c306f8ea2ab9b28f26dfb11bb7551184 /lib/gitlab/gitlab_import
parent1ea44ee75077d67f3f24a288cc44d7c275ba8581 (diff)
lots of refactoring to reuse import service
Diffstat (limited to 'lib/gitlab/gitlab_import')
-rw-r--r--lib/gitlab/gitlab_import/project_creator.rb21
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/gitlab/gitlab_import/project_creator.rb b/lib/gitlab/gitlab_import/project_creator.rb
index 3d0418261bb..72b10f536ec 100644
--- a/lib/gitlab/gitlab_import/project_creator.rb
+++ b/lib/gitlab/gitlab_import/project_creator.rb
@@ -3,24 +3,21 @@ module Gitlab
class ProjectCreator
attr_reader :repo, :namespace, :current_user, :session_data
- def initialize(repo, namespace, current_user, session_data)
- @repo = repo
- @namespace = namespace
+ def initialize(namespace_id, current_user, file, project_path)
+ @namespace_id = namespace_id
@current_user = current_user
- @session_data = session_data
+ @file = file
+ @project_path = project_path
end
def execute
::Projects::CreateService.new(
current_user,
- name: repo["name"],
- path: repo["path"],
- description: repo["description"],
- namespace_id: namespace.id,
- visibility_level: repo["visibility_level"],
- import_type: "gitlab",
- import_source: repo["path_with_namespace"],
- import_url: repo["http_url_to_repo"].sub("://", "://oauth2:#{@session_data[:gitlab_access_token]}@")
+ name: @project_path,
+ path: @project_path,
+ namespace_id: namespace_id,
+ import_type: "gitlab_project",
+ import_source: @file
).execute
end
end