2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-09-25 12:07:36 +05:30
|
|
|
module Gitlab
|
|
|
|
module FogbugzImport
|
|
|
|
class ProjectCreator
|
2022-07-23 23:45:48 +05:30
|
|
|
attr_reader :repo, :name, :fb_session, :namespace, :current_user, :user_map
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
def initialize(repo, name, namespace, current_user, fb_session, user_map = nil)
|
2015-09-25 12:07:36 +05:30
|
|
|
@repo = repo
|
2022-07-23 23:45:48 +05:30
|
|
|
@name = name
|
2015-09-25 12:07:36 +05:30
|
|
|
@namespace = namespace
|
|
|
|
@current_user = current_user
|
2022-07-23 23:45:48 +05:30
|
|
|
@fb_session = fb_session
|
2015-09-25 12:07:36 +05:30
|
|
|
@user_map = user_map
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
2016-06-02 11:05:42 +05:30
|
|
|
::Projects::CreateService.new(
|
2015-12-23 02:04:40 +05:30
|
|
|
current_user,
|
2022-07-23 23:45:48 +05:30
|
|
|
name: name,
|
|
|
|
path: name,
|
|
|
|
namespace_id: namespace.id,
|
2015-09-25 12:07:36 +05:30
|
|
|
creator: current_user,
|
2019-12-04 20:38:33 +05:30
|
|
|
visibility_level: Gitlab::VisibilityLevel::PRIVATE,
|
2015-09-25 12:07:36 +05:30
|
|
|
import_type: 'fogbugz',
|
|
|
|
import_source: repo.name,
|
2016-06-02 11:05:42 +05:30
|
|
|
import_url: Project::UNKNOWN_IMPORT_URL,
|
|
|
|
import_data: { data: { 'repo' => repo.raw_data, 'user_map' => user_map }, credentials: { fb_session: fb_session } }
|
2015-09-25 12:07:36 +05:30
|
|
|
).execute
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|