kennel 1.157.0 → 1.159.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/lib/kennel/importer.rb +4 -6
- data/lib/kennel/models/record.rb +1 -0
- data/lib/kennel/projects_provider.rb +7 -3
- data/lib/kennel/syncer.rb +19 -1
- data/lib/kennel/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: afa96484d3351de6a715ca440d8a22d3eb81012866a08987b0ddce36b568ae48
|
4
|
+
data.tar.gz: 5f8d189f4447e998711ae07a1ee245c56c0453569a5a43e12ca8a9e9c3184030
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3886ae264c55d8112de1f16e7d0af92b97d1ecbf470219ff7131cb45df6fa115ef14142cc3c31056e88a135bb2c4091d15fd9a160a624875f2758db23ad70d8
|
7
|
+
data.tar.gz: 072d6d09e64c55e1a0c167ec884dfcf17102c05fdba614b5bbc1132e3c582cb5699c6bfdf1faf4d6a5d5d0b7b702adbc94b82753b20530d1d3d435593cea774a
|
data/lib/kennel/importer.rb
CHANGED
@@ -2,12 +2,9 @@
|
|
2
2
|
|
3
3
|
module Kennel
|
4
4
|
class Importer
|
5
|
-
# title will have the lock symbol we need to remove when re-importing
|
6
|
-
TITLES = [:name, :title].freeze
|
7
|
-
|
8
5
|
# bring important fields to the top
|
9
6
|
SORT_ORDER = [
|
10
|
-
*
|
7
|
+
*Kennel::Models::Record::TITLE_FIELDS, :id, :kennel_id, :type, :tags, :query, :sli_specification,
|
11
8
|
*Models::Record.subclasses.flat_map { |k| k::TRACKING_FIELDS },
|
12
9
|
:template_variables
|
13
10
|
].freeze
|
@@ -31,9 +28,10 @@ module Kennel
|
|
31
28
|
model.normalize({}, data) # removes id
|
32
29
|
data[:id] = id
|
33
30
|
|
34
|
-
|
31
|
+
# title will have the lock symbol we need to remove when re-importing
|
32
|
+
title_field = Kennel::Models::Record::TITLE_FIELDS.detect { |f| data[f] }
|
35
33
|
title = data.fetch(title_field)
|
36
|
-
title.tr!(Kennel::Models::Record::LOCK, "")
|
34
|
+
title.tr!(Kennel::Models::Record::LOCK, "")
|
37
35
|
|
38
36
|
# calculate or reuse kennel_id
|
39
37
|
data[:kennel_id] =
|
data/lib/kennel/models/record.rb
CHANGED
@@ -26,6 +26,7 @@ module Kennel
|
|
26
26
|
:deleted, :id, :created, :created_at, :creator, :org_id, :modified, :modified_at,
|
27
27
|
:klass, :tracking_id # added by syncer.rb
|
28
28
|
].freeze
|
29
|
+
TITLE_FIELDS = [:name, :title].freeze # possible fields that could have the title
|
29
30
|
ALLOWED_KENNEL_ID_CHARS = "a-zA-Z_\\d.-"
|
30
31
|
ALLOWED_KENNEL_ID_SEGMENT = /[#{ALLOWED_KENNEL_ID_CHARS}]+/
|
31
32
|
ALLOWED_KENNEL_ID_FULL = "#{ALLOWED_KENNEL_ID_SEGMENT}:#{ALLOWED_KENNEL_ID_SEGMENT}".freeze
|
@@ -31,15 +31,19 @@ module Kennel
|
|
31
31
|
# we support PROJECT being used for nested folders, to allow teams to easily group their projects
|
32
32
|
# so when loading a project we need to find anything that could be a project source
|
33
33
|
# sorting by name and nesting level to avoid confusion
|
34
|
+
segments = project.split("_")
|
35
|
+
search = /#{segments[0...-1].map { |p| "#{p}[_/]" }.join}#{segments[-1]}(\.rb|\/project\.rb)/
|
36
|
+
|
34
37
|
projects_path = "#{File.expand_path("projects")}/"
|
35
|
-
|
36
|
-
|
38
|
+
known_paths = loader.all_expected_cpaths.keys
|
39
|
+
project_path = known_paths.select do |path|
|
40
|
+
path.start_with?(projects_path) && path.match?(search)
|
37
41
|
end.sort.min_by { |p| p.count("/") }
|
38
42
|
if project_path
|
39
43
|
require project_path
|
40
44
|
else
|
41
45
|
Kennel.err.puts(
|
42
|
-
"No file
|
46
|
+
"No projects/ file matching #{search} found" \
|
43
47
|
", falling back to slow loading of all projects instead"
|
44
48
|
)
|
45
49
|
loader.eager_load
|
data/lib/kennel/syncer.rb
CHANGED
@@ -89,6 +89,24 @@ module Kennel
|
|
89
89
|
|
90
90
|
# see which expected match the actual
|
91
91
|
matching, unmatched_expected, unmatched_actual = MatchedExpected.partition(expected, actual)
|
92
|
+
unmatched_actual.select! { |a| a.fetch(:tracking_id) } # ignore items that were never managed by kennel
|
93
|
+
|
94
|
+
# if there is a new item that has the same name/title as a to be deleted item, we should just update it
|
95
|
+
# careful with unmatched_expected being huge since it has all api resources
|
96
|
+
unmatched_expected.reject! do |e|
|
97
|
+
actual = unmatched_actual.detect do |a|
|
98
|
+
a[:klass] == e.class &&
|
99
|
+
Kennel::Models::Record::TITLE_FIELDS.any? { |f| (set = a[f]) && set == e.as_json.fetch(f) }
|
100
|
+
end
|
101
|
+
next false unless actual # keep in unmatched
|
102
|
+
|
103
|
+
unmatched_actual.delete(actual)
|
104
|
+
actual[:tracking_id] = e.tracking_id
|
105
|
+
matching << [e, actual]
|
106
|
+
|
107
|
+
true # remove from unmatched
|
108
|
+
end
|
109
|
+
|
92
110
|
validate_expected_id_not_missing unmatched_expected
|
93
111
|
fill_details! matching # need details to diff later
|
94
112
|
|
@@ -105,7 +123,7 @@ module Kennel
|
|
105
123
|
end.compact
|
106
124
|
|
107
125
|
# delete previously managed
|
108
|
-
deletes = unmatched_actual.map { |a| Types::PlannedDelete.new(a)
|
126
|
+
deletes = unmatched_actual.map { |a| Types::PlannedDelete.new(a) }
|
109
127
|
|
110
128
|
# unmatched expected need to be created
|
111
129
|
unmatched_expected.each(&:add_tracking_id)
|
data/lib/kennel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kennel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.159.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|