eztek-mediat_r 1.0.0 → 1.0.3
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/command/USAGE +10 -0
- data/lib/generators/command/command_generator.rb +30 -0
- data/lib/generators/command/templates/command_handler_template.template +7 -0
- data/lib/generators/command/templates/command_template.template +11 -0
- data/lib/generators/command/templates/command_validator_template.template +6 -0
- data/lib/generators/query/USAGE +10 -0
- data/lib/generators/query/query_generator.rb +30 -0
- data/lib/generators/query/templates/query_handler_template.template +7 -0
- data/lib/generators/query/templates/query_template.template +11 -0
- data/lib/generators/query/templates/query_validator_template.template +6 -0
- metadata +11 -2
- data/eztek-mediat_r.gemspec +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70e8616aa317335bb98b389dfb36643cf91709a1f2c1b34bf339b3eff13d85e1
|
4
|
+
data.tar.gz: d8e6d3c5f1aa4b8f9f03491ab7e944ef1adf8f801f4ebc714fa271c17176ea21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43150555a3c18fa15a3b15d77f3fbee7493c17a2a3353e2e6ab3c2e0fcd7a862c321b53a9413bc9a4f369a74f52bd23d96ec68637c346407cba20bb46f73ac1d
|
7
|
+
data.tar.gz: b28f43ec9bba0f46f3345d2acb07dd1665cafbf2b844cd6abcffb32f6d27ccd1d7356cd8bedd7a246802032e2b6727bf2acf8eb0916d9e18445c50b39bbbfd85
|
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.3"
|
6
|
+
end
|
7
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Description:
|
2
|
+
Creates the command model structure for you.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails generate command 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
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class CommandGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
argument :model, type: :string
|
4
|
+
argument :name, type: :string
|
5
|
+
class_option :validator, type: :boolean, default: true, desc: "Generate validator."
|
6
|
+
class_option :doc, type: :boolean, default: true, desc: "Include documentation."
|
7
|
+
|
8
|
+
def generate_init
|
9
|
+
generate_command
|
10
|
+
generate_command_handler
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate_validator
|
14
|
+
generate_command_validator if options.validator?
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def generate_command
|
20
|
+
template 'command_template.template', "app/cqrs/#{model.underscore}/commands/#{name.underscore}_command.rb"
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_command_validator
|
24
|
+
template 'command_validator_template.template', "app/cqrs/#{model.underscore}/commands/validators/#{name.underscore}_command_validator.rb"
|
25
|
+
end
|
26
|
+
|
27
|
+
def generate_command_handler
|
28
|
+
template 'command_handler_template.template', "app/cqrs/#{model.underscore}/commands/handlers/#{name.underscore}_command_handler.rb"
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module <%= model.camelcase %>::Commands
|
2
|
+
class <%= name.camelcase %>Command
|
3
|
+
include ActiveModel::Validations
|
4
|
+
<%- if options.validator? -%>
|
5
|
+
validates_with Validators::<%= name.camelcase %>CommandValidator
|
6
|
+
<%- end -%>
|
7
|
+
|
8
|
+
def initialize()
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Description:
|
2
|
+
Creates the query model structure for you.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails generate query 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
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class QueryGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
argument :model, type: :string
|
4
|
+
argument :name, type: :string
|
5
|
+
class_option :validator, type: :boolean, default: true, desc: "Generate validator."
|
6
|
+
class_option :doc, type: :boolean, default: true, desc: "Include documentation."
|
7
|
+
|
8
|
+
def generate_init
|
9
|
+
generate_query
|
10
|
+
generate_query_handler
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate_validator
|
14
|
+
generate_query_validator if options.validator?
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def generate_query
|
20
|
+
template 'query_template.template', "app/cqrs/#{model.underscore}/queries/#{name.underscore}_query.rb"
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_query_validator
|
24
|
+
template 'query_validator_template.template', "app/cqrs/#{model.underscore}/queries/validators/#{name.underscore}_query_validator.rb"
|
25
|
+
end
|
26
|
+
|
27
|
+
def generate_query_handler
|
28
|
+
template 'query_handler_template.template', "app/cqrs/#{model.underscore}/queries/handlers/#{name.underscore}_query_handler.rb"
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module <%= model.camelcase %>::Queries
|
2
|
+
class <%= name.camelcase %>Query
|
3
|
+
include ActiveModel::Validations
|
4
|
+
<%- if options.validator? -%>
|
5
|
+
validates_with Validators::<%= name.camelcase %>QueryValidator
|
6
|
+
<%- end -%>
|
7
|
+
|
8
|
+
def initialize()
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eztek-mediat_r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yeucon02vn
|
@@ -76,10 +76,19 @@ files:
|
|
76
76
|
- Gemfile
|
77
77
|
- README.md
|
78
78
|
- Rakefile
|
79
|
-
- eztek-mediat_r.gemspec
|
80
79
|
- lib/ez/mediat_r.rb
|
81
80
|
- lib/ez/mediat_r/alias.rb
|
82
81
|
- lib/ez/mediat_r/version.rb
|
82
|
+
- lib/generators/command/USAGE
|
83
|
+
- lib/generators/command/command_generator.rb
|
84
|
+
- lib/generators/command/templates/command_handler_template.template
|
85
|
+
- lib/generators/command/templates/command_template.template
|
86
|
+
- lib/generators/command/templates/command_validator_template.template
|
87
|
+
- lib/generators/query/USAGE
|
88
|
+
- lib/generators/query/query_generator.rb
|
89
|
+
- lib/generators/query/templates/query_handler_template.template
|
90
|
+
- lib/generators/query/templates/query_template.template
|
91
|
+
- lib/generators/query/templates/query_validator_template.template
|
83
92
|
- sig/ez/mediat_r.rbs
|
84
93
|
homepage: https://github.com/yeucon02vn/eztek-mediat_r
|
85
94
|
licenses:
|
data/eztek-mediat_r.gemspec
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require_relative "lib/ez/mediat_r/version"
|
2
|
-
|
3
|
-
lib = File.expand_path('../lib', __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "eztek-mediat_r"
|
8
|
-
spec.version = EZ::MediatR::VERSION
|
9
|
-
spec.authors = ["yeucon02vn"]
|
10
|
-
spec.email = ["phiphuqn1@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = "This is an async implementation of Mediator pattern with pipline behaviors.
|
13
|
-
It is a port of Mediatr from .Net C#"
|
14
|
-
spec.homepage = "https://github.com/yeucon02vn/eztek-mediat_r"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
19
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
20
|
-
end
|
21
|
-
end
|
22
|
-
spec.bindir = "exe"
|
23
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
24
|
-
spec.require_paths = ["lib"]
|
25
|
-
|
26
|
-
spec.add_dependency "concurrent-ruby"
|
27
|
-
|
28
|
-
spec.add_development_dependency "bundler"
|
29
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
-
spec.add_development_dependency "rspec", "~> 3.4.0"
|
31
|
-
end
|