foobara 0.8.0 → 0.8.1
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 +5 -0
- data/README.md +4 -0
- data/projects/command_connectors/src/command_connector.rb +4 -4
- data/projects/entities/projects/detached_entity/src/concerns/initialization.rb +1 -1
- data/projects/typesystem/projects/model/src/model.rb +7 -17
- data/projects/typesystem/projects/namespace/src/is_namespace.rb +1 -1
- data/projects/typesystem/projects/namespace/src/namespace.rb +9 -1
- data/projects/typesystem/projects/type_declarations/src/handlers/registered_type_declaration/to_type_transformer.rb +25 -1
- data/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8fee679ea0c3530123d404942baa9c01c5ae0f45f459cafd04d172573bdc06d2
|
|
4
|
+
data.tar.gz: c0c540fb7b0b955cefc534132ef5e52be427bbb183514c53f0ff9b9fa4e06522
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 13ecaf175130d2e601f2e698186869f30214d8a4e95a320d5bb8b594807c764e03f6626d703995852a625722b2cac3ffc926cb7b2071b3750858e2828ea7eae8
|
|
7
|
+
data.tar.gz: 5f7a31a516dcd8e784c07c8f9762ed2d1b5e7a00dddef036db1401378a40885d5584ebe180d596a3ac8b73c47cd86504c7a3291c956ba2700d15bdc0bb66c2ac
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# [0.8.1] - 2026-11-29
|
|
2
|
+
|
|
3
|
+
- Fix a bug where SomeModel.new wouldn't apply default attributes
|
|
4
|
+
- Improve error message when a foobara type doesn't exist because it hasn't been loaded yet
|
|
5
|
+
|
|
1
6
|
# [0.8.0] - 2026-11-17
|
|
2
7
|
|
|
3
8
|
- Eliminate dependency on the bigdecimal gem and relocate it to foobara-big-decimal-type
|
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
Foobara is a software framework that is command-centric and discoverable.
|
|
2
2
|
|
|
3
|
+
[](https://www.rubyforum.org/tag/foobara)
|
|
4
|
+
|
|
3
5
|
Domain operations are
|
|
4
6
|
encapsulated in commands, which serve as the public interface to systems, and which automatically
|
|
5
7
|
provide machine-readable formal metadata about those commands.
|
|
@@ -2128,6 +2130,8 @@ TODO: give some code examples
|
|
|
2128
2130
|
|
|
2129
2131
|
Are you actually trying to build something with Foobara? Happy to help! miles@foobara.org
|
|
2130
2132
|
|
|
2133
|
+
You can also use the `foobara` tag on the [Ruby Users Forum](https://www.rubyforum.org/tag/foobara/129)
|
|
2134
|
+
|
|
2131
2135
|
# Contributing
|
|
2132
2136
|
|
|
2133
2137
|
There are many ways you could help! There are tasks in the codebase for all skill levels including absolute beginner.
|
|
@@ -659,10 +659,10 @@ module Foobara
|
|
|
659
659
|
!command_class.builtin?
|
|
660
660
|
unless command.allowed_rule
|
|
661
661
|
raise NoAllowedRuleGivenError,
|
|
662
|
-
"Must connect #{command.full_command_name} with an `
|
|
663
|
-
"because `requires_allowed_rule` is true. You can use `allow_if: :always` if want to always
|
|
664
|
-
"this command to be
|
|
665
|
-
"when creating the connector if you don't want to enforce
|
|
662
|
+
"Must connect #{command.full_command_name} with an `allow_if:` " \
|
|
663
|
+
"because `requires_allowed_rule` is true. You can use `allow_if: :always` if you want to always " \
|
|
664
|
+
"allow this command to be run or you can also use `requires_allowed_rule: false` " \
|
|
665
|
+
"when creating the connector if you don't want to enforce allow_if: for all connected commands."
|
|
666
666
|
end
|
|
667
667
|
end
|
|
668
668
|
|
|
@@ -214,25 +214,15 @@ module Foobara
|
|
|
214
214
|
|
|
215
215
|
validate = options[:validate]
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
if validate
|
|
219
|
-
# simplecov:disable
|
|
220
|
-
raise ArgumentError, "Cannot use validate option without attributes"
|
|
221
|
-
# simplecov:enable
|
|
222
|
-
end
|
|
223
|
-
else
|
|
224
|
-
if Thread.inheritable_thread_local_var_get(:foobara_ignore_unexpected_attributes)
|
|
225
|
-
outcome = attributes_type.process_value(attributes)
|
|
217
|
+
outcome = attributes_type.process_value(attributes || {})
|
|
226
218
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
end
|
|
219
|
+
if outcome.success?
|
|
220
|
+
attributes = outcome.result
|
|
221
|
+
end
|
|
231
222
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
end
|
|
223
|
+
self.mutable = true
|
|
224
|
+
attributes&.each_pair do |attribute_name, value|
|
|
225
|
+
write_attribute(attribute_name, value)
|
|
236
226
|
end
|
|
237
227
|
|
|
238
228
|
mutable = if options.key?(:mutable)
|
|
@@ -73,7 +73,15 @@ module Foobara
|
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
-
class NotFoundError < StandardError
|
|
76
|
+
class NotFoundError < StandardError
|
|
77
|
+
attr_accessor :symbol
|
|
78
|
+
|
|
79
|
+
def initialize(symbol)
|
|
80
|
+
self.symbol = symbol
|
|
81
|
+
|
|
82
|
+
super("Could not find #{symbol}")
|
|
83
|
+
end
|
|
84
|
+
end
|
|
77
85
|
|
|
78
86
|
def initialize(scoped_name_or_path = nil, parent_namespace: nil)
|
|
79
87
|
NamespaceHelpers.initialize_foobara_namespace(self, scoped_name_or_path, parent_namespace:)
|
|
@@ -4,6 +4,12 @@ module Foobara
|
|
|
4
4
|
module TypeDeclarations
|
|
5
5
|
module Handlers
|
|
6
6
|
class RegisteredTypeDeclaration < TypeDeclarationHandler
|
|
7
|
+
class NotRegisteredError < Foobara::Error
|
|
8
|
+
context :symbol
|
|
9
|
+
|
|
10
|
+
def message = "Not registered: #{context}"
|
|
11
|
+
end
|
|
12
|
+
|
|
7
13
|
# TODO: seems like we have more base classes than we need
|
|
8
14
|
class ToTypeTransformer < TypeDeclarations::ToTypeTransformer
|
|
9
15
|
def transform(strict_type_declaration)
|
|
@@ -15,7 +21,13 @@ module Foobara
|
|
|
15
21
|
|
|
16
22
|
return type if type
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
type_symbol = if strict_type_declaration.reference?
|
|
25
|
+
strict_type_declaration.declaration_data
|
|
26
|
+
else
|
|
27
|
+
strict_type_declaration[:type]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
type = lookup_type!(type_symbol, mode: Namespace::LookupMode::ABSOLUTE)
|
|
19
31
|
|
|
20
32
|
strict_type_declaration.base_type = type
|
|
21
33
|
end
|
|
@@ -23,6 +35,18 @@ module Foobara
|
|
|
23
35
|
def target_classes(strict_type_declaration)
|
|
24
36
|
registered_type(strict_type_declaration).target_classes
|
|
25
37
|
end
|
|
38
|
+
|
|
39
|
+
def process_value(strict_type_declaration)
|
|
40
|
+
super
|
|
41
|
+
rescue Foobara::Namespace::NotFoundError => e
|
|
42
|
+
raise unless strict_type_declaration.reference?
|
|
43
|
+
|
|
44
|
+
type_symbol = strict_type_declaration.declaration_data
|
|
45
|
+
|
|
46
|
+
raise if e.symbol != type_symbol
|
|
47
|
+
|
|
48
|
+
Outcome.error(NotRegisteredError.new(context: type_symbol))
|
|
49
|
+
end
|
|
26
50
|
end
|
|
27
51
|
end
|
|
28
52
|
end
|
data/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foobara
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miles Georgi
|
|
@@ -513,6 +513,7 @@ metadata:
|
|
|
513
513
|
homepage_uri: https://foobara.org
|
|
514
514
|
source_code_uri: https://github.com/foobara/foobara
|
|
515
515
|
changelog_uri: https://github.com/foobara/foobara/blob/main/CHANGELOG.md
|
|
516
|
+
mailing_list_uri: https://www.rubyforum.org/tag/foobara
|
|
516
517
|
rubygems_mfa_required: 'true'
|
|
517
518
|
rdoc_options: []
|
|
518
519
|
require_paths:
|