gitlab-org--gitlab-foss/lib/gitlab/google_code_import/project_creator.rb

31 lines
867 B
Ruby
Raw Normal View History

module Gitlab
module GoogleCodeImport
class ProjectCreator
2015-04-14 12:50:56 +00:00
attr_reader :repo, :namespace, :current_user, :user_map
2015-04-14 12:50:56 +00:00
def initialize(repo, namespace, current_user, user_map = nil)
@repo = repo
@namespace = namespace
@current_user = current_user
2015-04-14 12:50:56 +00:00
@user_map = user_map
end
def execute
2016-05-10 09:10:51 +00:00
::Projects::CreateService.new(
2015-12-15 02:53:52 +00:00
current_user,
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 } }
).execute
end
end
end
end