Module: PactBroker::Repositories

Defined Under Namespace

Modules: Scopes

Constant Summary collapse

REPOSITORY_FACTORIES =
{}

Instance Method Summary collapse

Instance Method Details

#branch_repositoryObject



50
51
52
# File 'lib/pact_broker/repositories.rb', line 50

def branch_repository
  get_repository(:branch_repository)
end

#branch_version_repositoryObject



54
55
56
# File 'lib/pact_broker/repositories.rb', line 54

def branch_version_repository
  get_repository(:branch_version_repository)
end

#get_repository(name) ⇒ Object



14
15
16
# File 'lib/pact_broker/repositories.rb', line 14

def get_repository(name)
  REPOSITORY_FACTORIES[name].call
end

#integration_repositoryObject



58
59
60
# File 'lib/pact_broker/repositories.rb', line 58

def integration_repository
  get_repository(:integration_repository)
end

#label_repositoryObject



34
35
36
# File 'lib/pact_broker/repositories.rb', line 34

def label_repository
  get_repository(:label_repository)
end

#matrix_repositoryObject



46
47
48
# File 'lib/pact_broker/repositories.rb', line 46

def matrix_repository
  get_repository(:matrix_repository)
end

#pact_repositoryObject



26
27
28
# File 'lib/pact_broker/repositories.rb', line 26

def pact_repository
  get_repository(:pact_repository)
end

#pacticipant_repositoryObject



18
19
20
# File 'lib/pact_broker/repositories.rb', line 18

def pacticipant_repository
  get_repository(:pacticipant_repository)
end

#register_default_repositoriesObject

rubocop: disable Metrics/MethodLength



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/pact_broker/repositories.rb', line 63

def register_default_repositories
  register_repository(:pacticipant_repository) do
    require "pact_broker/pacticipants/repository"
    Pacticipants::Repository.new
  end

  register_repository(:version_repository) do
    require "pact_broker/versions/repository"
    Versions::Repository.new
  end

  register_repository(:pact_repository) do
    PactBroker::Pacts::Repository.new
  end

  register_repository(:tag_repository) do
    require "pact_broker/tags/repository"
    Tags::Repository.new
  end

  register_repository(:label_repository) do
    require "pact_broker/labels/repository"
    Labels::Repository.new
  end

  register_repository(:webhook_repository) do
    require "pact_broker/webhooks/repository"
    Webhooks::Repository.new
  end

  register_repository(:verification_repository) do
    require "pact_broker/verifications/repository"
    Verifications::Repository.new
  end

  register_repository(:matrix_repository) do
    require "pact_broker/matrix/repository"
    Matrix::Repository.new
  end

  register_repository(:branch_repository) do
    require "pact_broker/versions/branch_repository"
    PactBroker::Versions::BranchRepository.new
  end

  register_repository(:branch_version_repository) do
    require "pact_broker/versions/branch_version_repository"
    PactBroker::Versions::BranchVersionRepository.new
  end

  register_repository(:integration_repository) do
    require "pact_broker/integrations/repository"
    PactBroker::Integrations::Repository.new
  end
  # rubocop: enable Metrics/MethodLength
end

#register_repository(name, &block) ⇒ Object



10
11
12
# File 'lib/pact_broker/repositories.rb', line 10

def register_repository(name, &block)
  REPOSITORY_FACTORIES[name] = block
end

#tag_repositoryObject



30
31
32
# File 'lib/pact_broker/repositories.rb', line 30

def tag_repository
  get_repository(:tag_repository)
end

#verification_repositoryObject



42
43
44
# File 'lib/pact_broker/repositories.rb', line 42

def verification_repository
  get_repository(:verification_repository)
end

#version_repositoryObject



22
23
24
# File 'lib/pact_broker/repositories.rb', line 22

def version_repository
  get_repository(:version_repository)
end

#webhook_repositoryObject



38
39
40
# File 'lib/pact_broker/repositories.rb', line 38

def webhook_repository
  get_repository(:webhook_repository)
end