convenient_service 0.5.0 → 0.7.0
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/CHANGELOG.md +49 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/ROADMAP.md +26 -4
- data/Taskfile.yml +30 -0
- data/convenient_service.gemspec +5 -2
- data/lib/convenient_service/aliases.rb +2 -0
- data/lib/convenient_service/common/plugins/assigns_attributes_in_constructor/using_active_model_attribute_assignment/concern.rb +0 -2
- data/lib/convenient_service/common/plugins/assigns_attributes_in_constructor/using_dry_initializer/concern.rb +0 -2
- data/lib/convenient_service/common/plugins/has_around_callbacks/middleware.rb +24 -4
- data/lib/convenient_service/common/plugins/has_callbacks/container.rb +17 -0
- data/lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb +98 -5
- data/lib/convenient_service/common/plugins/has_callbacks/middleware.rb +25 -4
- data/lib/convenient_service/common/plugins/has_callbacks.rb +1 -0
- data/lib/convenient_service/common/plugins.rb +1 -1
- data/lib/convenient_service/configs/standard.rb +25 -12
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/container/commands/resolve_methods_middlewares_callers.rb +1 -24
- data/lib/convenient_service/dependencies.rb +19 -0
- data/lib/convenient_service/examples/dry/gemfile/dry_service/config.rb +4 -2
- data/lib/convenient_service/examples/rails/gemfile/rails_service/config.rb +4 -2
- data/lib/convenient_service/examples/rails/gemfile/services/format.rb +35 -6
- data/lib/convenient_service/examples/rails/gemfile/services/format_header.rb +1 -2
- data/lib/convenient_service/examples/rails/gemfile/services/merge_sections.rb +25 -0
- data/lib/convenient_service/examples/rails/gemfile/services/replace_file_content.rb +37 -0
- data/lib/convenient_service/examples/rails/gemfile/services.rb +8 -4
- data/lib/convenient_service/examples/standard/gemfile/services/format.rb +45 -6
- data/lib/convenient_service/examples/standard/gemfile/services/merge_sections.rb +52 -0
- data/lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb +48 -0
- data/lib/convenient_service/examples/standard/gemfile/services.rb +8 -4
- data/lib/convenient_service/examples/standard/request_params/constants.rb +15 -0
- data/lib/convenient_service/examples/standard/request_params/entities/description.rb +40 -0
- data/lib/convenient_service/examples/standard/request_params/entities/format.rb +40 -0
- data/lib/convenient_service/examples/standard/request_params/entities/id.rb +47 -0
- data/lib/convenient_service/examples/standard/request_params/entities/logger.rb +21 -0
- data/lib/convenient_service/examples/standard/request_params/entities/request.rb +23 -0
- data/lib/convenient_service/examples/standard/request_params/entities/source.rb +40 -0
- data/lib/convenient_service/examples/standard/request_params/entities/tag.rb +40 -0
- data/lib/convenient_service/examples/standard/request_params/entities/title.rb +40 -0
- data/lib/convenient_service/examples/standard/request_params/entities.rb +11 -0
- data/lib/convenient_service/examples/standard/request_params/services/apply_default_param_values.rb +26 -0
- data/lib/convenient_service/examples/standard/request_params/services/cast_params.rb +38 -0
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_body.rb +70 -0
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_path.rb +62 -0
- data/lib/convenient_service/examples/standard/request_params/services/filter_out_unpermitted_params.rb +26 -0
- data/lib/convenient_service/examples/standard/request_params/services/log_request_params.rb +54 -0
- data/lib/convenient_service/examples/standard/request_params/services/merge_params.rb +26 -0
- data/lib/convenient_service/examples/standard/request_params/services/prepare.rb +65 -0
- data/lib/convenient_service/examples/standard/request_params/services/validate_casted_params.rb +94 -0
- data/lib/convenient_service/examples/standard/request_params/services/validate_uncasted_params.rb +72 -0
- data/lib/convenient_service/examples/standard/request_params/services.rb +13 -0
- data/lib/convenient_service/examples/standard/request_params/utils/array/wrap.rb +46 -0
- data/lib/convenient_service/examples/standard/request_params/utils/array.rb +21 -0
- data/lib/convenient_service/examples/standard/request_params/utils/http/request/parse_body.rb +42 -0
- data/lib/convenient_service/examples/standard/request_params/utils/http/request/parse_path.rb +40 -0
- data/lib/convenient_service/examples/standard/request_params/utils/http/request.rb +28 -0
- data/lib/convenient_service/examples/standard/request_params/utils/http.rb +3 -0
- data/lib/convenient_service/examples/standard/request_params/utils/integer/safe_parse.rb +31 -0
- data/lib/convenient_service/examples/standard/request_params/utils/integer.rb +25 -0
- data/lib/convenient_service/examples/standard/request_params/utils/json/safe_parse.rb +40 -0
- data/lib/convenient_service/examples/standard/request_params/utils/json.rb +21 -0
- data/lib/convenient_service/examples/standard/request_params/utils/object/blank.rb +34 -0
- data/lib/convenient_service/examples/standard/request_params/utils/object/present.rb +31 -0
- data/lib/convenient_service/examples/standard/request_params/utils/object.rb +26 -0
- data/lib/convenient_service/examples/standard/request_params/utils.rb +7 -0
- data/lib/convenient_service/examples/standard/request_params.rb +48 -0
- data/lib/convenient_service/factories/arguments.rb +43 -0
- data/lib/convenient_service/factories/results.rb +214 -0
- data/lib/convenient_service/factories/services.rb +189 -0
- data/lib/convenient_service/factories/step/instance.rb +32 -0
- data/lib/convenient_service/factories/step.rb +3 -0
- data/lib/convenient_service/factories/steps.rb +126 -0
- data/lib/convenient_service/factories.rb +22 -0
- data/lib/convenient_service/factory.rb +21 -0
- data/lib/convenient_service/rspec/matchers/custom/be_descendant_of.rb +2 -2
- data/lib/convenient_service/rspec/matchers/custom/be_direct_descendant_of.rb +2 -2
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands/generate_printable_method.rb +50 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands.rb +3 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands/apply_stub_to_track_delegations.rb +78 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands/generate_printable_arguments.rb +100 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands.rb +4 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments.rb +95 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/base.rb +87 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/return_its_value.rb +129 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_any_arguments.rb +37 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_concrete_arguments.rb +37 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/without_arguments.rb +37 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/values/base.rb +41 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/values/with_calling_original.rb +30 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/values/without_calling_original.rb +30 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings.rb +12 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings_collection/errors.rb +57 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings_collection.rb +171 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/delegation.rb +79 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities.rb +5 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher.rb +276 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities.rb +3 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to.rb +66 -233
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_method_step.rb +74 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_result_method_step.rb +66 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_service_step.rb +48 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/generate_expected_step_part.rb +42 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/generate_got_step_part.rb +42 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/match_result_step.rb +89 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands.rb +10 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/errors.rb +35 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base.rb +73 -12
- data/lib/convenient_service/rspec/matchers/custom/singleton_prepend_module.rb +79 -0
- data/lib/convenient_service/rspec/matchers/custom.rb +1 -0
- data/lib/convenient_service/rspec/matchers/singleton_prepend_module.rb +13 -0
- data/lib/convenient_service/rspec/matchers.rb +2 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/concern.rb +85 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/initialize/middleware.rb +27 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/initialize.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/to_kwargs/middleware.rb +25 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/to_kwargs.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result.rb +5 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/concern/instance_methods.rb +7 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/data.rb +4 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/concern.rb +27 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/initialize/middleware.rb +27 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/initialize.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/to_kwargs/middleware.rb +25 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/to_kwargs.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step.rb +5 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins.rb +2 -0
- data/lib/convenient_service/service/plugins/has_result_method_steps.rb +0 -2
- data/lib/convenient_service/service/plugins/has_result_steps/concern.rb +40 -4
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method_caller.rb +8 -1
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method_direction.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method_key.rb +8 -1
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method_name.rb +9 -5
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/define_method_in_container.rb +2 -2
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/concern/instance_methods.rb +4 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/base.rb +4 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/reassignment/commands/define_method_in_container.rb +74 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/reassignment/commands.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/reassignment.rb +50 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers.rb +1 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/values/reassignment.rb +43 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/values.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities.rb +1 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/errors.rb +22 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/concern/instance_methods.rb +39 -3
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/plugins/can_have_parent_result/middleware.rb +23 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/plugins/can_have_parent_result.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/plugins.rb +1 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step_collection.rb +13 -0
- data/lib/convenient_service/service/plugins/has_result_steps/middleware.rb +18 -4
- data/lib/convenient_service/services/run_method_in_organizer.rb +28 -0
- data/lib/convenient_service/services/run_own_method_in_organizer.rb +64 -0
- data/lib/convenient_service/{service/plugins/has_result_method_steps/services.rb → services.rb} +0 -1
- data/lib/convenient_service/support/arguments/null_arguments.rb +28 -0
- data/lib/convenient_service/support/arguments.rb +87 -0
- data/lib/convenient_service/support/copyable.rb +6 -2
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_scope.rb +32 -0
- data/lib/convenient_service/support/dependency_container/commands/import_method.rb +13 -23
- data/lib/convenient_service/support/dependency_container/commands.rb +1 -0
- data/lib/convenient_service/support/dependency_container/constants.rb +4 -2
- data/lib/convenient_service/support/dependency_container/entities/method.rb +2 -9
- data/lib/convenient_service/support/dependency_container/entities/namespace_collection.rb +0 -9
- data/lib/convenient_service/support/dependency_container/errors.rb +26 -1
- data/lib/convenient_service/support/dependency_container/export.rb +8 -0
- data/lib/convenient_service/support/dependency_container/import.rb +3 -1
- data/lib/convenient_service/support/not_passed.rb +3 -1
- data/lib/convenient_service/support/version/null_version.rb +7 -0
- data/lib/convenient_service/support/version.rb +11 -1
- data/lib/convenient_service/support.rb +1 -0
- data/lib/convenient_service/utils/object/instance_variable_delete.rb +41 -0
- data/lib/convenient_service/utils/object/instance_variable_fetch.rb +4 -0
- data/lib/convenient_service/utils/object.rb +9 -0
- data/lib/convenient_service/utils/proc/display.rb +43 -0
- data/lib/convenient_service/utils/proc.rb +5 -0
- data/lib/convenient_service/version.rb +1 -1
- data/lib/convenient_service.rb +6 -0
- data/logo.png +0 -0
- metadata +154 -10
- data/lib/convenient_service/service/plugins/has_result_method_steps/errors.rb +0 -23
- data/lib/convenient_service/service/plugins/has_result_method_steps/services/method_step_config.rb +0 -55
- data/lib/convenient_service/service/plugins/has_result_method_steps/services/run_method_in_organizer.rb +0 -30
- data/lib/convenient_service/service/plugins/has_result_method_steps/services/run_own_method_in_organizer.rb +0 -52
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2d49bd8a8f45539edd750ba5388d4cd0dc7ab2e442380a24f38879f17c405944
|
|
4
|
+
data.tar.gz: 63adf6692c4989970e4fe1fa2b0c28bfa2c29020f33e9567d3fabbd9284f1944
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 199c1e80a8dfeedc2a8d1873f8f75008d510fb48374ab116f7c51f49ef44cf034454280279a5fda2bdc16ccd69e6010cb70291bdf0f10295d3eabddfcc391a6e
|
|
7
|
+
data.tar.gz: 2f03ad73249e0f61ee1d2f2b3fde41c82d9bd2089ebcd95f01390df206f6dded8ee5c4880d409065f6df01ba63eec1cbf26caabaf94c4e4a962752bb1f9d967f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.0](https://github.com/marian13/convenient_service/compare/v0.6.0...v0.7.0) (2023-02-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* **be_result:** introduce #of_step, #of_service, remove #of
|
|
9
|
+
* **has_result:** use callbacks before result
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **be_result:** introduce #of_step, #of_service, remove #of ([0d9ba16](https://github.com/marian13/convenient_service/commit/0d9ba16f035ef50268fdf484b0fd83c58dbb328a))
|
|
14
|
+
* **be_result:** of_step supports method steps ([9127301](https://github.com/marian13/convenient_service/commit/9127301f41549fbb8c48b718e410ebd7c100e2e9))
|
|
15
|
+
* **can_have_parent_Result:** introduce CanHaveParentResult plugin ([55f0b0f](https://github.com/marian13/convenient_service/commit/55f0b0f558e2edb8b0fdc56a2d8b52bc44995a2f))
|
|
16
|
+
* **command:** expose command ([6abcb1a](https://github.com/marian13/convenient_service/commit/6abcb1ad481cad66eba2d4d409e3ce16b0f6591d))
|
|
17
|
+
* **configs:** add around callbacks for steps ([cb9d342](https://github.com/marian13/convenient_service/commit/cb9d34204d63a96e89ebebe2991e8ab77b2624f0))
|
|
18
|
+
* **has_around_callbacks:** pass arguments to around callbacks ([f682f9a](https://github.com/marian13/convenient_service/commit/f682f9a6fb3ef6e8ab50ccf0f7f3ba375a63092e))
|
|
19
|
+
* **has_callbacks:** pass arguments to callbacks ([2d7f720](https://github.com/marian13/convenient_service/commit/2d7f720e37a15874ec89167e46fb67a0631ec923))
|
|
20
|
+
* **has_jsend_status_and_attributes:** introduce Data#to_s ([c1e20c0](https://github.com/marian13/convenient_service/commit/c1e20c093ec4575a939645a2d951fe4e035154b8))
|
|
21
|
+
* **has_result_steps:** add callback trigger for step ([475d46a](https://github.com/marian13/convenient_service/commit/475d46a5abaf6fa85260cef90d78db60146b86d9))
|
|
22
|
+
* **has_result_steps:** introduce Step#original_result ([8891247](https://github.com/marian13/convenient_service/commit/8891247e5f0339d9e96e733d05b29e45a2e87e71))
|
|
23
|
+
* **has_step:** introduce HasStep plugin ([e6eee96](https://github.com/marian13/convenient_service/commit/e6eee965c8707b7378173f228b9b212834be434b))
|
|
24
|
+
* **not_passed:** add better #inspect ([d7ce5d9](https://github.com/marian13/convenient_service/commit/d7ce5d93a3aa5f139f6b7ee578975c1da52488c0))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* **be_descendant_of:** fix typo ([58e0f73](https://github.com/marian13/convenient_service/commit/58e0f73f74685614d24e0ee3c8208a5626f7ef42))
|
|
30
|
+
* **be_direct_descendant_of:** fix typo ([bda7d06](https://github.com/marian13/convenient_service/commit/bda7d063d1801309a58b5e4d43d738ebab5fef59))
|
|
31
|
+
* **ci:** change the version of yard ([185c23c](https://github.com/marian13/convenient_service/commit/185c23c40dacf997e29d0b7defd10020c22dc196))
|
|
32
|
+
* **copyable:** do not mutate input params ([0809592](https://github.com/marian13/convenient_service/commit/08095927ea03c60a00eb3b0d0323458b482827b0))
|
|
33
|
+
* **dependency_container:** fix typo ([b1cf420](https://github.com/marian13/convenient_service/commit/b1cf420a2e69cc51e928a8a1ad885a65ad7fb4fe))
|
|
34
|
+
* **has_result_steps:** use unsafe attributes in to_kwargs ([6c2b1d3](https://github.com/marian13/convenient_service/commit/6c2b1d3912106f6848b875d06a4d7ce1d79c4edb))
|
|
35
|
+
* **has_result_steps:** use unsafe_data ([e00c346](https://github.com/marian13/convenient_service/commit/e00c3468f5761e20678c7019f0d13f2569778b19))
|
|
36
|
+
* **has_result:** use callbacks before result ([eb46444](https://github.com/marian13/convenient_service/commit/eb46444536a7cf4aab869aa009c1a7c896c00c11))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Miscellaneous Chores
|
|
40
|
+
|
|
41
|
+
* release 0.7.0 ([6433f5a](https://github.com/marian13/convenient_service/commit/6433f5a67c3f21c620d500186e0308fb7b098efc))
|
|
42
|
+
|
|
43
|
+
## [0.6.0](https://github.com/marian13/convenient_service/compare/v0.5.0...v0.6.0) (2023-01-22)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* **dependency_container:** assert valid scope ([5d75f59](https://github.com/marian13/convenient_service/commit/5d75f593c01baa695e75fe49af6b4c6b80d7d9b1))
|
|
49
|
+
* **singleton_prepend_module:** introduce singleton_prepend_module custom RSpec matcher ([6636b8d](https://github.com/marian13/convenient_service/commit/6636b8d030329e4a6216a934748a70ef4bae6ff3))
|
|
50
|
+
* **has_result_steps:** introduce reassign ([75855be](https://github.com/marian13/convenient_service/commit/75855be7fd9115d01d5cfad99d35319486332bd2))
|
|
51
|
+
|
|
3
52
|
## [0.5.0](https://github.com/marian13/convenient_service/compare/v0.4.0...v0.5.0) (2023-01-19)
|
|
4
53
|
|
|
5
54
|
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -60,5 +60,5 @@ This library is under heavy development. Public API may be subject to change. Th
|
|
|
60
60
|
---
|
|
61
61
|
|
|
62
62
|
<!-- author:start -->
|
|
63
|
-
Copyright (c) 2022 [Marian Kostyk](http://mariankostyk.com).
|
|
63
|
+
Copyright (c) 2022-2023 [Marian Kostyk](http://mariankostyk.com).
|
|
64
64
|
<!-- author:end -->
|
data/ROADMAP.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
| High | 🚧 | Optimize `stack.dup` in `MethodMiddlewares#call` | Core v3 |
|
|
33
33
|
| Medium | 🚧 | Make a decision of what to do with `printable_block` in custom RSpec matchers | |
|
|
34
34
|
| Medium | 🚧 | User-friendly exception messages | |
|
|
35
|
-
| High | 🚧 |
|
|
35
|
+
| High | 🚧 | Factory for POROs in specs ❗❗❗ | Start with `result_class`, `class self::Result`, `service_class`, `step_class`, `organizer_class` |
|
|
36
36
|
| High | 🚧 | Resolve warning during specs | |
|
|
37
37
|
| Medium | 🚧 | Consider to change/rewrite `delegate` backend to minify its interface | |
|
|
38
38
|
| Medium | 🚧 | Same order of attr macros, delegators, initialize, class methods, attr methods, queries, actions, `to_*`, comparison, inspect | |
|
|
@@ -44,14 +44,36 @@
|
|
|
44
44
|
| High | 🚧 | `included_once` for `Support::Concern` |
|
|
45
45
|
| Medium | 🚧 | Custom YARD type for service instance, service class as return values |
|
|
46
46
|
| Medium | 🚧 | Heredoc for error messages |
|
|
47
|
-
| Medium | 🚧 | Specs for `be_success`, `be_error`, `be_failure` matchers | |
|
|
48
|
-
| Low | 🚧 | [Receive Counts](https://relishapp.com/rspec/rspec-mocks/docs/setting-constraints/receive-counts) for `delegate_to` | |
|
|
47
|
+
| Medium | 🚧 | Specs for `be_success`, `be_error`, `be_failure` matchers | |
|
|
48
|
+
| Low | 🚧 | [Receive Counts](https://relishapp.com/rspec/rspec-mocks/docs/setting-constraints/receive-counts) for `delegate_to` | |
|
|
49
49
|
| Low | 🚧 | Prefer versioning instead of modification plugin | |
|
|
50
50
|
| Low | 🚧 | Consider to move `__steps__` and `__callbacks__` to `internals_class` | Benefit? |
|
|
51
51
|
| Medium | 🚧 | User friendly `raise` that removes lib backtrace from caller | Should have a `debug` mode. Should work well with examples. Check RSpec `CallerFilter.first_non_rspec_line` |
|
|
52
52
|
| High | 🚧 | A plugin that catches `StandardError` and returns `failure` | Should be the lowest in the stack |
|
|
53
53
|
| High | 🚧 | `Support::Command` alias | Should be visible to the end user |
|
|
54
54
|
| Low | 🚧 | Parallel steps | A killer feature |
|
|
55
|
-
| Medium | 🚧 | Add Ruby 3.2 support to Docker and CI | |
|
|
55
|
+
| Medium | 🚧 | Add `Ruby 3.2` support to `Docker` and `CI` | |
|
|
56
|
+
| Low | 🚧 | `overload do` | |
|
|
57
|
+
| Low | 🚧 | Same spec example group organization | |
|
|
58
|
+
| Medium | 🚧 | `Support::Arguments` | |
|
|
59
|
+
| Low | 🚧 | Null object to Nil object? | |
|
|
60
|
+
| High | 🚧 | Do not use Testing Toolkit in the Primitives layer | See [Components Diagram](https://marian13.github.io/static_content/convenient_service/diagrams/components_graph.html) + it should take the minimal amount of efforts to extract and reuse `Utils`, `Suppport` in the different projects |
|
|
61
|
+
| Medium | 🚧 | Perfromance testing | [rspec-benchmark](https://github.com/piotrmurach/rspec-benchmark), [Testing object allocations](https://www.honeybadger.io/blog/testing-object-allocations/), [allocation_stats](https://github.com/srawlins/allocation_stats) |
|
|
62
|
+
| Medium | 🚧 | Mutant testing | [mutant](https://github.com/mbj/mutant) |
|
|
63
|
+
| Low | 🚧 | Add `JRuby` support | [jruby](https://www.jruby.org/) |
|
|
64
|
+
| Medium | 🚧 | Add `shoulda-context` to test conditionals when `RSpec` is not loaded | [shoulda-context](https://github.com/thoughtbot/shoulda-context) |
|
|
65
|
+
| High | 🚧 | Abstract factory for `CastMethod` | |
|
|
66
|
+
| Medium | 🚧 | `delegate_to` - option to specify of how to compare blocks | |
|
|
67
|
+
| High | 🚧 | Add specs for [Reassignment::Commands::DefineMethodInContainer](https://github.com/marian13/convenient_service/blob/v0.6.0/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/reassignment/commands/define_method_in_container.rb#L13) | |
|
|
68
|
+
| High | 🚧 | Example for dependency containers | |
|
|
69
|
+
| Low | 🚧 | `delegate_to.and_return_value` | |
|
|
70
|
+
| Medium | 🚧 | Support two Cache implementations, array-based and hash-based | |
|
|
71
|
+
| Low | 🚧 | `delegate_to_service` | |
|
|
72
|
+
| High | 🚧 | Intentionally disable plugins to document dependencies | |
|
|
73
|
+
| Low | 🚧 | `.and_return_value_should be_instance_of(expected)` | |
|
|
74
|
+
| Low | 🚧 | `ConvenientService::Config.delegate_to_diff_argorithm = :diffy` | |
|
|
75
|
+
| Low | 🚧 | Rubocop cop that complains when a service name does NOT start with a verb | |
|
|
76
|
+
| Low | 🚧 | Generator to create a spec default structure | |
|
|
77
|
+
| Low | 🚧 | Rubocop cop that complains when a service does NOT have its own suite of specs | |
|
|
56
78
|
|
|
57
79
|
Search for `TODO`s in the codebase for more tasks.
|
data/Taskfile.yml
CHANGED
|
@@ -78,6 +78,16 @@ tasks:
|
|
|
78
78
|
|
|
79
79
|
docker:build:ruby_2.7:
|
|
80
80
|
cmds:
|
|
81
|
+
##
|
|
82
|
+
# NOTE: Meaning of `|| 2> /dev/null`.
|
|
83
|
+
# https://stackoverflow.com/a/10250395/12201472
|
|
84
|
+
#
|
|
85
|
+
# NOTE: Meaning of `|| true`.
|
|
86
|
+
# https://superuser.com/a/887349/1180656
|
|
87
|
+
#
|
|
88
|
+
- rm Gemfile.2.7 2> /dev/null || true
|
|
89
|
+
- rm Gemfile.2.7.lock 2> /dev/null || true
|
|
90
|
+
- cp Gemfile Gemfile.2.7
|
|
81
91
|
- docker build . -f docker/2.7/Dockerfile -t convenient_service:2.7
|
|
82
92
|
preconditions:
|
|
83
93
|
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
|
@@ -85,6 +95,16 @@ tasks:
|
|
|
85
95
|
|
|
86
96
|
docker:build:ruby_3.0:
|
|
87
97
|
cmds:
|
|
98
|
+
##
|
|
99
|
+
# NOTE: Meaning of `|| 2> /dev/null`.
|
|
100
|
+
# https://stackoverflow.com/a/10250395/12201472
|
|
101
|
+
#
|
|
102
|
+
# NOTE: Meaning of `|| true`.
|
|
103
|
+
# https://superuser.com/a/887349/1180656
|
|
104
|
+
#
|
|
105
|
+
- rm Gemfile.3.0 2> /dev/null || true
|
|
106
|
+
- rm Gemfile.3.0.lock 2> /dev/null || true
|
|
107
|
+
- cp Gemfile Gemfile.3.0
|
|
88
108
|
- docker build . -f docker/3.0/Dockerfile -t convenient_service:3.0
|
|
89
109
|
preconditions:
|
|
90
110
|
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
|
@@ -92,6 +112,16 @@ tasks:
|
|
|
92
112
|
|
|
93
113
|
docker:build:ruby_3.1:
|
|
94
114
|
cmds:
|
|
115
|
+
##
|
|
116
|
+
# NOTE: Meaning of `|| 2> /dev/null`.
|
|
117
|
+
# https://stackoverflow.com/a/10250395/12201472
|
|
118
|
+
#
|
|
119
|
+
# NOTE: Meaning of `|| true`.
|
|
120
|
+
# https://superuser.com/a/887349/1180656
|
|
121
|
+
#
|
|
122
|
+
- rm Gemfile.3.1 2> /dev/null || true
|
|
123
|
+
- rm Gemfile.3.1.lock 2> /dev/null || true
|
|
124
|
+
- cp Gemfile Gemfile.3.1
|
|
95
125
|
- docker build . -f docker/3.1/Dockerfile -t convenient_service:3.1
|
|
96
126
|
preconditions:
|
|
97
127
|
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
data/convenient_service.gemspec
CHANGED
|
@@ -33,20 +33,23 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.add_development_dependency "awesome_print"
|
|
34
34
|
spec.add_development_dependency "byebug", "~> 10.0"
|
|
35
35
|
spec.add_development_dependency "commonmarker"
|
|
36
|
+
spec.add_development_dependency "faker"
|
|
36
37
|
spec.add_development_dependency "gem-release"
|
|
37
38
|
spec.add_development_dependency "inch"
|
|
39
|
+
spec.add_development_dependency "json"
|
|
38
40
|
spec.add_development_dependency "paint"
|
|
39
41
|
spec.add_development_dependency "progressbar"
|
|
40
42
|
spec.add_development_dependency "rake", "~> 12.0"
|
|
41
43
|
spec.add_development_dependency "rerun"
|
|
42
44
|
spec.add_development_dependency "rouge"
|
|
43
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
|
45
|
+
spec.add_development_dependency "rspec", "~> 3.11.0"
|
|
44
46
|
spec.add_development_dependency "rubocop", "~> 1.40.0"
|
|
45
47
|
spec.add_development_dependency "rubocop-rspec"
|
|
46
48
|
spec.add_development_dependency "tty-prompt"
|
|
47
49
|
spec.add_development_dependency "standard"
|
|
48
50
|
spec.add_development_dependency "simplecov"
|
|
49
51
|
spec.add_development_dependency "simplecov-lcov"
|
|
50
|
-
spec.add_development_dependency "
|
|
52
|
+
spec.add_development_dependency "webrick"
|
|
53
|
+
spec.add_development_dependency "yard", "~> 0.9.28"
|
|
51
54
|
spec.add_development_dependency "yard-junk"
|
|
52
55
|
end
|
|
@@ -5,7 +5,11 @@ module ConvenientService
|
|
|
5
5
|
module Plugins
|
|
6
6
|
module HasAroundCallbacks
|
|
7
7
|
class Middleware < Core::MethodChainMiddleware
|
|
8
|
-
|
|
8
|
+
include Support::DependencyContainer::Import
|
|
9
|
+
|
|
10
|
+
import :"entities.Callback", from: Common::Plugins::HasCallbacks::Container
|
|
11
|
+
|
|
12
|
+
def next(*args, **kwargs, &block)
|
|
9
13
|
##
|
|
10
14
|
# A variable that stores return value of middleware `chain.next` aka `original_value`.
|
|
11
15
|
# It is reassigned later by the `initial_around_callback`.
|
|
@@ -15,14 +19,30 @@ module ConvenientService
|
|
|
15
19
|
##
|
|
16
20
|
# A list of around callbacks.
|
|
17
21
|
#
|
|
22
|
+
# class Service
|
|
23
|
+
# around do |chain|
|
|
24
|
+
# # part before `chain.yield`
|
|
25
|
+
# original_value = chain.yield
|
|
26
|
+
# # part after `chain.yield`
|
|
27
|
+
# end
|
|
28
|
+
# end
|
|
29
|
+
#
|
|
30
|
+
# class Service
|
|
31
|
+
# around do |chain, arguments|
|
|
32
|
+
# # part before `chain.yield`
|
|
33
|
+
# original_value = chain.yield
|
|
34
|
+
# # part after `chain.yield`
|
|
35
|
+
# end
|
|
36
|
+
# end
|
|
37
|
+
#
|
|
18
38
|
around_callbacks = entity.callbacks.for([:around, method])
|
|
19
39
|
|
|
20
40
|
##
|
|
21
41
|
#
|
|
22
42
|
#
|
|
23
|
-
initial_around_callback =
|
|
43
|
+
initial_around_callback = entities.Callback.new(
|
|
24
44
|
types: [:around, method],
|
|
25
|
-
block: proc { original_value = chain.next(
|
|
45
|
+
block: proc { original_value = chain.next(*args, **kwargs, &block) }
|
|
26
46
|
)
|
|
27
47
|
|
|
28
48
|
##
|
|
@@ -76,7 +96,7 @@ module ConvenientService
|
|
|
76
96
|
# rubocop:disable Style/Semicolon
|
|
77
97
|
composed =
|
|
78
98
|
around_callbacks.reverse.reduce(initial_around_callback) do |composed, callback|
|
|
79
|
-
proc { callback.
|
|
99
|
+
proc { callback.call_in_context_with_value_and_arguments(entity, composed, *args, **kwargs, &block); original_value }
|
|
80
100
|
end
|
|
81
101
|
# rubocop:enable Style/Semicolon
|
|
82
102
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ConvenientService
|
|
4
|
+
module Common
|
|
5
|
+
module Plugins
|
|
6
|
+
module HasCallbacks
|
|
7
|
+
module Container
|
|
8
|
+
include Support::DependencyContainer::Export
|
|
9
|
+
|
|
10
|
+
export :"entities.Callback" do
|
|
11
|
+
Entities::Callback
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -6,33 +6,99 @@ module ConvenientService
|
|
|
6
6
|
module HasCallbacks
|
|
7
7
|
module Entities
|
|
8
8
|
class Callback
|
|
9
|
-
|
|
9
|
+
##
|
|
10
|
+
# @!attribute [r] types
|
|
11
|
+
# @return [ConvenientService::Common::Plugins::HasCallbacks::Entities::TypeCollection]
|
|
12
|
+
#
|
|
13
|
+
attr_reader :types
|
|
10
14
|
|
|
15
|
+
##
|
|
16
|
+
# @!attribute [r] block
|
|
17
|
+
# @return [Proc]
|
|
18
|
+
#
|
|
19
|
+
attr_reader :block
|
|
20
|
+
|
|
21
|
+
##
|
|
22
|
+
# @param types [ConvenientService::Common::Plugins::HasCallbacks::Entities::TypeCollection]
|
|
23
|
+
# @param block [Proc]
|
|
24
|
+
# @return [void]
|
|
25
|
+
#
|
|
11
26
|
def initialize(types:, block:)
|
|
12
27
|
@types = Entities::TypeCollection.new(types: types)
|
|
13
28
|
@block = block
|
|
14
29
|
end
|
|
15
30
|
|
|
31
|
+
##
|
|
32
|
+
# @return [Boolean]
|
|
33
|
+
#
|
|
16
34
|
def called?
|
|
17
35
|
Utils::Bool.to_bool(@called)
|
|
18
36
|
end
|
|
19
37
|
|
|
38
|
+
##
|
|
39
|
+
# @return [Boolean]
|
|
40
|
+
#
|
|
20
41
|
def not_called?
|
|
21
42
|
!called?
|
|
22
43
|
end
|
|
23
44
|
|
|
24
|
-
|
|
25
|
-
|
|
45
|
+
##
|
|
46
|
+
# @return [Object] Can be any type.
|
|
47
|
+
#
|
|
48
|
+
def call(...)
|
|
49
|
+
call_callback(...)
|
|
26
50
|
end
|
|
27
51
|
|
|
52
|
+
##
|
|
53
|
+
# @return [Object] Can be any type.
|
|
54
|
+
#
|
|
28
55
|
alias_method :yield, :call
|
|
56
|
+
|
|
57
|
+
##
|
|
58
|
+
# @return [Object] Can be any type.
|
|
59
|
+
#
|
|
29
60
|
alias_method :[], :call
|
|
61
|
+
|
|
62
|
+
##
|
|
63
|
+
# @return [Object] Can be any type.
|
|
64
|
+
#
|
|
30
65
|
alias_method :===, :call
|
|
31
66
|
|
|
32
|
-
|
|
33
|
-
|
|
67
|
+
##
|
|
68
|
+
# @param context [Object] Can be any type.
|
|
69
|
+
# @return [ConvenientService::Common::Plugins::HasCallbacks::Entities::Callback]
|
|
70
|
+
#
|
|
71
|
+
def call_in_context(context)
|
|
72
|
+
call_callback_in_context(context)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
##
|
|
76
|
+
# @param context [Object] Can be any type.
|
|
77
|
+
# @param args [Array]
|
|
78
|
+
# @param kwargs [Hash]
|
|
79
|
+
# @param block [Proc]
|
|
80
|
+
# @return [ConvenientService::Common::Plugins::HasCallbacks::Entities::Callback]
|
|
81
|
+
#
|
|
82
|
+
def call_in_context_with_arguments(context, *args, **kwargs, &block)
|
|
83
|
+
call_callback_in_context(context, arguments(*args, **kwargs, &block))
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
##
|
|
87
|
+
# @param context [Object] Can be any type.
|
|
88
|
+
# @param value [Object] Can be any type.
|
|
89
|
+
# @param args [Array]
|
|
90
|
+
# @param kwargs [Hash]
|
|
91
|
+
# @param block [Proc]
|
|
92
|
+
# @return [ConvenientService::Common::Plugins::HasCallbacks::Entities::Callback]
|
|
93
|
+
#
|
|
94
|
+
def call_in_context_with_value_and_arguments(context, value, *args, **kwargs, &block)
|
|
95
|
+
call_callback_in_context(context, value, arguments(*args, **kwargs, &block))
|
|
34
96
|
end
|
|
35
97
|
|
|
98
|
+
##
|
|
99
|
+
# @param other [Object] Can be any type.
|
|
100
|
+
# @return [Boolead]
|
|
101
|
+
#
|
|
36
102
|
def ==(other)
|
|
37
103
|
return unless other.instance_of?(self.class)
|
|
38
104
|
|
|
@@ -42,15 +108,42 @@ module ConvenientService
|
|
|
42
108
|
true
|
|
43
109
|
end
|
|
44
110
|
|
|
111
|
+
##
|
|
112
|
+
# @return [Proc]
|
|
113
|
+
#
|
|
45
114
|
def to_proc
|
|
46
115
|
block
|
|
47
116
|
end
|
|
48
117
|
|
|
49
118
|
private
|
|
50
119
|
|
|
120
|
+
##
|
|
121
|
+
# @return [Boolean]
|
|
122
|
+
#
|
|
51
123
|
def mark_as_called
|
|
52
124
|
@called = true
|
|
53
125
|
end
|
|
126
|
+
|
|
127
|
+
##
|
|
128
|
+
# @return [ConvenientService::Support::Arguments]
|
|
129
|
+
#
|
|
130
|
+
def arguments(...)
|
|
131
|
+
Support::Arguments.new(...)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
##
|
|
135
|
+
# @return [Object] Can be any type.
|
|
136
|
+
#
|
|
137
|
+
def call_callback(...)
|
|
138
|
+
block.call(...).tap { mark_as_called }
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
##
|
|
142
|
+
# @return [Object] Can be any type.
|
|
143
|
+
#
|
|
144
|
+
def call_callback_in_context(context, *args)
|
|
145
|
+
context.instance_exec(*args, &block).tap { mark_as_called }
|
|
146
|
+
end
|
|
54
147
|
end
|
|
55
148
|
end
|
|
56
149
|
end
|
|
@@ -5,12 +5,33 @@ module ConvenientService
|
|
|
5
5
|
module Plugins
|
|
6
6
|
module HasCallbacks
|
|
7
7
|
class Middleware < Core::MethodChainMiddleware
|
|
8
|
-
def next(
|
|
9
|
-
|
|
8
|
+
def next(*args, **kwargs, &block)
|
|
9
|
+
##
|
|
10
|
+
# class Service
|
|
11
|
+
# before :result do
|
|
12
|
+
# end
|
|
13
|
+
#
|
|
14
|
+
# before :result do |arguments|
|
|
15
|
+
# end
|
|
16
|
+
# end
|
|
17
|
+
#
|
|
18
|
+
entity.callbacks.for([:before, method]).each { |callback| callback.call_in_context_with_arguments(entity, *args, **kwargs, &block) }
|
|
10
19
|
|
|
11
|
-
original_value = chain.next(
|
|
20
|
+
original_value = chain.next(*args, **kwargs, &block)
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
##
|
|
23
|
+
# class Service
|
|
24
|
+
# after :result do
|
|
25
|
+
# end
|
|
26
|
+
#
|
|
27
|
+
# after :result do |result|
|
|
28
|
+
# end
|
|
29
|
+
#
|
|
30
|
+
# after :result do |result, arguments|
|
|
31
|
+
# end
|
|
32
|
+
# end
|
|
33
|
+
#
|
|
34
|
+
entity.callbacks.for([:after, method]).reverse_each { |callback| callback.call_in_context_with_value_and_arguments(entity, original_value, *args, **kwargs, &block) }
|
|
14
35
|
|
|
15
36
|
original_value
|
|
16
37
|
end
|
|
@@ -8,8 +8,8 @@ require_relative "plugins/normalizes_env"
|
|
|
8
8
|
require_relative "plugins/caches_constructor_params"
|
|
9
9
|
require_relative "plugins/caches_return_value"
|
|
10
10
|
require_relative "plugins/can_be_copied"
|
|
11
|
-
require_relative "plugins/has_around_callbacks"
|
|
12
11
|
require_relative "plugins/has_callbacks"
|
|
12
|
+
require_relative "plugins/has_around_callbacks"
|
|
13
13
|
require_relative "plugins/has_constructor"
|
|
14
14
|
require_relative "plugins/has_constructor_without_initialize"
|
|
15
15
|
require_relative "plugins/has_internals"
|
|
@@ -34,12 +34,6 @@ module ConvenientService
|
|
|
34
34
|
use Plugins::Common::HasAroundCallbacks::Concern
|
|
35
35
|
|
|
36
36
|
use Plugins::Service::HasInspect::Concern
|
|
37
|
-
##
|
|
38
|
-
# NOTE: Optional plugins.
|
|
39
|
-
# TODO: Specs.
|
|
40
|
-
#
|
|
41
|
-
# use Plugins::Common::HasConfig::Concern
|
|
42
|
-
#
|
|
43
37
|
end
|
|
44
38
|
|
|
45
39
|
middlewares :initialize do
|
|
@@ -51,18 +45,24 @@ module ConvenientService
|
|
|
51
45
|
middlewares :result do
|
|
52
46
|
use Plugins::Common::NormalizesEnv::Middleware
|
|
53
47
|
|
|
54
|
-
use Plugins::Service::HasResult::Middleware
|
|
55
|
-
|
|
56
|
-
use Plugins::Service::HasResultSteps::Middleware
|
|
57
|
-
|
|
58
48
|
use Plugins::Common::HasCallbacks::Middleware
|
|
59
49
|
use Plugins::Common::HasAroundCallbacks::Middleware
|
|
60
50
|
|
|
51
|
+
use Plugins::Service::HasResult::Middleware
|
|
52
|
+
use Plugins::Service::HasResultSteps::Middleware
|
|
53
|
+
|
|
61
54
|
use Plugins::Service::RaisesOnDoubleResult::Middleware
|
|
62
55
|
|
|
63
56
|
use Plugins::Common::CachesReturnValue::Middleware
|
|
64
57
|
end
|
|
65
58
|
|
|
59
|
+
middlewares :step do
|
|
60
|
+
use Plugins::Common::NormalizesEnv::Middleware
|
|
61
|
+
|
|
62
|
+
use Plugins::Common::HasCallbacks::Middleware
|
|
63
|
+
use Plugins::Common::HasAroundCallbacks::Middleware
|
|
64
|
+
end
|
|
65
|
+
|
|
66
66
|
middlewares :success do
|
|
67
67
|
use Plugins::Common::NormalizesEnv::Middleware
|
|
68
68
|
|
|
@@ -111,6 +111,9 @@ module ConvenientService
|
|
|
111
111
|
use Plugins::Result::HasResultShortSyntax::Concern
|
|
112
112
|
use Plugins::Result::CanRecalculateResult::Concern
|
|
113
113
|
|
|
114
|
+
use Plugins::Result::HasStep::Concern
|
|
115
|
+
use Plugins::Result::CanHaveParentResult::Concern
|
|
116
|
+
|
|
114
117
|
use Plugins::Result::HasInspect::Concern
|
|
115
118
|
end
|
|
116
119
|
|
|
@@ -118,6 +121,9 @@ module ConvenientService
|
|
|
118
121
|
use Plugins::Common::NormalizesEnv::Middleware
|
|
119
122
|
|
|
120
123
|
use Plugins::Result::HasJsendStatusAndAttributes::Middleware
|
|
124
|
+
|
|
125
|
+
use Plugins::Result::HasStep::Initialize::Middleware
|
|
126
|
+
use Plugins::Result::CanHaveParentResult::Initialize::Middleware
|
|
121
127
|
end
|
|
122
128
|
|
|
123
129
|
middlewares :success? do
|
|
@@ -174,6 +180,13 @@ module ConvenientService
|
|
|
174
180
|
use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
|
|
175
181
|
end
|
|
176
182
|
|
|
183
|
+
middlewares :to_kwargs do
|
|
184
|
+
use Plugins::Common::NormalizesEnv::Middleware
|
|
185
|
+
|
|
186
|
+
use Plugins::Result::HasStep::ToKwargs::Middleware
|
|
187
|
+
use Plugins::Result::CanHaveParentResult::ToKwargs::Middleware
|
|
188
|
+
end
|
|
189
|
+
|
|
177
190
|
class self::Internals
|
|
178
191
|
include Core
|
|
179
192
|
|
|
@@ -192,10 +205,10 @@ module ConvenientService
|
|
|
192
205
|
use Plugins::Step::HasInspect::Concern
|
|
193
206
|
end
|
|
194
207
|
|
|
195
|
-
middlewares :
|
|
208
|
+
middlewares :calculate_result do
|
|
196
209
|
use Plugins::Common::NormalizesEnv::Middleware
|
|
197
210
|
|
|
198
|
-
use Plugins::
|
|
211
|
+
use Plugins::Step::CanHaveParentResult::Middleware
|
|
199
212
|
end
|
|
200
213
|
|
|
201
214
|
class self::Internals
|
|
@@ -35,30 +35,7 @@ module ConvenientService
|
|
|
35
35
|
# @return [Module]
|
|
36
36
|
#
|
|
37
37
|
def call
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
private
|
|
42
|
-
|
|
43
|
-
##
|
|
44
|
-
# @return [Module, nil]
|
|
45
|
-
#
|
|
46
|
-
def get_methods_middlewares_callers
|
|
47
|
-
Utils::Module.get_own_const(klass, module_name)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
##
|
|
51
|
-
# @return [Module]
|
|
52
|
-
#
|
|
53
|
-
def set_methods_middlewares_callers
|
|
54
|
-
klass.const_set(module_name, ::Module.new)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
##
|
|
58
|
-
# @return [Symbol]
|
|
59
|
-
#
|
|
60
|
-
def module_name
|
|
61
|
-
@module_name ||= :MethodsMiddlewaresCallers
|
|
38
|
+
Utils::Module.fetch_own_const(klass, :MethodsMiddlewaresCallers) { ::Module.new }
|
|
62
39
|
end
|
|
63
40
|
end
|
|
64
41
|
end
|