foobara 0.0.11 → 0.0.13
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: a0fe6b2415dddaf6742ae9bd3809f807148d61a8595eff27c7053b7bdf2120b0
|
4
|
+
data.tar.gz: a0b48950e37a936d2b4aae09ab9fe5bceaed5ae46da724a7f0d64bfe4177e549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67a4249c5ca81daad7c7476eac81dafdea51224135e3e224ca31a4def8a0dc9906a79f4f4500f95a75446073ceccbab6d4ada74fca656bec305aebe7b2b546f7
|
7
|
+
data.tar.gz: da74f67ea8f39814874c2393c45ff514fd669dbd9865acbf7da4414e2ed702d9a9522d4381343f2201d6804f1b3d31565fa48926e5cf751f3376e8d7bd7069d4
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -14,7 +14,7 @@ run `foob generate ruby-project --name your-org/your-new-project-name`
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
-
|
17
|
+
You can find a code demo video and an overview video of what Foobara is at https://foobara.com
|
18
18
|
|
19
19
|
## Contributing
|
20
20
|
|
@@ -3,6 +3,12 @@ module Foobara
|
|
3
3
|
module Duck
|
4
4
|
module SupportedValidators
|
5
5
|
class OneOf < TypeDeclarations::Validator
|
6
|
+
class << self
|
7
|
+
def requires_parent_declaration_data?
|
8
|
+
true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
class ValueNotValidError < Foobara::Value::DataError
|
7
13
|
class << self
|
8
14
|
def context_type_declaration
|
@@ -18,6 +24,12 @@ module Foobara
|
|
18
24
|
declaration_data
|
19
25
|
end
|
20
26
|
|
27
|
+
def applicable?(value)
|
28
|
+
# Might there be some way this validator could be marked not-applicable that doesn't require coupling
|
29
|
+
# this processor to allow_nil? (or vice-versa)
|
30
|
+
!value.nil? || !parent_declaration_data[:allow_nil]
|
31
|
+
end
|
32
|
+
|
21
33
|
def validation_errors(value)
|
22
34
|
unless valid_values.include?(value)
|
23
35
|
build_error(value)
|
@@ -90,7 +90,7 @@ module Foobara
|
|
90
90
|
end
|
91
91
|
|
92
92
|
error_class = self.class.lookup_input_error_class(symbol, path)
|
93
|
-
error_class.new(**error_args
|
93
|
+
error_class.new(**error_args, path:)
|
94
94
|
elsif args.size == 2 || args.size == 3
|
95
95
|
input, symbol, message = args
|
96
96
|
context = opts
|
@@ -250,6 +250,24 @@ module Foobara
|
|
250
250
|
end
|
251
251
|
end
|
252
252
|
|
253
|
+
def connect_delayed(registerable_name, *args, **opts)
|
254
|
+
delayed_connections[registerable_name] = { args:, opts: }
|
255
|
+
end
|
256
|
+
|
257
|
+
def delayed_connections
|
258
|
+
@delayed_connections ||= {}
|
259
|
+
end
|
260
|
+
|
261
|
+
def process_delayed_connections
|
262
|
+
delayed_connections.each_pair do |registerable_name, arg_hash|
|
263
|
+
args = arg_hash[:args]
|
264
|
+
opts = arg_hash[:opts] || {}
|
265
|
+
|
266
|
+
const = Object.const_get(registerable_name)
|
267
|
+
connect(const, *args, **opts)
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
253
271
|
def connect(registerable, *, **)
|
254
272
|
case registerable
|
255
273
|
when Class
|
@@ -274,6 +292,8 @@ module Foobara
|
|
274
292
|
raise "Don't know how to register #{registerable} (#{registerable.class})"
|
275
293
|
# :nocov:
|
276
294
|
end
|
295
|
+
when Symbol, String
|
296
|
+
connect_delayed(registerable, *, **)
|
277
297
|
else
|
278
298
|
# :nocov:
|
279
299
|
raise "Don't know how to register #{registerable} (#{registerable.class})"
|
@@ -287,6 +307,8 @@ module Foobara
|
|
287
307
|
|
288
308
|
# TODO: maybe introduce a Runner interface?
|
289
309
|
def run(*, **)
|
310
|
+
process_delayed_connections
|
311
|
+
|
290
312
|
request, command = build_request_and_command(*, **)
|
291
313
|
|
292
314
|
# TODO: feels like a smell
|
@@ -325,6 +347,8 @@ module Foobara
|
|
325
347
|
end
|
326
348
|
|
327
349
|
def foobara_manifest
|
350
|
+
process_delayed_connections
|
351
|
+
|
328
352
|
# Drive all of this off of the list of exposed commands...
|
329
353
|
to_include = Set.new
|
330
354
|
to_include << command_registry.exposed_global_organization
|
@@ -410,6 +434,8 @@ module Foobara
|
|
410
434
|
end
|
411
435
|
|
412
436
|
def all_exposed_commands
|
437
|
+
process_delayed_connections
|
438
|
+
|
413
439
|
command_registry.foobara_all_command
|
414
440
|
end
|
415
441
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foobara-util
|
@@ -399,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
399
399
|
- !ruby/object:Gem::Version
|
400
400
|
version: '0'
|
401
401
|
requirements: []
|
402
|
-
rubygems_version: 3.5.
|
402
|
+
rubygems_version: 3.5.23
|
403
403
|
signing_key:
|
404
404
|
specification_version: 4
|
405
405
|
summary: Implements command pattern for encapsulating and managing domain complexity
|