2015-04-03 13:29:27 +00:00
|
|
|
module Gitlab
|
|
|
|
module GoogleCodeImport
|
|
|
|
class ProjectCreator
|
2015-04-14 12:50:56 +00:00
|
|
|
attr_reader :repo, :namespace, :current_user, :user_map
|
2015-04-03 13:29:27 +00:00
|
|
|
|
2015-04-14 12:50:56 +00:00
|
|
|
def initialize(repo, namespace, current_user, user_map = nil)
|
2015-04-03 13:29:27 +00:00
|
|
|
@repo = repo
|
|
|
|
@namespace = namespace
|
|
|
|
@current_user = current_user
|
2015-04-14 12:50:56 +00:00
|
|
|
@user_map = user_map
|
2015-04-03 13:29:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
2016-05-10 09:10:51 +00:00
|
|
|
::Projects::CreateService.new(
|
2015-12-15 02:53:52 +00:00
|
|
|
current_user,
|
2015-04-03 13:29:27 +00:00
|
|
|
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,
|
2016-05-10 09:10:51 +00:00
|
|
|
import_url: repo.import_url,
|
|
|
|
import_data: { data: { 'repo' => repo.raw_data, 'user_map' => user_map } }
|
2015-04-17 12:31:24 +00:00
|
|
|
).execute
|
2015-04-03 13:29:27 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|