nexus_cqrs 0.1.1 → 0.2.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/.gitlab-ci.yml +1 -1
- data/lib/nexus_cqrs/command_bus.rb +5 -2
- data/lib/nexus_cqrs/command_executor.rb +12 -6
- data/lib/nexus_cqrs/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 24bafc3e27cbf1ef65d1e507bdb2798b67283c92c64b274bbf8818cfffa9618a
|
|
4
|
+
data.tar.gz: e653d3e7b76bc2173a780cf6128974afaecaba8278c0f39e56527ae442395cff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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
|
-
|
|
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
|
|
21
|
-
|
|
25
|
+
def configure_handlers(&block)
|
|
26
|
+
@register_handlers = block
|
|
27
|
+
@register_handlers.call(self)
|
|
22
28
|
end
|
|
23
29
|
end
|
|
24
30
|
end
|
data/lib/nexus_cqrs/version.rb
CHANGED
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.
|
|
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:
|
|
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.
|
|
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
|