foobara 0.7.0 → 0.7.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/CHANGELOG.md +8 -0
- data/projects/command/src/command_pattern_implementation/concerns/namespace.rb +2 -0
- data/projects/typesystem/projects/builtin_types/lib/foobara/builtin_types.rb +5 -0
- data/projects/typesystem/projects/builtin_types/src/builtin_types.rb +13 -1
- data/projects/typesystem/projects/namespace/src/scoped.rb +0 -1
- data/projects/typesystem/projects/project/src/foobara.rb +6 -0
- data/projects/typesystem/projects/project/src/project.rb +5 -0
- data/projects/typesystem/projects/type_declarations/lib/foobara/type_declarations.rb +65 -20
- data/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 17ca255f468f8568e14b741e8459e61383ce4585c45d4758d03ef511877bd2a7
|
|
4
|
+
data.tar.gz: 32d549de52cad428018c84ff393615ff6e1411159253c0dfbe5b6b6eade9680d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 868f5b42ebddfd7841747bcb306293045d2139aa2971f33c39004d093c6be2609fcc3e774a23e7c747b3af89d77001767c4b895949b5f5fb7fe5b0017b765de8
|
|
7
|
+
data.tar.gz: 3560e3610996c67ec36fc657699e8a009db478a825dc409098b905d0659b04bcdc2d5bd58f2410a9fd2b95d3471f80740c3937872f6a3f8bdb52f6c3bdc956a8
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# [0.7.2] - 2026-10-10
|
|
2
|
+
|
|
3
|
+
- Add `Foobara.start!` to allow post-install commands to survive reset
|
|
4
|
+
|
|
5
|
+
# [0.7.1] - 2026-10-09
|
|
6
|
+
|
|
7
|
+
- Fix bug that removes Foobara::RuntimeError from GlobalDomain during type declaration init
|
|
8
|
+
|
|
1
9
|
# [0.7.0] - 2026-10-09
|
|
2
10
|
|
|
3
11
|
- Do not allow anything but domains (and orgs as a hack) to be children of orgs
|
|
@@ -62,6 +62,11 @@ module Foobara
|
|
|
62
62
|
associative_array = build_and_register!(:associative_array, duckture, ::Hash)
|
|
63
63
|
# TODO: uh oh... we do some translations in the casting here...
|
|
64
64
|
build_and_register!(:attributes, associative_array, nil)
|
|
65
|
+
|
|
66
|
+
if needs_to_handle_reregistered_types
|
|
67
|
+
GlobalDomain.foobara_each_command(&:handle_reregistered_types!)
|
|
68
|
+
self.needs_to_handle_reregistered_types = false
|
|
69
|
+
end
|
|
65
70
|
end
|
|
66
71
|
|
|
67
72
|
def reset_all
|
|
@@ -5,6 +5,8 @@ module Foobara
|
|
|
5
5
|
|
|
6
6
|
module BuiltinTypes
|
|
7
7
|
class << self
|
|
8
|
+
attr_accessor :needs_to_handle_reregistered_types
|
|
9
|
+
|
|
8
10
|
# TODO: break this up
|
|
9
11
|
# TODO: much of this behavior is helpful to non-builtin types as well.
|
|
10
12
|
def build_and_register!(
|
|
@@ -86,7 +88,17 @@ module Foobara
|
|
|
86
88
|
|
|
87
89
|
# TODO: really need to encapsulate this somehow...
|
|
88
90
|
type.type_symbol = type_symbol
|
|
89
|
-
|
|
91
|
+
|
|
92
|
+
domain = type.foobara_parent_namespace || GlobalDomain
|
|
93
|
+
mode = Namespace::LookupMode::DIRECT
|
|
94
|
+
|
|
95
|
+
exists = domain.foobara_registered?(type_symbol, mode:)
|
|
96
|
+
if exists
|
|
97
|
+
domain.foobara_unregister(domain.foobara_lookup_type(type_symbol, mode:))
|
|
98
|
+
self.needs_to_handle_reregistered_types = true
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
domain.foobara_register(type)
|
|
90
102
|
|
|
91
103
|
supported_casters_module = Util.constant_value(builtin_type_module, :SupportedCasters)
|
|
92
104
|
supported_caster_classes = if supported_casters_module
|
|
@@ -17,35 +17,56 @@ module Foobara
|
|
|
17
17
|
[
|
|
18
18
|
:@foobara_children,
|
|
19
19
|
:@foobara_registry,
|
|
20
|
-
:@foobara_type_builder
|
|
20
|
+
:@foobara_type_builder,
|
|
21
|
+
:@lru_cache
|
|
21
22
|
].each do |var_name|
|
|
22
|
-
|
|
23
|
-
[
|
|
24
|
-
Namespace.global,
|
|
25
|
-
Foobara::GlobalOrganization,
|
|
26
|
-
Foobara::GlobalDomain,
|
|
27
|
-
Domain,
|
|
28
|
-
Types::Type,
|
|
29
|
-
Value::Processor,
|
|
30
|
-
Error
|
|
31
|
-
].each do |klass|
|
|
23
|
+
namespaces_to_reset.each do |klass|
|
|
32
24
|
if klass.instance_variable_defined?(var_name)
|
|
33
25
|
klass.remove_instance_variable(var_name)
|
|
34
26
|
end
|
|
35
27
|
end
|
|
36
28
|
end
|
|
37
29
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
Namespace.clear_lru_cache!
|
|
31
|
+
|
|
32
|
+
@original_scoped.each_key do |namespace|
|
|
33
|
+
scoped = @original_scoped[namespace]
|
|
34
|
+
to_remove = []
|
|
35
|
+
|
|
36
|
+
scoped.each do |child|
|
|
37
|
+
if child.scoped_unregistered?
|
|
38
|
+
to_remove << child
|
|
39
|
+
next
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
unless namespace.foobara_registered?(child, mode: Namespace::LookupMode::DIRECT)
|
|
43
|
+
namespace.foobara_register(child)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
children = namespace.foobara_children
|
|
48
|
+
|
|
49
|
+
to_remove.each do |child|
|
|
50
|
+
children.delete(child)
|
|
51
|
+
scoped.delete(child)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
to_remove.clear
|
|
41
55
|
|
|
42
|
-
|
|
56
|
+
@original_children[namespace].each do |child|
|
|
57
|
+
if child.scoped_unregistered?
|
|
58
|
+
to_remove << child
|
|
59
|
+
next
|
|
60
|
+
end
|
|
61
|
+
children << child unless children.include?(child)
|
|
62
|
+
end
|
|
43
63
|
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
to_remove.each do |child|
|
|
65
|
+
@original_children[namespace].delete(child)
|
|
66
|
+
end
|
|
46
67
|
end
|
|
47
68
|
|
|
48
|
-
|
|
69
|
+
Namespace.clear_lru_cache!
|
|
49
70
|
|
|
50
71
|
register_type_declaration(Handlers::RegisteredTypeDeclaration.new)
|
|
51
72
|
register_type_declaration(Handlers::ExtendRegisteredTypeDeclaration.new)
|
|
@@ -117,11 +138,35 @@ module Foobara
|
|
|
117
138
|
capture_current_namespaces
|
|
118
139
|
end
|
|
119
140
|
|
|
141
|
+
def start! = capture_current_namespaces
|
|
142
|
+
|
|
143
|
+
private
|
|
144
|
+
|
|
120
145
|
def capture_current_namespaces
|
|
121
146
|
# TODO: this feels like the wrong place to do this but doing it here for now to make sure it's done when
|
|
122
147
|
# most important
|
|
123
|
-
@original_scoped =
|
|
124
|
-
@original_children =
|
|
148
|
+
@original_scoped = {}
|
|
149
|
+
@original_children = {}
|
|
150
|
+
|
|
151
|
+
namespaces_to_reset.each do |namespace|
|
|
152
|
+
next unless namespace.is_a?(Namespace::IsNamespace)
|
|
153
|
+
|
|
154
|
+
@original_scoped[namespace] = namespace.foobara_registry.all_scoped.dup
|
|
155
|
+
@original_children[namespace] = namespace.foobara_children.dup
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def namespaces_to_reset
|
|
160
|
+
[
|
|
161
|
+
Foobara::GlobalDomain,
|
|
162
|
+
Foobara::GlobalOrganization,
|
|
163
|
+
Value::Processor,
|
|
164
|
+
Types::Type,
|
|
165
|
+
Domain,
|
|
166
|
+
Error,
|
|
167
|
+
Foobara,
|
|
168
|
+
Namespace.global
|
|
169
|
+
]
|
|
125
170
|
end
|
|
126
171
|
end
|
|
127
172
|
end
|
data/version.rb
CHANGED