File: has_import_source.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (39 lines) | stat: -rw-r--r-- 1,062 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

module Import
  SOURCE_NONE = :none
  SOURCE_DIRECT_TRANSFER = :gitlab_migration # aka BulkImports
  SOURCE_PROJECT_EXPORT_IMPORT = :gitlab_project
  SOURCE_GROUP_EXPORT_IMPORT = :gitlab_group
  SOURCE_GITHUB = :github
  SOURCE_GITEA = :gitea
  SOURCE_BITBUCKET = :bitbucket
  SOURCE_BITBUCKET_SERVER = :bitbucket_server

  module HasImportSource
    extend ActiveSupport::Concern

    IMPORT_SOURCES = {
      SOURCE_NONE => 0, # not imported
      SOURCE_DIRECT_TRANSFER => 1,
      SOURCE_PROJECT_EXPORT_IMPORT => 2,
      SOURCE_GROUP_EXPORT_IMPORT => 3,
      SOURCE_GITHUB => 4,
      SOURCE_BITBUCKET => 5, # aka bitbucket cloud
      SOURCE_BITBUCKET_SERVER => 6,
      fogbugz: 7,
      SOURCE_GITEA => 8,
      git: 9, # aka repository by url
      manifest: 10, # aka manifest file
      custom_template: 11 # aka gitlab custom project template export
    }.freeze

    included do
      enum imported_from: IMPORT_SOURCES, _prefix: :imported_from
    end

    def imported?
      !imported_from_none?
    end
  end
end