nexus_cqrs 0.1.1 → 0.2.2

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: 52292e7da4d25c422ec78ea425803320ce2d482748a07e64cf46935a9b529fba
4
- data.tar.gz: f6f6ea685f1c98e1d9396735c3bd605823d3fe20807b0d9041c2924501a93346
3
+ metadata.gz: 24bafc3e27cbf1ef65d1e507bdb2798b67283c92c64b274bbf8818cfffa9618a
4
+ data.tar.gz: e653d3e7b76bc2173a780cf6128974afaecaba8278c0f39e56527ae442395cff
5
5
  SHA512:
6
- metadata.gz: 86c7633be2217afc934de294f1a01930c417f19d7cc47daa3354a14baae9f0700ab3dbd4864c7059dfe5a9569225c9c1ad2e36b9a3fe93113b10ad6cd8bb4da1
7
- data.tar.gz: a45c022c39ad8dabbc1fb86910e3effd7c58bfa1e049dab0b950650b88fc9b31e357fcea0d272454df7efc9ee5203af5d927ffde6b4454ee091b97d5f9291d7b
6
+ metadata.gz: 38a848d5da2a2a61116f1bb2f04df2fae1c0cb368e6482854e0f7896a9bfcd0b2baab39e58c223c2b1f5a1a0c62bc028c0dddf1d2daccebc7268010e9506559c
7
+ data.tar.gz: 6f7b0c32343f39b5b3eb61b9c4afb5cc338bbce81eeb5d998b0d0e1293fe1fa35984264f86ed8fbc8d1a0a29106602566a0ee00096951b4d54fc63ddb3d9f3d7
data/.gitlab-ci.yml CHANGED
@@ -25,7 +25,7 @@ release:
25
25
  - if: '$CI_COMMIT_TAG'
26
26
  script:
27
27
  - mkdir -p ~/.gem
28
- - cp /builds/pub/nexus_cqrs.tmp/RUBYGEMS_CREDENTIALS ~/.gem/credentials
28
+ - cp $RUBYGEMS_CREDENTIALS ~/.gem/credentials
29
29
  - chmod 0600 ~/.gem/credentials
30
30
  - gem update --system
31
31
  - ruby --version
@@ -7,8 +7,7 @@ module NexusCqrs
7
7
  MultipleHandlers = Class.new(StandardError)
8
8
 
9
9
  def initialize(middleware: nil)
10
- @handlers =
11
- ThreadSafe::Cache.new
10
+ @handlers = ThreadSafe::Cache.new
12
11
  @middleware = middleware || Middleware::Builder.new
13
12
  end
14
13
 
@@ -29,6 +28,10 @@ module NexusCqrs
29
28
  handlers
30
29
  end
31
30
 
31
+ def clear_handlers
32
+ @handlers = ThreadSafe::Cache.new
33
+ end
34
+
32
35
  attr_reader :handlers
33
36
 
34
37
  private
@@ -1,24 +1,30 @@
1
1
  module NexusCqrs
2
2
  class CommandExecutor
3
+ # @param [NexusCqrs::CommandBus] command_bus
3
4
  def initialize(command_bus)
4
5
  @bus = command_bus
5
-
6
- register_commands
7
6
  end
8
7
 
8
+ # @param [NexusCqrs::BaseCommand] command
9
9
  def execute(command)
10
10
  @bus.call(command)
11
11
  end
12
12
 
13
+ # @param [NexusCqrs::BaseCommandHandler] handler
13
14
  def register_command(klass, handler)
14
- Rails.logger.debug("Registered #{klass} to #{handler}")
15
15
  @bus.register(klass, handler)
16
16
  end
17
17
 
18
- private
18
+ def reregister_handlers
19
+ return if @register_handlers.nil?
20
+
21
+ @bus.clear_handlers
22
+ @register_handlers.call(self)
23
+ end
19
24
 
20
- def register_commands
21
- # TODO, Register Commands/Queries
25
+ def configure_handlers(&block)
26
+ @register_handlers = block
27
+ @register_handlers.call(self)
22
28
  end
23
29
  end
24
30
  end
@@ -1,3 +1,3 @@
1
1
  module NexusCqrs
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexus_cqrs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Lovett
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-30 00:00:00.000000000 Z
11
+ date: 2021-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: generator_spec
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.1.4
111
+ rubygems_version: 3.2.26
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Core package for the nexus cqrs gem