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::Importer),
  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)
].freeze

Class Method Summary collapse

Class Method Details

.import_tableObject



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/gitlab/import_sources.rb', line 46

def import_table
  bitbucket_parallel_enabled = Feature.enabled?(:bitbucket_parallel_importer)

  return IMPORT_TABLE unless bitbucket_parallel_enabled

  import_table = IMPORT_TABLE.deep_dup

  import_table[1].importer = Gitlab::BitbucketImport::ParallelImporter if bitbucket_parallel_enabled

  import_table
end

.importer(name) ⇒ Object



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

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

.importer_namesObject



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

def importer_names
  import_table.select(&:importer).map(&:name)
end

.optionsObject



26
27
28
# File 'lib/gitlab/import_sources.rb', line 26

def options
  import_table.to_h { |importer| [importer.title, importer.name] }
end

.title(name) ⇒ Object



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

def title(name)
  options.key(name)
end

.valuesObject



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

def values
  import_table.map(&:name)
end