Module: Gitlab::ImportSources

Defined in:
lib/gitlab/import_sources.rb

Defined Under Namespace

Classes: ImportSource

Constant Summary collapse

IMPORT_TABLE =
[
  ImportSource.new('github',           'GitHub',            Gitlab::GithubImport::ParallelImporter),
  ImportSource.new('bitbucket',        'Bitbucket Cloud',   Gitlab::BitbucketImport::ParallelImporter),
  ImportSource.new('bitbucket_server', 'Bitbucket Server',  Gitlab::BitbucketServerImport::ParallelImporter),
  ImportSource.new('fogbugz',          'FogBugz',           Gitlab::FogbugzImport::Importer),
  ImportSource.new('git',              'Repository by URL', nil),
  ImportSource.new('gitlab_project',   'GitLab export',     Gitlab::ImportExport::Importer),
  ImportSource.new('gitea',            'Gitea',             Gitlab::LegacyGithubImport::Importer),
  ImportSource.new('manifest',         'Manifest file',     nil),
  ImportSource.new(
    'gitlab_built_in_project_template', 'GitLab built-in project template', Gitlab::ImportExport::Importer
  )
].freeze
PROJECT_TEMPLATE_IMPORTERS =
['gitlab_built_in_project_template'].freeze

Class Method Summary collapse

Class Method Details

.has_importer?(name) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/gitlab/import_sources.rb', line 38

def has_importer?(name)
  importer(name).present?
end

.import_source(name) ⇒ Object



34
35
36
# File 'lib/gitlab/import_sources.rb', line 34

def import_source(name)
  import_table.find { |import_source| import_source.name == name }
end

.import_tableObject



54
55
56
# File 'lib/gitlab/import_sources.rb', line 54

def import_table
  IMPORT_TABLE
end

.importer(name) ⇒ Object



46
47
48
# File 'lib/gitlab/import_sources.rb', line 46

def importer(name)
  import_source(name)&.importer
end

.project_template_importersObject



58
59
60
# File 'lib/gitlab/import_sources.rb', line 58

def project_template_importers
  PROJECT_TEMPLATE_IMPORTERS
end

.template?(name) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/gitlab/import_sources.rb', line 42

def template?(name)
  project_template_importers.include?(name)
end

.title(name) ⇒ Object



50
51
52
# File 'lib/gitlab/import_sources.rb', line 50

def title(name)
  import_source(name)&.title
end

.valuesObject



30
31
32
# File 'lib/gitlab/import_sources.rb', line 30

def values
  import_table.map(&:name)
end