debian-mirror-gitlab/lib/gitlab/fogbugz_import/project_creator.rb

40 lines
1 KiB
Ruby
Raw Normal View History

2015-09-25 12:07:36 +05:30
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
2015-12-23 02:04:40 +05:30
project = ::Projects::CreateService.new(
current_user,
2015-09-25 12:07:36 +05:30
name: repo.safe_name,
path: repo.path,
namespace: namespace,
creator: current_user,
visibility_level: Gitlab::VisibilityLevel::INTERNAL,
import_type: 'fogbugz',
import_source: repo.name,
import_url: Project::UNKNOWN_IMPORT_URL
).execute
2015-10-24 18:46:33 +05:30
project.create_import_data(
2015-09-25 12:07:36 +05:30
data: {
'repo' => repo.raw_data,
'user_map' => user_map,
'fb_session' => fb_session
}
)
project
end
end
end
end