kennel 1.162.0 → 1.163.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/filter.rb +3 -1
- data/lib/kennel/projects_provider.rb +27 -22
- data/lib/kennel/version.rb +1 -1
- data/lib/kennel.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: 0b07d4f21ef18f6f89875f4bdb1f4ba86144d4291180ffeff34ef6c8c8b6ad01
|
4
|
+
data.tar.gz: e90f0c27577b343baf745b342b6eea95053b029a788bdaf740c9a1e717da0303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4aa14e50c3b4c17690de793c84889e0a92fa48c6d59b491226cc487de75922ec98300cdaded30781ac22f1845c14a834aa9fec0bffe2b31d72fc4726a7948d95
|
7
|
+
data.tar.gz: 95b2a1d28f5f98703c7ba448cf865009e9d53989bb7aec3492adddde172f032ebdae447688615e29a1d47055f785a50ee8ea9fe7278ab7c88436b5e418529c7e
|
data/lib/kennel/filter.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Kennel
|
4
4
|
class Filter
|
5
|
+
attr_reader :project_filter
|
6
|
+
|
5
7
|
def initialize
|
6
8
|
# read early so we fail fast on invalid user input
|
7
9
|
@tracking_id_filter = read_tracking_id_filter_from_env
|
@@ -39,7 +41,7 @@ module Kennel
|
|
39
41
|
|
40
42
|
private
|
41
43
|
|
42
|
-
attr_reader :
|
44
|
+
attr_reader :tracking_id_filter
|
43
45
|
|
44
46
|
# needs to be called after read_tracking_id_filter_from_env
|
45
47
|
def read_project_filter_from_env
|
@@ -4,6 +4,10 @@ module Kennel
|
|
4
4
|
class AutoloadFailed < StandardError
|
5
5
|
end
|
6
6
|
|
7
|
+
def initialize(filter:)
|
8
|
+
@filter = filter
|
9
|
+
end
|
10
|
+
|
7
11
|
# @return [Array<Models::Project>]
|
8
12
|
# All projects in the system. This is a slow operation.
|
9
13
|
# Use `projects` to get all projects in the system.
|
@@ -39,33 +43,34 @@ module Kennel
|
|
39
43
|
loader.push_dir("projects")
|
40
44
|
loader.setup
|
41
45
|
|
42
|
-
if (
|
43
|
-
# we support PROJECT being used for nested folders, to allow teams to easily group their projects
|
44
|
-
# so when loading a project we need to find anything that could be a project source
|
45
|
-
# sorting by name and nesting level to avoid confusion
|
46
|
-
segments = project.split("_")
|
47
|
-
search = /#{segments[0...-1].map { |p| "#{p}[_/]" }.join}#{segments[-1]}(\.rb|\/project\.rb|\/base\.rb)/
|
48
|
-
|
46
|
+
if (projects = @filter.project_filter)
|
49
47
|
projects_path = "#{File.expand_path("projects")}/"
|
50
|
-
known_paths = loader.all_expected_cpaths.keys
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
48
|
+
known_paths = loader.all_expected_cpaths.keys.select! { |path| path.start_with?(projects_path) }
|
49
|
+
|
50
|
+
# - we support PROJECT being used for nested folders, to allow teams to easily group their projects
|
51
|
+
# - when loading a project we need to find anything that could be a project source
|
52
|
+
# sorting by name and nesting level to avoid confusion
|
53
|
+
projects.each do |project|
|
54
|
+
segments = project.tr("-", "_").split("_")
|
55
|
+
search = /#{segments[0...-1].map { |part| "#{part}[_/]" }.join}#{segments[-1]}(\.rb|\/project\.rb|\/base\.rb)/
|
56
|
+
|
57
|
+
if (project_path = known_paths.grep(search).sort.min_by { |path| path.count("/") })
|
58
|
+
require project_path
|
59
|
+
elsif autoload != "abort"
|
60
|
+
Kennel.err.puts(
|
61
|
+
"No projects/ file matching #{search} found" \
|
62
|
+
", falling back to slow loading of all projects instead"
|
63
|
+
)
|
64
|
+
loader.eager_load
|
65
|
+
break
|
66
|
+
else
|
67
|
+
raise AutoloadFailed, "No projects/ file matching #{search} found"
|
68
|
+
end
|
64
69
|
end
|
65
70
|
else # all projects needed
|
66
71
|
loader.eager_load
|
67
72
|
end
|
68
|
-
else # old style without autoload
|
73
|
+
else # old style without autoload to be removed eventually
|
69
74
|
loader.setup
|
70
75
|
loader.eager_load # TODO: this should not be needed but we see hanging CI processes when it's not added
|
71
76
|
# TODO: also auto-load projects and update expected path too
|
data/lib/kennel/version.rb
CHANGED
data/lib/kennel.rb
CHANGED
@@ -107,7 +107,7 @@ module Kennel
|
|
107
107
|
def generated(**kwargs)
|
108
108
|
@generated ||= begin
|
109
109
|
projects = Progress.progress "Loading projects", **kwargs do
|
110
|
-
projects = ProjectsProvider.new.projects
|
110
|
+
projects = ProjectsProvider.new(filter: filter).projects
|
111
111
|
filter.filter_projects projects
|
112
112
|
end
|
113
113
|
|
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.163.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-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|