nexus_cqrs 0.0.3 → 0.0.4
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/README.md +4 -13
- data/lib/generators/nexus_cqrs/command_generator.rb +10 -0
- data/lib/generators/nexus_cqrs/templates/command.rb +1 -1
- data/lib/generators/nexus_cqrs/templates/command_handler.rb +1 -1
- data/lib/generators/nexus_cqrs/templates/query.rb +1 -1
- data/lib/generators/nexus_cqrs/templates/query_handler.rb +1 -1
- data/lib/generators/nexus_cqrs/templates/register_cqrs_handlers.rb +4 -0
- data/lib/nexus_cqrs/command_executor.rb +6 -2
- data/lib/nexus_cqrs/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0ab24d08b1c4793fef6e3834988672a80f16ebb82d6dbda3d5541c924b8c831
|
4
|
+
data.tar.gz: ba846c3ce5ca8ca11254ad1521fe89498bed086f3fe1728bc8712343e7352962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94e1db49bdbe1d8a03e4341d95d88c4abd42c9c38be178ad85f813095dded808fa9a76b51b32a95d40886666d9208d2f3f74ce21936e8dda8b48b7fe34a87dee
|
7
|
+
data.tar.gz: f560cb815379e847dd6cb347346d0eefdefda8234b8aa0ae146114b85be4109af81f6436e65e699a2a51da8219e7baa0dcebd5758ced123a54e47a44c7006a46
|
data/README.md
CHANGED
@@ -22,19 +22,10 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
Generators can be used to aide in the creation of Commands and Queries:
|
26
26
|
|
27
|
-
|
27
|
+
rails g nexus_cqrs:command CommandName
|
28
|
+
rails g nexus_cqrs:query QueryName
|
28
29
|
|
29
|
-
|
30
|
+
Once installed, a CommandBus is required to control the flow of Commands and/or Queries:
|
30
31
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cqrs-core. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/cqrs-core/blob/master/CODE_OF_CONDUCT.md).
|
36
|
-
|
37
|
-
|
38
|
-
## Code of Conduct
|
39
|
-
|
40
|
-
Everyone interacting in the Cqrs::Core project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/cqrs-core/blob/master/CODE_OF_CONDUCT.md).
|
@@ -8,5 +8,15 @@ module NexusCqrs
|
|
8
8
|
template "command.rb", "app/domain/commands/#{file_name}.rb"
|
9
9
|
template "command_handler.rb", "app/domain/commands/#{file_name}_handler.rb"
|
10
10
|
end
|
11
|
+
|
12
|
+
def register_command
|
13
|
+
handler_config = "config/initializers/register_cqrs_handlers.rb"
|
14
|
+
|
15
|
+
unless File.exist?('config/initializers/register_cqrs_handlers.rb')
|
16
|
+
template "register_cqrs_handlers.rb", handler_config
|
17
|
+
end
|
18
|
+
|
19
|
+
inject_into_file handler_config, " do_stuff(foo)\n"
|
20
|
+
end
|
11
21
|
end
|
12
22
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module NexusCqrs
|
2
2
|
class CommandExecutor
|
3
|
-
def initialize
|
4
|
-
@bus =
|
3
|
+
def initialize(command_bus)
|
4
|
+
@bus = command_bus
|
5
5
|
|
6
6
|
register_commands
|
7
7
|
end
|
@@ -10,6 +10,10 @@ module NexusCqrs
|
|
10
10
|
@bus.(command)
|
11
11
|
end
|
12
12
|
|
13
|
+
def register_command klass, handler
|
14
|
+
@bus.register(klass, handler)
|
15
|
+
end
|
16
|
+
|
13
17
|
private
|
14
18
|
def register_commands
|
15
19
|
# TODO, Register Commands/Queries
|
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.0.
|
4
|
+
version: 0.0.4
|
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-08-
|
11
|
+
date: 2020-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/generators/nexus_cqrs/templates/command_handler.rb
|
60
60
|
- lib/generators/nexus_cqrs/templates/query.rb
|
61
61
|
- lib/generators/nexus_cqrs/templates/query_handler.rb
|
62
|
+
- lib/generators/nexus_cqrs/templates/register_cqrs_handlers.rb
|
62
63
|
- lib/nexus_cqrs.rb
|
63
64
|
- lib/nexus_cqrs/base_command.rb
|
64
65
|
- lib/nexus_cqrs/base_command_handler.rb
|