gitlab-cloud-connector 1.31.0 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/schemas/unit_primitive_schema.json +6 -0
- data/config/unit_primitives/generate_issue_description.yml +2 -0
- data/lib/gitlab/cloud_connector/data_model/abstract_data_loader.rb +25 -2
- data/lib/gitlab/cloud_connector/data_model/base.rb +6 -2
- data/lib/gitlab/cloud_connector/data_model/yaml_data_loader.rb +5 -5
- data/lib/gitlab/cloud_connector/data_model.rb +3 -3
- data/lib/gitlab/cloud_connector/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4b754e732653e937997ea041260c3f1d9386f3126914fe9f6b7f7e9863ac2a7
|
4
|
+
data.tar.gz: add25f8293e1df30744b6e165bdd3b3ecd410b02407399dc19a2128cbe4efdad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 128ea70bcbb3e2a62806960fc61dc4e7e68abad8fc7b623abd1707c6644098dba018b42758f5ce5ac4eada46ebf6985a7b6ebd05c428751c3b286c602ae53945
|
7
|
+
data.tar.gz: a1764ebeacf9689195080a44344baffe5373d0456c9596304998a4b1a55ccd2467b9709f170e4a1148500448294c0cfd8ca37db2756cb942021b8ed5a81c9ee5
|
@@ -8,13 +8,36 @@ module Gitlab
|
|
8
8
|
@model_class = model_class
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
11
|
+
def load_with_index!
|
12
|
+
with_cache do
|
13
|
+
build_name_index(load!)
|
14
|
+
end
|
13
15
|
end
|
14
16
|
|
15
17
|
protected
|
16
18
|
|
17
19
|
attr_reader :model_class
|
20
|
+
|
21
|
+
def load!
|
22
|
+
raise NotImplementedError, "#{self.class} must implement #load!"
|
23
|
+
end
|
24
|
+
|
25
|
+
# Optional: subclasses can wrap caching around the computation
|
26
|
+
def with_cache
|
27
|
+
yield
|
28
|
+
end
|
29
|
+
|
30
|
+
def build_name_index(records)
|
31
|
+
records.each_with_object({}) do |record, index|
|
32
|
+
index[record.name.to_sym] = record
|
33
|
+
|
34
|
+
next unless record.respond_to?(:alias_names)
|
35
|
+
|
36
|
+
record.alias_names&.each do |alias_name|
|
37
|
+
index[alias_name.to_sym] = record
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
18
41
|
end
|
19
42
|
end
|
20
43
|
end
|
@@ -19,15 +19,19 @@ module Gitlab
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def find_by_name(name)
|
22
|
-
|
22
|
+
name_index[name.to_sym]
|
23
23
|
end
|
24
24
|
|
25
25
|
def all
|
26
|
-
|
26
|
+
name_index.values.uniq
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
+
def name_index
|
32
|
+
data_loader.load_with_index!
|
33
|
+
end
|
34
|
+
|
31
35
|
def data_loader
|
32
36
|
@data_loader ||= Configuration.data_loader_class.new(self)
|
33
37
|
end
|
@@ -10,14 +10,14 @@ module Gitlab
|
|
10
10
|
class YamlDataLoader < AbstractDataLoader
|
11
11
|
include Overridable
|
12
12
|
|
13
|
+
protected
|
14
|
+
|
13
15
|
def load!
|
14
|
-
|
16
|
+
Dir.glob(data_files_path).map { |file| load_model_from_file(file) }
|
15
17
|
end
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
def load_data_from_files
|
20
|
-
@load_data_from_files ||= Dir.glob(data_files_path).map { |file| load_model_from_file(file) }
|
19
|
+
def with_cache
|
20
|
+
@name_index ||= yield
|
21
21
|
end
|
22
22
|
|
23
23
|
def data_files_path
|
@@ -10,9 +10,9 @@ module Gitlab
|
|
10
10
|
# Returns a hash of all data objects loaded from YAML files.
|
11
11
|
def self.load_all(loader_class: YamlDataLoader)
|
12
12
|
Base.subclasses.each_with_object({}) do |clazz, h|
|
13
|
-
data_obj = loader_class.new(clazz).
|
13
|
+
data_obj = loader_class.new(clazz).load_with_index!
|
14
14
|
key = clazz.name.demodulize.pluralize.underscore.to_sym
|
15
|
-
h[key] = data_obj.map(&:to_hash)
|
15
|
+
h[key] = data_obj.values.uniq.map(&:to_hash)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -23,7 +23,7 @@ module Gitlab
|
|
23
23
|
|
24
24
|
attr_reader :cut_off_date, :deprecated_by_url, :deprecation_message, :description, :documentation_url,
|
25
25
|
:feature_category, :group, :introduced_by_url, :milestone, :min_gitlab_version,
|
26
|
-
:min_gitlab_version_for_free_access, :name, :unit_primitive_issue_url
|
26
|
+
:min_gitlab_version_for_free_access, :name, :unit_primitive_issue_url, :alias_names
|
27
27
|
end
|
28
28
|
|
29
29
|
class Service < Base
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-cloud-connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikola Milojevic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|