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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
914 B
Ruby
Raw Normal View History

2018-12-23 12:14:25 +05:30
# frozen_string_literal: true
2015-04-26 12:48:37 +05:30
module Gitlab
module GitlabImport
class ProjectCreator
2015-09-25 12:07:36 +05:30
attr_reader :repo, :namespace, :current_user, :session_data
2015-04-26 12:48:37 +05:30
2015-09-25 12:07:36 +05:30
def initialize(repo, namespace, current_user, session_data)
2015-04-26 12:48:37 +05:30
@repo = repo
@namespace = namespace
@current_user = current_user
2015-09-25 12:07:36 +05:30
@session_data = session_data
2015-04-26 12:48:37 +05:30
end
def execute
2016-06-22 15:30:34 +05:30
::Projects::CreateService.new(
2015-12-23 02:04:40 +05:30
current_user,
2015-04-26 12:48:37 +05:30
name: repo["name"],
path: repo["path"],
description: repo["description"],
namespace_id: namespace.id,
2018-11-08 19:23:39 +05:30
visibility_level: Gitlab::VisibilityLevel.level_value(repo["visibility"]),
2015-04-26 12:48:37 +05:30
import_type: "gitlab",
import_source: repo["path_with_namespace"],
2015-09-25 12:07:36 +05:30
import_url: repo["http_url_to_repo"].sub("://", "://oauth2:#{@session_data[:gitlab_access_token]}@")
2015-04-26 12:48:37 +05:30
).execute
end
end
end
end