Welcome to mirror list, hosted at ThFree Co, Russian Federation.

repository.rb « design_management « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7410944e1749058ef1951201c66627631a731df5 (plain)
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
# frozen_string_literal: true

module DesignManagement
  class Repository < ApplicationRecord
    include ::Gitlab::Utils::StrongMemoize
    include HasRepository

    belongs_to :project, inverse_of: :design_management_repository
    validates :project, presence: true, uniqueness: true

    delegate :lfs_enabled?, :storage, :repository_storage, :run_after_commit, to: :project

    def repository
      ::DesignManagement::GitRepository.new(
        full_path,
        self,
        shard: repository_storage,
        disk_path: disk_path,
        repo_type: repo_type
      )
    end
    strong_memoize_attr :repository

    def full_path
      project.full_path + repo_type.path_suffix
    end

    def disk_path
      project.disk_path + repo_type.path_suffix
    end

    def repo_type
      Gitlab::GlRepository::DESIGN
    end
  end
end

DesignManagement::Repository.prepend_mod_with('DesignManagement::Repository')