foobara 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 753b97d573a8a3b7f532c3e453282944783aab55b3adfcdb7aaef33514396393
4
- data.tar.gz: 2da621b2f9b6fbcfe43869f46fad62e59b5aee755a9c0a0ef9bf1f7c39fd8def
3
+ metadata.gz: ba10d37c4533cfc81d05e0964f0ba945b3567d09342429d7d6b72d354fff06f3
4
+ data.tar.gz: '09e88cc0896ddf2ff3e659b99a6e61e613b125f1f6fc01c5777419964313843b'
5
5
  SHA512:
6
- metadata.gz: e4c32b52a277f4cee2d0cc592ef87f6149a251629187be5a0221fa2f31d71b5d2a227019969d4ebcd70385dbb55ed03d48db2f2ea9970f2bdd78d2dbb346bfab
7
- data.tar.gz: 8479c7f4283da493f3b703aa37278d2adad83d696cf7fcc07dff493ce56a6fafc892cb427cbe8f5263952ea1d503874cee6b528774e508d154ce584ffaa332bc
6
+ metadata.gz: 151823bcc3863a93813f36c91fce73309435541117585f0cffb4ce31ac8b523e95b50669446f096d41bca64b8c4a9c6c6c37a1a3e71cc532d379c9e8a117a886
7
+ data.tar.gz: 8e03ed19e103f183a82df3c55692a523187fab9630db6692d2904dbd73da647589e6c522b493ecc52ebae9d93fd122b002225ef79f7932664caedbdcbbd1afb1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.12] - 2024-10-30
2
+
3
+ - Support delayed command connection
4
+
1
5
  ## [0.0.11] - 2024-10-27
2
6
 
3
7
  - Release under the MPL-2.0 license
@@ -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.11
4
+ version: 0.0.12
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-10-27 00:00:00.000000000 Z
11
+ date: 2024-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foobara-util