kennel 1.163.0 → 1.163.2
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/projects_provider.rb +46 -13
- 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: 9d1c9696c979e6a8bedf59a717376cb9d483164c86683a90e2208087694c1a83
|
4
|
+
data.tar.gz: f8c0b7f924cb4e8e3c0c3966406b47de23e472034e6fafaef5e5817826e12bb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 218aefed2969de6f3ce27c2bb94248a486fc9eae81eda0cf546d0016995b92e994e8561abbece9c9b87cf64f0de8c266769d0aefb13bdeed90f989b683b06559
|
7
|
+
data.tar.gz: 88c1cea6f02c9952ab27de289867d2df12bbbb5e3d6bf6053145b434b34efe350e7ec01060379adee1edf244ad25ec104f9bfe03cf1fd9b1ee1e0c9db0d44979
|
@@ -13,7 +13,7 @@ module Kennel
|
|
13
13
|
# Use `projects` to get all projects in the system.
|
14
14
|
def all_projects
|
15
15
|
load_all
|
16
|
-
|
16
|
+
loaded_projects.map(&:new)
|
17
17
|
end
|
18
18
|
|
19
19
|
# @return [Array<Models::Project>]
|
@@ -21,11 +21,15 @@ module Kennel
|
|
21
21
|
|
22
22
|
def projects
|
23
23
|
load_all
|
24
|
-
|
24
|
+
loaded_projects.map(&:new)
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
+
def loaded_projects
|
30
|
+
Models::Project.recursive_subclasses
|
31
|
+
end
|
32
|
+
|
29
33
|
# load_all's purpose is to "require" all the .rb files under './projects',
|
30
34
|
# while allowing them to resolve reference to ./teams and ./parts via autoload
|
31
35
|
def load_all
|
@@ -47,19 +51,18 @@ module Kennel
|
|
47
51
|
projects_path = "#{File.expand_path("projects")}/"
|
48
52
|
known_paths = loader.all_expected_cpaths.keys.select! { |path| path.start_with?(projects_path) }
|
49
53
|
|
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
54
|
projects.each do |project|
|
54
|
-
|
55
|
-
|
55
|
+
search = project_search project
|
56
|
+
|
57
|
+
# sort by name and nesting level to pick the best candidate
|
58
|
+
found = known_paths.grep(search).sort.sort_by { |path| path.count("/") }
|
56
59
|
|
57
|
-
if
|
58
|
-
require
|
60
|
+
if found.any?
|
61
|
+
require found.first
|
62
|
+
assert_project_loaded search, found
|
59
63
|
elsif autoload != "abort"
|
60
64
|
Kennel.err.puts(
|
61
|
-
"No projects/ file matching #{search} found"
|
62
|
-
", falling back to slow loading of all projects instead"
|
65
|
+
"No projects/ file matching #{search} found, falling back to slow loading of all projects instead"
|
63
66
|
)
|
64
67
|
loader.eager_load
|
65
68
|
break
|
@@ -67,10 +70,12 @@ module Kennel
|
|
67
70
|
raise AutoloadFailed, "No projects/ file matching #{search} found"
|
68
71
|
end
|
69
72
|
end
|
70
|
-
else
|
73
|
+
else
|
74
|
+
# all projects needed
|
71
75
|
loader.eager_load
|
72
76
|
end
|
73
|
-
else
|
77
|
+
else
|
78
|
+
# old style without autoload to be removed eventually
|
74
79
|
loader.setup
|
75
80
|
loader.eager_load # TODO: this should not be needed but we see hanging CI processes when it's not added
|
76
81
|
# TODO: also auto-load projects and update expected path too
|
@@ -99,5 +104,33 @@ module Kennel
|
|
99
104
|
|
100
105
|
raise
|
101
106
|
end
|
107
|
+
|
108
|
+
# - support PROJECT being used for nested folders, to allow teams to easily group their projects
|
109
|
+
# - support PROJECT.rb but also PROJECT/base.rb or PROJECT/project.rb
|
110
|
+
def project_search(project)
|
111
|
+
suffixes = ["base.rb", "project.rb"]
|
112
|
+
project_match = Regexp.escape(project.tr("-", "_")).gsub("_", "[-_/]")
|
113
|
+
/\/#{project_match}(\.rb|#{suffixes.map { |s| Regexp.escape "/#{s}" }.join("|")})$/
|
114
|
+
end
|
115
|
+
|
116
|
+
def assert_project_loaded(search, paths)
|
117
|
+
return if loaded_projects.any?
|
118
|
+
paths = paths.map { |path| path.sub("#{Dir.pwd}/", "") }
|
119
|
+
raise(
|
120
|
+
AutoloadFailed,
|
121
|
+
<<~MSG
|
122
|
+
No project found in loaded files!
|
123
|
+
Ensure the project file you want to load is first in the list,
|
124
|
+
list is sorted alphabetically and by nesting level.
|
125
|
+
|
126
|
+
Loaded:
|
127
|
+
#{paths.first}
|
128
|
+
After finding:
|
129
|
+
#{paths.join("\n")}
|
130
|
+
With regex:
|
131
|
+
#{search}
|
132
|
+
MSG
|
133
|
+
)
|
134
|
+
end
|
102
135
|
end
|
103
136
|
end
|
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.163.
|
4
|
+
version: 1.163.2
|
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-05-
|
11
|
+
date: 2025-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|