2018-11-09 13:39:43 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-08-04 18:21:12 -04:00
|
|
|
module Gitlab
|
|
|
|
module FogbugzImport
|
|
|
|
class ProjectCreator
|
|
|
|
attr_reader :repo, :fb_session, :namespace, :current_user, :user_map
|
|
|
|
|
|
|
|
def initialize(repo, fb_session, namespace, current_user, user_map = nil)
|
|
|
|
@repo = repo
|
|
|
|
@fb_session = fb_session
|
|
|
|
@namespace = namespace
|
|
|
|
@current_user = current_user
|
|
|
|
@user_map = user_map
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
2016-05-10 05:10:51 -04:00
|
|
|
::Projects::CreateService.new(
|
2015-12-14 21:53:52 -05:00
|
|
|
current_user,
|
2015-08-04 18:21:12 -04:00
|
|
|
name: repo.safe_name,
|
|
|
|
path: repo.path,
|
|
|
|
namespace: namespace,
|
|
|
|
creator: current_user,
|
|
|
|
visibility_level: Gitlab::VisibilityLevel::INTERNAL,
|
|
|
|
import_type: 'fogbugz',
|
|
|
|
import_source: repo.name,
|
2016-05-10 05:10:51 -04:00
|
|
|
import_url: Project::UNKNOWN_IMPORT_URL,
|
|
|
|
import_data: { data: { 'repo' => repo.raw_data, 'user_map' => user_map }, credentials: { fb_session: fb_session } }
|
2015-08-04 18:21:12 -04:00
|
|
|
).execute
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|