eztek-mediat_r 1.0.1 → 1.0.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/lib/ez/mediat_r/version.rb +7 -7
- data/lib/generators/commands/USAGE +10 -0
- data/lib/generators/commands/commands_generator.rb +8 -10
- data/lib/generators/commands/templates/command_template.template +1 -1
- data/lib/generators/queries/USAGE +10 -0
- data/lib/generators/queries/queries_generator.rb +8 -11
- data/lib/generators/queries/templates/queries_template.template +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a48e55844b50d4c411b90b137fe6d01e8ccfdf2ea6ed6c6cf6a4e6c1fa61858d
|
4
|
+
data.tar.gz: f4c2ff39479cd2c39c76948ca82f0adbd7cf033e3cbc80aebb3829870782661e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efa2e26984fa7e44fa0460af1eb8e7a61f310090b4f433a117debf927cac25422a7e6a289ddf19f02acfe2efb34fa947b9f6521441ca7ae6f8535bf788e47c15
|
7
|
+
data.tar.gz: 611679a3f465a77f9bc5c2c464df2b3b691cd0b417fa97c0b61d80e401ddea683ad57d093d5a15c9baf40f998134b9dad4d001891b9fb2beac53f0b8ee820948
|
data/lib/ez/mediat_r/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module EZ
|
4
|
-
module MediatR
|
5
|
-
VERSION = "1.0.
|
6
|
-
end
|
7
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EZ
|
4
|
+
module MediatR
|
5
|
+
VERSION = "1.0.2"
|
6
|
+
end
|
7
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Description:
|
2
|
+
Creates the command model structure for you.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails generate commands user create_user
|
6
|
+
|
7
|
+
This will create:
|
8
|
+
app/cqrs/user/commands/create_user_command.rb
|
9
|
+
app/cqrs/user/commands/validators/create_user_command_validator.rb
|
10
|
+
app/cqrs/user/commands/handlers/create_user_command_handler.rb
|
@@ -2,32 +2,30 @@ class CommandsGenerator < Rails::Generators::Base
|
|
2
2
|
source_root File.expand_path('../templates', __FILE__)
|
3
3
|
argument :model, type: :string
|
4
4
|
argument :name, type: :string
|
5
|
-
class_option :validator, type: :boolean, default:
|
5
|
+
class_option :validator, type: :boolean, default: true, desc: "Generate validator."
|
6
6
|
class_option :doc, type: :boolean, default: true, desc: "Include documentation."
|
7
7
|
|
8
8
|
def generate_init
|
9
9
|
generate_command
|
10
|
+
generate_command_handler
|
10
11
|
end
|
11
12
|
|
12
13
|
def generate_validator
|
13
|
-
|
14
|
+
generate_command_validator if options.validator?
|
14
15
|
end
|
15
16
|
|
16
|
-
def generate_handler
|
17
|
-
generate_handler unless model == 'init'
|
18
|
-
end
|
19
17
|
|
20
18
|
private
|
21
19
|
|
22
20
|
def generate_command
|
23
|
-
template 'commands_template.template', "app/cqrs/#{model.underscore}/commands/#{
|
21
|
+
template 'commands_template.template', "app/cqrs/#{model.underscore}/commands/#{name.underscore}_command.rb"
|
24
22
|
end
|
25
23
|
|
26
|
-
def
|
27
|
-
template 'commands_validator_template.template', "app/cqrs/#{model.underscore}/commands/validators/#{
|
24
|
+
def generate_command_validator
|
25
|
+
template 'commands_validator_template.template', "app/cqrs/#{model.underscore}/commands/validators/#{name.underscore}_command_validator.rb"
|
28
26
|
end
|
29
27
|
|
30
|
-
def
|
31
|
-
template 'commands_handler_template.template', "app/cqrs/#{model.underscore}/commands/handlers/#{
|
28
|
+
def generate_command_handler
|
29
|
+
template 'commands_handler_template.template', "app/cqrs/#{model.underscore}/commands/handlers/#{name.underscore}_command_handler.rb"
|
32
30
|
end
|
33
31
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Description:
|
2
|
+
Creates the query model structure for you.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails generate queries user get_all_user
|
6
|
+
|
7
|
+
This will create:
|
8
|
+
app/cqrs/user/queries/get_all_user_query.rb
|
9
|
+
app/cqrs/user/queries/validators/get_all_user_query_validator.rb
|
10
|
+
app/cqrs/user/queries/handlers/get_all_user_query_handler.rb
|
@@ -2,32 +2,29 @@ class QueriesGenerator < Rails::Generators::Base
|
|
2
2
|
source_root File.expand_path('../templates', __FILE__)
|
3
3
|
argument :model, type: :string
|
4
4
|
argument :name, type: :string
|
5
|
-
class_option :validator, type: :boolean, default:
|
5
|
+
class_option :validator, type: :boolean, default: true, desc: "Generate validator."
|
6
6
|
class_option :doc, type: :boolean, default: true, desc: "Include documentation."
|
7
7
|
|
8
8
|
def generate_init
|
9
9
|
generate_query
|
10
|
+
generate_query_handler
|
10
11
|
end
|
11
12
|
|
12
13
|
def generate_validator
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
def generate_handler
|
17
|
-
generate_handler unless model == 'init'
|
14
|
+
generate_query_validator if options.validator?
|
18
15
|
end
|
19
16
|
|
20
17
|
private
|
21
18
|
|
22
19
|
def generate_query
|
23
|
-
template 'queries_template.template', "app/cqrs/#{model.underscore}/queries/#{
|
20
|
+
template 'queries_template.template', "app/cqrs/#{model.underscore}/queries/#{name.underscore}_query.rb"
|
24
21
|
end
|
25
22
|
|
26
|
-
def
|
27
|
-
template 'queries_validator_template.template', "app/cqrs/#{model.underscore}/queries/validators/#{
|
23
|
+
def generate_query_validator
|
24
|
+
template 'queries_validator_template.template', "app/cqrs/#{model.underscore}/queries/validators/#{name.underscore}_query_validator.rb"
|
28
25
|
end
|
29
26
|
|
30
|
-
def
|
31
|
-
template 'queries_handler_template.template', "app/cqrs/#{model.underscore}/queries/handlers/#{
|
27
|
+
def generate_query_handler
|
28
|
+
template 'queries_handler_template.template', "app/cqrs/#{model.underscore}/queries/handlers/#{name.underscore}_query_handler.rb"
|
32
29
|
end
|
33
30
|
end
|