summaryrefslogtreecommitdiff
path: root/lib/gitlab/github_import/project_creator.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/github_import/project_creator.rb')
-rw-r--r--lib/gitlab/github_import/project_creator.rb52
1 files changed, 0 insertions, 52 deletions
diff --git a/lib/gitlab/github_import/project_creator.rb b/lib/gitlab/github_import/project_creator.rb
deleted file mode 100644
index a55adc9b1c8..00000000000
--- a/lib/gitlab/github_import/project_creator.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-module Gitlab
- module GithubImport
- class ProjectCreator
- include Gitlab::CurrentSettings
-
- attr_reader :repo, :name, :namespace, :current_user, :session_data, :type
-
- def initialize(repo, name, namespace, current_user, session_data, type: 'github')
- @repo = repo
- @name = name
- @namespace = namespace
- @current_user = current_user
- @session_data = session_data
- @type = type
- end
-
- def execute
- ::Projects::CreateService.new(
- current_user,
- name: name,
- path: name,
- description: repo.description,
- namespace_id: namespace.id,
- visibility_level: visibility_level,
- import_type: type,
- import_source: repo.full_name,
- import_url: import_url,
- skip_wiki: skip_wiki
- ).execute
- end
-
- private
-
- def import_url
- repo.clone_url.sub('://', "://#{session_data[:github_access_token]}@")
- end
-
- def visibility_level
- repo.private ? Gitlab::VisibilityLevel::PRIVATE : current_application_settings.default_project_visibility
- end
-
- #
- # If the GitHub project repository has wiki, we should not create the
- # default wiki. Otherwise the GitHub importer will fail because the wiki
- # repository already exist.
- #
- def skip_wiki
- repo.has_wiki?
- end
- end
- end
-end