Module: Gitlab::ImportSources

Defined in:
lib/gitlab/import_sources.rb

Defined Under Namespace

Classes: ImportSource

Constant Summary collapse

IMPORT_TABLE =

We exclude `bare_repository` here as it has no import class associated

[
  ImportSource.new('github',           'GitHub',           Gitlab::GithubImport::ParallelImporter),
  ImportSource.new('bitbucket',        'Bitbucket Cloud',  Gitlab::BitbucketImport::Importer),
  ImportSource.new('bitbucket_server', 'Bitbucket Server', Gitlab::BitbucketServerImport::Importer),
  ImportSource.new('gitlab',           'GitLab.com',       Gitlab::GitlabImport::Importer),
  ImportSource.new('google_code',      'Google Code',      nil),
  ImportSource.new('fogbugz',          'FogBugz',          Gitlab::FogbugzImport::Importer),
  ImportSource.new('git',              'Repo 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('phabricator',      'Phabricator',      Gitlab::PhabricatorImport::Importer)
].freeze

Class Method Summary collapse

Class Method Details

.import_tableObject


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

def import_table
  IMPORT_TABLE
end

.importer(name) ⇒ Object


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

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

.importer_namesObject


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

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

.optionsObject


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

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

.title(name) ⇒ Object


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

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

.valuesObject


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

def values
  import_table.map(&:name)
end