foobara 0.0.141 → 0.0.142
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6defed2fda94d3c5f244f9f24eb9a32f4d06999bc773071dc58667565518499
|
4
|
+
data.tar.gz: 98a0f663a38ce6b105f78fbbefdc1e34328654ec54755daa379df824753f3214
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c42abcbd62eba3583acfd4345df530ec04efdc18d19773ce1ed5dafa9e0d43d09364b2b45355a22874b2aeaf030d476726cbd214ec1a3626812b2a20c35133f
|
7
|
+
data.tar.gz: 7cc3b4e13250e4cc2b3af8468b2f5774861161fcc13972ecc87f17c1682bd8a69170a080b6f9cc72249ff5756d2a7f1ca509dfaeba2ac52bbf9896c8b9a4f3e6
|
data/CHANGELOG.md
CHANGED
@@ -27,7 +27,7 @@ module Foobara
|
|
27
27
|
|
28
28
|
def error_array
|
29
29
|
# :nocov:
|
30
|
-
warn "DEPRECATED: Do not call ErrorCollection#
|
30
|
+
warn "DEPRECATED: Do not call ErrorCollection#error_array instead just use the collection directly."
|
31
31
|
self
|
32
32
|
# :nocov:
|
33
33
|
end
|
@@ -3,6 +3,16 @@ require_relative "scoped"
|
|
3
3
|
module Foobara
|
4
4
|
class Namespace
|
5
5
|
module IsNamespace
|
6
|
+
class << self
|
7
|
+
def lru_cache
|
8
|
+
@lru_cache ||= Foobara::LruCache.new(100)
|
9
|
+
end
|
10
|
+
|
11
|
+
def clear_lru_cache!
|
12
|
+
@lru_cache = nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
6
16
|
include Scoped
|
7
17
|
|
8
18
|
def scoped_clear_caches
|
@@ -90,6 +100,8 @@ module Foobara
|
|
90
100
|
|
91
101
|
def foobara_register(scoped)
|
92
102
|
foobara_registry.register(scoped)
|
103
|
+
|
104
|
+
IsNamespace.clear_lru_cache!
|
93
105
|
# awkward??
|
94
106
|
scoped.scoped_namespace = self
|
95
107
|
|
@@ -108,6 +120,8 @@ module Foobara
|
|
108
120
|
foobara_registry.unregister(scoped)
|
109
121
|
foobara_children.delete(scoped)
|
110
122
|
scoped.scoped_namespace = nil
|
123
|
+
|
124
|
+
IsNamespace.clear_lru_cache!
|
111
125
|
end
|
112
126
|
|
113
127
|
def foobara_unregister_all
|
@@ -116,17 +130,30 @@ module Foobara
|
|
116
130
|
end
|
117
131
|
end
|
118
132
|
|
133
|
+
def lru_cache
|
134
|
+
IsNamespace.lru_cache
|
135
|
+
end
|
136
|
+
|
119
137
|
def foobara_lookup(
|
120
138
|
path,
|
121
139
|
filter: nil,
|
122
140
|
mode: LookupMode::GENERAL,
|
123
|
-
visited:
|
141
|
+
visited: nil,
|
124
142
|
initial: true
|
125
143
|
)
|
144
|
+
# TODO: make it so this is only necessary when initial
|
126
145
|
path = Namespace.to_registry_path(path)
|
127
146
|
visited_key = [path, mode, initial, self]
|
128
|
-
return nil if visited.include?(visited_key)
|
129
147
|
|
148
|
+
if initial
|
149
|
+
lru_key = [path, mode, self, filter]
|
150
|
+
found, value = lru_cache.get(lru_key)
|
151
|
+
return value if found
|
152
|
+
end
|
153
|
+
|
154
|
+
return nil if visited&.include?(visited_key)
|
155
|
+
|
156
|
+
visited ||= Set.new
|
130
157
|
visited << visited_key
|
131
158
|
|
132
159
|
LookupMode.validate!(mode)
|
@@ -139,7 +166,13 @@ module Foobara
|
|
139
166
|
visited:,
|
140
167
|
initial: false
|
141
168
|
)
|
142
|
-
|
169
|
+
if scoped
|
170
|
+
if initial
|
171
|
+
lru_cache.set_if_missing(lru_key, scoped)
|
172
|
+
end
|
173
|
+
|
174
|
+
return scoped
|
175
|
+
end
|
143
176
|
|
144
177
|
candidates = foobara_children.map do |namespace|
|
145
178
|
namespace.foobara_lookup(path, filter:, mode:, visited:, initial: false)
|
@@ -152,8 +185,14 @@ module Foobara
|
|
152
185
|
# :nocov:
|
153
186
|
end
|
154
187
|
|
155
|
-
|
156
|
-
|
188
|
+
scoped = candidates.first ||
|
189
|
+
foobara_parent_namespace&.foobara_lookup(path, filter:, mode:, visited:, initial: false)
|
190
|
+
|
191
|
+
if initial
|
192
|
+
lru_cache.set_if_missing(lru_key, scoped)
|
193
|
+
end
|
194
|
+
|
195
|
+
return scoped
|
157
196
|
end
|
158
197
|
|
159
198
|
if path[0] == ""
|
@@ -171,11 +210,19 @@ module Foobara
|
|
171
210
|
partial = foobara_registry.lookup(path, filter)
|
172
211
|
|
173
212
|
if mode == LookupMode::DIRECT
|
213
|
+
if initial
|
214
|
+
lru_cache.set_if_missing(lru_key, partial)
|
215
|
+
end
|
216
|
+
|
174
217
|
return partial
|
175
218
|
end
|
176
219
|
|
177
220
|
if partial
|
178
221
|
if partial.scoped_path == path
|
222
|
+
if initial
|
223
|
+
lru_cache.set_if_missing(lru_key, partial)
|
224
|
+
end
|
225
|
+
|
179
226
|
return partial
|
180
227
|
end
|
181
228
|
end
|
@@ -187,18 +234,39 @@ module Foobara
|
|
187
234
|
end
|
188
235
|
|
189
236
|
scoped = _lookup_in(path, to_consider, filter:, visited:)
|
190
|
-
|
237
|
+
|
238
|
+
if scoped
|
239
|
+
if initial
|
240
|
+
lru_cache.set_if_missing(lru_key, scoped)
|
241
|
+
end
|
242
|
+
|
243
|
+
return scoped
|
244
|
+
end
|
191
245
|
|
192
246
|
if [LookupMode::GENERAL, LookupMode::STRICT].include?(mode) && foobara_parent_namespace
|
193
247
|
scoped = foobara_parent_namespace.foobara_lookup(
|
194
248
|
path, filter:, mode: LookupMode::STRICT, visited:, initial: false
|
195
249
|
)
|
196
|
-
|
250
|
+
|
251
|
+
if scoped
|
252
|
+
if initial
|
253
|
+
lru_cache.set_if_missing(lru_key, scoped)
|
254
|
+
end
|
255
|
+
|
256
|
+
return scoped
|
257
|
+
end
|
197
258
|
end
|
198
259
|
|
199
260
|
if mode == LookupMode::GENERAL
|
200
261
|
scoped = _lookup_in(path, foobara_depends_on_namespaces, filter:, visited:)
|
201
|
-
|
262
|
+
|
263
|
+
if scoped
|
264
|
+
if initial
|
265
|
+
lru_cache.set_if_missing(lru_key, scoped)
|
266
|
+
end
|
267
|
+
|
268
|
+
return scoped
|
269
|
+
end
|
202
270
|
end
|
203
271
|
|
204
272
|
to_consider = case mode
|
@@ -219,7 +287,14 @@ module Foobara
|
|
219
287
|
end
|
220
288
|
|
221
289
|
scoped = candidates.first || partial
|
222
|
-
|
290
|
+
|
291
|
+
if scoped
|
292
|
+
if initial
|
293
|
+
lru_cache.set_if_missing(lru_key, scoped)
|
294
|
+
end
|
295
|
+
|
296
|
+
return scoped
|
297
|
+
end
|
223
298
|
|
224
299
|
# As a last resort we'll see if we're trying to fetch a builtin type from a different namespace
|
225
300
|
# TODO: these lookup modes are really confusing and were designed prior to having multiple root
|
@@ -228,6 +303,7 @@ module Foobara
|
|
228
303
|
scoped = Namespace.global.foobara_lookup(path, filter:, mode: LookupMode::ABSOLUTE, visited:, initial: false)
|
229
304
|
|
230
305
|
if scoped.is_a?(Types::Type) && scoped.builtin?
|
306
|
+
lru_cache.set_if_missing(lru_key, scoped)
|
231
307
|
scoped
|
232
308
|
end
|
233
309
|
end
|
@@ -7,11 +7,10 @@ module Foobara
|
|
7
7
|
class ShortTypeNameDesugarizer < TypeDeclarations::Desugarizer
|
8
8
|
def applicable?(sugary_type_declaration)
|
9
9
|
return false if TypeDeclarations.strict_stringified? || TypeDeclarations.strict?
|
10
|
+
return false unless sugary_type_declaration.is_a?(::Hash)
|
10
11
|
|
11
12
|
sugary_type_declaration = sugary_type_declaration.dup
|
12
13
|
|
13
|
-
return false unless sugary_type_declaration.is_a?(::Hash)
|
14
|
-
|
15
14
|
sugary_type_declaration = normalize_type(sugary_type_declaration)
|
16
15
|
|
17
16
|
if sugary_type_declaration.key?(:type) &&
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.142
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bigdecimal
|
@@ -27,44 +27,44 @@ dependencies:
|
|
27
27
|
name: foobara-lru-cache
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- - "
|
30
|
+
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.0
|
32
|
+
version: 2.0.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - "<"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.0
|
39
|
+
version: 2.0.0
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: foobara-util
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 2.0.0
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 2.0.0
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: inheritable-thread-vars
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.0
|
60
|
+
version: 2.0.0
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - "<"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.0
|
67
|
+
version: 2.0.0
|
68
68
|
description: A command-centric and discoverable software framework with a focus on
|
69
69
|
domain concepts and abstracting away integration code
|
70
70
|
email:
|
@@ -535,7 +535,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
535
535
|
- !ruby/object:Gem::Version
|
536
536
|
version: '0'
|
537
537
|
requirements: []
|
538
|
-
rubygems_version: 3.6.
|
538
|
+
rubygems_version: 3.6.9
|
539
539
|
specification_version: 4
|
540
540
|
summary: A command-centric and discoverable software framework with a focus on domain
|
541
541
|
concepts and abstracting away integration code
|