nexus_cqrs 0.0.7 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +77 -1
- data/README.md +8 -0
- data/lib/generators/nexus_cqrs/command_generator.rb +8 -7
- data/lib/generators/nexus_cqrs/query_generator.rb +20 -2
- data/lib/nexus_cqrs/base_query_handler.rb +2 -0
- data/lib/nexus_cqrs/command_bus.rb +1 -1
- data/lib/nexus_cqrs/command_executor.rb +1 -1
- data/lib/nexus_cqrs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 194d9582819dfbce269179cd41d5c442a3a66a3797b0d77d09ef80e7343f6b25
|
4
|
+
data.tar.gz: ff860d659e433356d3ce6880aa445257fb6eab5ee1f9e53ea6e7ef2161e7be2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4d420c2e28c58bfa155ac015f95a3edf51a201bf3e6ab478529b41be162b5cd375c01a0de66ee8559ea07de663bc703f8ae14d19086ea80d879d00158a49c21
|
7
|
+
data.tar.gz: 134ab0e8e19e9d1e3378f4fe2d8efabb8f469b7924e30bc9685f82e5e4cc7fc0761191e988e80c9c46b3b36d8b9eb7a9232ef65253ce05ac6f6150ff5384cc7a
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
1
|
source 'https://rubygems.org'
|
3
2
|
|
4
3
|
# Specify your gem's dependencies in cqrs-core.gemspec
|
@@ -8,4 +7,5 @@ gem 'rubocop'
|
|
8
7
|
gem 'rubocop-shopify', "~> 1.0.4", require: false
|
9
8
|
|
10
9
|
gem 'rspec'
|
10
|
+
gem "generator_spec"
|
11
11
|
gem 'thread_safe'
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,73 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nexus_cqrs (0.0.
|
4
|
+
nexus_cqrs (0.0.8)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
actionpack (6.0.3.2)
|
10
|
+
actionview (= 6.0.3.2)
|
11
|
+
activesupport (= 6.0.3.2)
|
12
|
+
rack (~> 2.0, >= 2.0.8)
|
13
|
+
rack-test (>= 0.6.3)
|
14
|
+
rails-dom-testing (~> 2.0)
|
15
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
16
|
+
actionview (6.0.3.2)
|
17
|
+
activesupport (= 6.0.3.2)
|
18
|
+
builder (~> 3.1)
|
19
|
+
erubi (~> 1.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
22
|
+
activesupport (6.0.3.2)
|
23
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
|
+
i18n (>= 0.7, < 2)
|
25
|
+
minitest (~> 5.1)
|
26
|
+
tzinfo (~> 1.1)
|
27
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
9
28
|
ast (2.4.1)
|
29
|
+
builder (3.2.4)
|
30
|
+
concurrent-ruby (1.1.7)
|
31
|
+
crass (1.0.6)
|
10
32
|
diff-lcs (1.4.4)
|
33
|
+
erubi (1.9.0)
|
34
|
+
generator_spec (0.9.4)
|
35
|
+
activesupport (>= 3.0.0)
|
36
|
+
railties (>= 3.0.0)
|
37
|
+
i18n (1.8.5)
|
38
|
+
concurrent-ruby (~> 1.0)
|
39
|
+
loofah (2.6.0)
|
40
|
+
crass (~> 1.0.2)
|
41
|
+
nokogiri (>= 1.5.9)
|
42
|
+
method_source (1.0.0)
|
43
|
+
mini_portile2 (2.4.0)
|
44
|
+
minitest (5.14.1)
|
45
|
+
multi_json (1.15.0)
|
46
|
+
net-scp (3.0.0)
|
47
|
+
net-ssh (>= 2.6.5, < 7.0.0)
|
48
|
+
net-ssh (6.1.0)
|
49
|
+
net-telnet (0.1.1)
|
50
|
+
nokogiri (1.10.10)
|
51
|
+
mini_portile2 (~> 2.4.0)
|
11
52
|
parallel (1.19.2)
|
12
53
|
parser (2.7.1.4)
|
13
54
|
ast (~> 2.4.1)
|
55
|
+
rack (2.2.3)
|
56
|
+
rack-test (1.1.0)
|
57
|
+
rack (>= 1.0, < 3)
|
58
|
+
rails-dom-testing (2.0.3)
|
59
|
+
activesupport (>= 4.2.0)
|
60
|
+
nokogiri (>= 1.6)
|
61
|
+
rails-html-sanitizer (1.3.0)
|
62
|
+
loofah (~> 2.3)
|
63
|
+
railties (6.0.3.2)
|
64
|
+
actionpack (= 6.0.3.2)
|
65
|
+
activesupport (= 6.0.3.2)
|
66
|
+
method_source
|
67
|
+
rake (>= 0.8.7)
|
68
|
+
thor (>= 0.20.3, < 2.0)
|
14
69
|
rainbow (3.0.0)
|
70
|
+
rake (13.0.1)
|
15
71
|
regexp_parser (1.7.1)
|
16
72
|
rexml (3.2.4)
|
17
73
|
rspec (3.9.0)
|
@@ -23,6 +79,9 @@ GEM
|
|
23
79
|
rspec-expectations (3.9.2)
|
24
80
|
diff-lcs (>= 1.2.0, < 2.0)
|
25
81
|
rspec-support (~> 3.9.0)
|
82
|
+
rspec-its (1.3.0)
|
83
|
+
rspec-core (>= 3.0.0)
|
84
|
+
rspec-expectations (>= 3.0.0)
|
26
85
|
rspec-mocks (3.9.1)
|
27
86
|
diff-lcs (>= 1.2.0, < 2.0)
|
28
87
|
rspec-support (~> 3.9.0)
|
@@ -41,17 +100,34 @@ GEM
|
|
41
100
|
rubocop-shopify (1.0.4)
|
42
101
|
rubocop (>= 0.85, < 0.87)
|
43
102
|
ruby-progressbar (1.10.1)
|
103
|
+
serverspec (2.41.5)
|
104
|
+
multi_json
|
105
|
+
rspec (~> 3.0)
|
106
|
+
rspec-its
|
107
|
+
specinfra (~> 2.72)
|
108
|
+
sfl (2.3)
|
109
|
+
specinfra (2.82.19)
|
110
|
+
net-scp
|
111
|
+
net-ssh (>= 2.7)
|
112
|
+
net-telnet (= 0.1.1)
|
113
|
+
sfl
|
114
|
+
thor (1.0.1)
|
44
115
|
thread_safe (0.3.6)
|
116
|
+
tzinfo (1.2.7)
|
117
|
+
thread_safe (~> 0.1)
|
45
118
|
unicode-display_width (1.7.0)
|
119
|
+
zeitwerk (2.4.0)
|
46
120
|
|
47
121
|
PLATFORMS
|
48
122
|
ruby
|
49
123
|
|
50
124
|
DEPENDENCIES
|
125
|
+
generator_spec
|
51
126
|
nexus_cqrs!
|
52
127
|
rspec
|
53
128
|
rubocop
|
54
129
|
rubocop-shopify (~> 1.0.4)
|
130
|
+
serverspec
|
55
131
|
thread_safe
|
56
132
|
|
57
133
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -29,3 +29,11 @@ Generators can be used to aide in the creation of Commands and Queries:
|
|
29
29
|
|
30
30
|
Once installed, a CommandBus is required to control the flow of Commands and/or Queries:
|
31
31
|
|
32
|
+
## Development
|
33
|
+
|
34
|
+
To contribute to this gem, simple pull the repository, run `bundle install` and run tests:
|
35
|
+
|
36
|
+
```shell script
|
37
|
+
bundle exec rspec
|
38
|
+
bundle exec rubocop
|
39
|
+
```
|
@@ -5,15 +5,16 @@ module NexusCqrs
|
|
5
5
|
source_root File.expand_path('templates', __dir__)
|
6
6
|
|
7
7
|
def copy_command_file
|
8
|
-
|
9
|
-
full_name = file_name
|
8
|
+
file_path = class_name.underscore
|
10
9
|
|
11
|
-
template('command.rb', "app/domain/commands/#{
|
12
|
-
template('command_handler.rb', "app/domain/commands/#{
|
10
|
+
template('command.rb', "app/domain/commands/#{file_path}.rb")
|
11
|
+
template('command_handler.rb', "app/domain/commands/#{file_path}_handler.rb")
|
13
12
|
|
14
|
-
register_command(
|
13
|
+
register_command(class_name)
|
15
14
|
end
|
16
15
|
|
16
|
+
private
|
17
|
+
|
17
18
|
def register_command(full_name)
|
18
19
|
handler_config = 'config/initializers/register_cqrs_handlers.rb'
|
19
20
|
|
@@ -21,9 +22,9 @@ module NexusCqrs
|
|
21
22
|
template('register_cqrs_handlers.rb', handler_config)
|
22
23
|
end
|
23
24
|
|
24
|
-
code_to_inject = "$
|
25
|
+
code_to_inject = "$COMMAND_EXECUTOR.register_command(#{full_name}, #{full_name}Handler.new)\n"
|
25
26
|
|
26
|
-
inject_into_file(handler_config, code_to_inject, after:
|
27
|
+
inject_into_file(handler_config, code_to_inject, after: "# Register Commands\n")
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
@@ -5,8 +5,26 @@ module NexusCqrs
|
|
5
5
|
source_root File.expand_path('templates', __dir__)
|
6
6
|
|
7
7
|
def copy_query_file
|
8
|
-
|
9
|
-
|
8
|
+
file_path = class_name.underscore
|
9
|
+
|
10
|
+
template('query.rb', "app/domain/queries/#{file_path}.rb")
|
11
|
+
template('query_handler.rb', "app/domain/queries/#{file_path}_handler.rb")
|
12
|
+
|
13
|
+
register_query(class_name)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def register_query(full_name)
|
19
|
+
handler_config = 'config/initializers/register_cqrs_handlers.rb'
|
20
|
+
|
21
|
+
unless File.exist?('config/initializers/register_cqrs_handlers.rb')
|
22
|
+
template('register_cqrs_handlers.rb', handler_config)
|
23
|
+
end
|
24
|
+
|
25
|
+
code_to_inject = "$QUERY_EXECUTOR.register_command(#{full_name}, #{full_name}Handler.new)\n"
|
26
|
+
|
27
|
+
inject_into_file(handler_config, code_to_inject, after: "# Register Queries\n")
|
10
28
|
end
|
11
29
|
end
|
12
30
|
end
|
@@ -20,7 +20,7 @@ module NexusCqrs
|
|
20
20
|
unregistered_handler = proc { raise UnregisteredHandler, "Missing handler for #{command.class}" }
|
21
21
|
|
22
22
|
handlers
|
23
|
-
.fetch(command.class, &unregistered_handler)
|
23
|
+
.fetch(command.class.name, &unregistered_handler)
|
24
24
|
.call(command)
|
25
25
|
end
|
26
26
|
|
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.12
|
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-
|
11
|
+
date: 2020-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|