convenient_service 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dev/.tmuxinator.yml +2 -1
- data/.github/workflows/ci.yml +21 -1
- data/CHANGELOG.md +67 -0
- data/Gemfile +6 -0
- data/README.md +4 -2
- data/Taskfile.yml +94 -0
- data/convenient_service.gemspec +40 -2
- data/docker/2.7/Dockerfile +3 -3
- data/docker/3.0/Dockerfile +2 -2
- data/docker/3.1/Dockerfile +2 -2
- data/docker/3.2/Dockerfile +73 -0
- data/docker/jruby-9.4/Dockerfile +88 -0
- data/docker/truffleruby-22.3/Dockerfile +91 -0
- data/lib/convenient_service/common/plugins/aliases.rb +0 -1
- data/lib/convenient_service/common/plugins/assigns_attributes_in_constructor/using_active_model_attribute_assignment/middleware.rb +12 -8
- data/lib/convenient_service/common/plugins/caches_return_value/middleware.rb +3 -3
- data/lib/convenient_service/common/plugins/can_have_user_provided_entity/errors.rb +2 -2
- data/lib/convenient_service/common/plugins/has_around_callbacks/errors.rb +1 -1
- data/lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb +7 -7
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins/aliases.rb +7 -0
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins.rb +2 -0
- data/lib/convenient_service/configs/minimal.rb +19 -10
- data/lib/convenient_service/core/class_methods.rb +24 -9
- data/lib/convenient_service/core/constants.rb +36 -0
- data/lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb +69 -0
- data/lib/convenient_service/core/entities/config/commands.rb +3 -0
- data/lib/convenient_service/core/entities/config/entities/concerns/entities/stack.rb +10 -10
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/chain.rb +3 -3
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware.rb +18 -1
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creator.rb +62 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/stack.rb +12 -12
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities.rb +1 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares.rb +1 -1
- data/lib/convenient_service/core/entities/config/errors.rb +38 -1
- data/lib/convenient_service/core/entities/config.rb +14 -4
- data/lib/convenient_service/core/instance_methods.rb +6 -4
- data/lib/convenient_service/core.rb +1 -0
- data/lib/convenient_service/dependencies/built_in.rb +7 -0
- data/lib/convenient_service/dependencies/extractions/active_support_concern/concern.rb +18 -2
- data/lib/convenient_service/dependencies/extractions/active_support_concern.rb +4 -0
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/builder.rb +7 -1
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/logger.rb +7 -1
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/runner.rb +15 -1
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware.rb +8 -1
- data/lib/convenient_service/dependencies/extractions/ruby_middleware.rb +3 -2
- data/lib/convenient_service/dependencies.rb +16 -15
- data/lib/convenient_service/examples/dry/gemfile.rb +4 -4
- data/lib/convenient_service/examples/rails/gemfile.rb +4 -4
- data/lib/convenient_service/examples/standard/cowsay.rb +4 -4
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb +1 -1
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb +1 -1
- data/lib/convenient_service/examples/standard/gemfile/services/assert_node_available.rb +0 -9
- data/lib/convenient_service/examples/standard/gemfile/services/assert_npm_package_available.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile/services/format.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile/services/merge_sections.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile/services/parse_content.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile/services/read_file_content.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile.rb +4 -4
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_body.rb +0 -10
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_path.rb +0 -10
- data/lib/convenient_service/examples/standard/request_params/services/validate_casted_params.rb +0 -10
- data/lib/convenient_service/examples/standard/request_params/services/validate_uncasted_params.rb +0 -10
- data/lib/convenient_service/examples/standard/request_params.rb +4 -4
- data/lib/convenient_service/feature.rb +12 -0
- data/lib/convenient_service/logger.rb +6 -5
- data/lib/convenient_service/rspec/helpers/custom/in_threads.rb +74 -0
- data/lib/convenient_service/rspec/helpers/custom/stub_service/constants.rb +20 -0
- data/lib/convenient_service/rspec/helpers/custom/stub_service/entities/stubbed_service.rb +4 -4
- data/lib/convenient_service/rspec/helpers/custom/stub_service.rb +1 -0
- data/lib/convenient_service/rspec/helpers/custom/wrap_method/entities/wrapped_method.rb +3 -3
- data/lib/convenient_service/rspec/helpers/custom/wrap_method/errors.rb +1 -1
- data/lib/convenient_service/rspec/helpers/custom.rb +1 -0
- data/lib/convenient_service/rspec/helpers/in_threads.rb +13 -0
- data/lib/convenient_service/rspec/helpers.rb +2 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings_collection/errors.rb +3 -3
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/delegation.rb +3 -3
- data/lib/convenient_service/rspec/matchers/custom/export.rb +82 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/constants.rb +22 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/errors.rb +1 -1
- data/lib/convenient_service/rspec/matchers/custom/results/base.rb +2 -1
- data/lib/convenient_service/rspec/matchers/custom.rb +1 -0
- data/lib/convenient_service/rspec/matchers/export.rb +13 -0
- data/lib/convenient_service/rspec/matchers.rb +2 -0
- data/lib/convenient_service/service/plugins/aliases.rb +0 -2
- data/lib/convenient_service/service/plugins/can_have_method_steps/middleware.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_result_step/middleware.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method.rb +46 -11
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_direction.rb +29 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_factory.rb +113 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands.rb +1 -3
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/base.rb +62 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/base.rb +35 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/proc_value.rb +42 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/raw_value.rb +42 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/reassignment_value.rb +42 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/string_value.rb +42 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/symbol_value.rb +42 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash.rb +8 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/method.rb +40 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/reassignment.rb +40 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/string.rb +40 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/symbol.rb +40 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories.rb +8 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities.rb +1 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/errors.rb +7 -7
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/errors.rb +12 -8
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/aliases.rb +7 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb +2 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step_collection.rb +37 -8
- data/lib/convenient_service/service/plugins/can_have_stubbed_result/concern.rb +19 -11
- data/lib/convenient_service/service/plugins/can_have_stubbed_result/middleware.rb +3 -3
- data/lib/convenient_service/service/plugins/has_result/concern/instance_methods.rb +3 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/aliases.rb +7 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/concern.rb +12 -5
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes/concern/class_methods.rb → can_have_parent_result/constants.rb} +3 -4
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result.rb +1 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes/commands/cast_jsend_attributes.rb → has_j_send_status_and_attributes/commands/cast_j_send_attributes.rb} +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_code_class.rb +49 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_data_class.rb +49 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_message_class.rb +49 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_status_class.rb +49 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/commands.rb +7 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/concern/class_methods.rb +69 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/concern/instance_methods.rb +9 -9
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/entities/code/concern/class_methods.rb +2 -2
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/entities/code/concern/instance_methods.rb +3 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/entities/code/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/entities/code.rb +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/class_methods.rb +38 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb +94 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern.rb +36 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data.rb +25 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/class_methods.rb +40 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/instance_methods.rb +58 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern.rb +36 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message.rb +25 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/class_methods.rb +40 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/instance_methods.rb +115 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern.rb +36 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status.rb +25 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/errors.rb +6 -2
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/middleware.rb +4 -4
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes/structs/jsend_attributes.rb → has_j_send_status_and_attributes/structs/j_send_attributes.rb} +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/structs.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes.rb +8 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_result_short_syntax/concern.rb +3 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/raises_on_not_checked_result_status/errors.rb +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins.rb +3 -1
- data/lib/convenient_service/service/plugins/has_result/errors.rb +2 -2
- data/lib/convenient_service/service/plugins/has_result_status_check_short_syntax/concern.rb +16 -0
- data/lib/convenient_service/service/plugins/raises_on_double_result/errors.rb +1 -1
- data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_backtrace.rb +1 -1
- data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_exception.rb +11 -10
- data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/middleware.rb +14 -7
- data/lib/convenient_service/services/run_own_method_in_organizer.rb +1 -1
- data/lib/convenient_service/support/abstract_method/errors.rb +1 -1
- data/lib/convenient_service/support/arguments.rb +3 -3
- data/lib/convenient_service/support/cache/key.rb +3 -3
- data/lib/convenient_service/support/cache.rb +1 -1
- data/lib/convenient_service/support/castable/errors.rb +2 -2
- data/lib/convenient_service/support/counter.rb +212 -0
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_container.rb +33 -0
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_method.rb +58 -0
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_scope.rb +4 -3
- data/lib/convenient_service/support/dependency_container/commands/define_entry.rb +49 -0
- data/lib/convenient_service/support/dependency_container/commands.rb +3 -0
- data/lib/convenient_service/support/dependency_container/container.rb +23 -0
- data/lib/convenient_service/support/dependency_container/entry.rb +22 -0
- data/lib/convenient_service/support/dependency_container/errors.rb +5 -5
- data/lib/convenient_service/support/dependency_container/import.rb +3 -3
- data/lib/convenient_service/support/dependency_container.rb +3 -0
- data/lib/convenient_service/support/finite_loop.rb +37 -2
- data/lib/convenient_service/support/middleware/stack_builder.rb +1 -1
- data/lib/convenient_service/support/not_passed.rb +4 -3
- data/lib/convenient_service/support/ruby.rb +31 -0
- data/lib/convenient_service/support/safe_method.rb +65 -0
- data/lib/convenient_service/support/thread_safe_counter.rb +119 -0
- data/lib/convenient_service/support/undefined.rb +4 -3
- data/lib/convenient_service/support/unique_value.rb +69 -0
- data/lib/convenient_service/support.rb +4 -0
- data/lib/convenient_service/utils/array/errors.rb +1 -1
- data/lib/convenient_service/utils/array/find_last.rb +1 -1
- data/lib/convenient_service/utils/array/find_yield.rb +1 -1
- data/lib/convenient_service/utils/object/resolve_class.rb +56 -0
- data/lib/convenient_service/utils/object.rb +9 -0
- data/lib/convenient_service/version.rb +1 -1
- data/lib/convenient_service.rb +6 -0
- metadata +75 -34
- data/lib/convenient_service/factories/arguments.rb +0 -43
- data/lib/convenient_service/factories/results.rb +0 -214
- data/lib/convenient_service/factories/services.rb +0 -229
- data/lib/convenient_service/factories/step/instance.rb +0 -42
- data/lib/convenient_service/factories/step.rb +0 -3
- data/lib/convenient_service/factories/steps.rb +0 -126
- data/lib/convenient_service/factories.rb +0 -22
- data/lib/convenient_service/factory.rb +0 -21
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_caller.rb +0 -74
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_key.rb +0 -78
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_name.rb +0 -78
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/commands.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/data/class_methods.rb +0 -32
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/data.rb +0 -74
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/message/class_methods.rb +0 -34
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/message.rb +0 -45
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/status/class_methods.rb +0 -34
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/status.rb +0 -77
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/structs.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes.rb +0 -8
- /data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/entities.rb +0 -0
data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/stack.rb
CHANGED
@@ -48,8 +48,8 @@ module ConvenientService
|
|
48
48
|
##
|
49
49
|
# @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
|
50
50
|
# @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
|
51
|
-
# @param args [Array]
|
52
|
-
# @param block [Proc]
|
51
|
+
# @param args [Array<Object>]
|
52
|
+
# @param block [Proc, nil]
|
53
53
|
# @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
|
54
54
|
#
|
55
55
|
# @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L88
|
@@ -69,8 +69,8 @@ module ConvenientService
|
|
69
69
|
##
|
70
70
|
# @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
|
71
71
|
# @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
|
72
|
-
# @param args [Array]
|
73
|
-
# @param block [Proc]
|
72
|
+
# @param args [Array<Object>]
|
73
|
+
# @param block [Proc, nil]
|
74
74
|
# @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
|
75
75
|
#
|
76
76
|
# @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L97
|
@@ -83,8 +83,8 @@ module ConvenientService
|
|
83
83
|
|
84
84
|
##
|
85
85
|
# @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
|
86
|
-
# @param args [Array]
|
87
|
-
# @param block [Proc]
|
86
|
+
# @param args [Array<Object>]
|
87
|
+
# @param block [Proc, nil]
|
88
88
|
# @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
|
89
89
|
#
|
90
90
|
# @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L104
|
@@ -97,8 +97,8 @@ module ConvenientService
|
|
97
97
|
|
98
98
|
##
|
99
99
|
# @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
|
100
|
-
# @param args [Array]
|
101
|
-
# @param block [Proc]
|
100
|
+
# @param args [Array<Object>]
|
101
|
+
# @param block [Proc, nil]
|
102
102
|
# @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
|
103
103
|
#
|
104
104
|
# @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L111
|
@@ -112,8 +112,8 @@ module ConvenientService
|
|
112
112
|
##
|
113
113
|
# @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
|
114
114
|
# @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
|
115
|
-
# @param args [Array]
|
116
|
-
# @param block [Proc]
|
115
|
+
# @param args [Array<Object>]
|
116
|
+
# @param block [Proc, nil]
|
117
117
|
# @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
|
118
118
|
#
|
119
119
|
# @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L118
|
@@ -138,8 +138,8 @@ module ConvenientService
|
|
138
138
|
|
139
139
|
##
|
140
140
|
# @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
|
141
|
-
# @param args [Array]
|
142
|
-
# @param block [Proc]
|
141
|
+
# @param args [Array<Object>]
|
142
|
+
# @param block [Proc, nil]
|
143
143
|
# @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
|
144
144
|
#
|
145
145
|
# @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L76
|
@@ -93,7 +93,7 @@ module ConvenientService
|
|
93
93
|
# NOTE: Consider to remove when support for Ruby 2.7 is dropped.
|
94
94
|
#
|
95
95
|
def resolve_super_method(entity)
|
96
|
-
klass.commit_config!
|
96
|
+
klass.commit_config!(trigger: Constants::Triggers::RESOLVE_METHOD_MIDDLEWARES_SUPER_METHOD)
|
97
97
|
|
98
98
|
container.resolve_super_method(method, entity)
|
99
99
|
end
|
@@ -5,7 +5,7 @@ module ConvenientService
|
|
5
5
|
module Entities
|
6
6
|
class Config
|
7
7
|
module Errors
|
8
|
-
class ConfigIsCommitted < ConvenientService::Error
|
8
|
+
class ConfigIsCommitted < ::ConvenientService::Error
|
9
9
|
##
|
10
10
|
# @param config [ConvenientService::Core::Entities::Config]
|
11
11
|
# @return [void]
|
@@ -20,6 +20,43 @@ module ConvenientService
|
|
20
20
|
super(message)
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
class TooManyCommitsFromMethodMissing < ::ConvenientService::Error
|
25
|
+
##
|
26
|
+
# @param config [ConvenientService::Core::Entities::Config]
|
27
|
+
# @return [void]
|
28
|
+
#
|
29
|
+
# @internal
|
30
|
+
# TODO: Create a troubleshooting page with possible reasons (preliminary RSpec mocks etc).
|
31
|
+
# Append a link to it to the error message.
|
32
|
+
#
|
33
|
+
def initialize(config:)
|
34
|
+
message = <<~TEXT
|
35
|
+
`#{config.klass}` config is committed too many times from `method_missing`.
|
36
|
+
|
37
|
+
In order to resolve this issue try to commit it manually before usage of any config-dependent method.
|
38
|
+
|
39
|
+
Example 1 (outside class):
|
40
|
+
|
41
|
+
# Commitment:
|
42
|
+
#{config.klass}.commit_config!
|
43
|
+
|
44
|
+
# Few lines later - usage:
|
45
|
+
#{config.klass}.result # or whatever method.
|
46
|
+
|
47
|
+
Example 2 (inside class):
|
48
|
+
|
49
|
+
class #{config.klass}
|
50
|
+
# ...
|
51
|
+
commit_config!
|
52
|
+
|
53
|
+
step :result # or any other method that becomes available after config commitment.
|
54
|
+
end
|
55
|
+
TEXT
|
56
|
+
|
57
|
+
super(message)
|
58
|
+
end
|
59
|
+
end
|
23
60
|
end
|
24
61
|
end
|
25
62
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative "config/commands"
|
3
4
|
require_relative "config/entities"
|
4
5
|
require_relative "config/errors"
|
5
6
|
|
@@ -57,13 +58,13 @@ module ConvenientService
|
|
57
58
|
# @overload middlewares(method)
|
58
59
|
# Returns all instance middlewares for particular method.
|
59
60
|
# @param method [Symbol] Method name.
|
60
|
-
# @return [Hash
|
61
|
+
# @return [Hash{Symbol => Hash{Symbol => ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares}}]
|
61
62
|
#
|
62
63
|
# @overload middlewares(method, scope:)
|
63
64
|
# Returns all scoped middlewares for particular method.
|
64
65
|
# @param method [Symbol] Method name.
|
65
66
|
# @param scope [:instance, :class]
|
66
|
-
# @return [Hash
|
67
|
+
# @return [Hash{Symbol => Hash{Symbol => ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares}}]
|
67
68
|
#
|
68
69
|
# @overload middlewares(method, &configuration_block)
|
69
70
|
# Configures instance middlewares for particular method.
|
@@ -105,6 +106,13 @@ module ConvenientService
|
|
105
106
|
@middlewares[scope][method] || Entities::MethodMiddlewares.new(scope: scope, method: method, klass: klass)
|
106
107
|
end
|
107
108
|
|
109
|
+
##
|
110
|
+
# @return [ConvenientService::Support::ThreadSafeCounter]
|
111
|
+
#
|
112
|
+
def method_missing_commits_counter
|
113
|
+
@method_missing_commits_counter ||= Support::ThreadSafeCounter.new(max_value: Constants::Commits::METHOD_MISSING_MAX_TRIES)
|
114
|
+
end
|
115
|
+
|
108
116
|
##
|
109
117
|
# @return [Boolean]
|
110
118
|
#
|
@@ -116,18 +124,20 @@ module ConvenientService
|
|
116
124
|
# Commits config when called for the first time.
|
117
125
|
# Does nothing for the subsequent calls.
|
118
126
|
#
|
127
|
+
# @param trigger [ConvenientService::Support::UniqueValue]
|
119
128
|
# @return [Boolean] true if called for the first time, false otherwise (similarly as Kernel#require).
|
120
129
|
#
|
121
130
|
# @see https://ruby-doc.org/core-3.1.2/Kernel.html#method-i-require
|
122
131
|
#
|
123
|
-
def commit!
|
132
|
+
def commit!(trigger: Constants::Triggers::USER)
|
124
133
|
concerns.include!
|
134
|
+
.tap { Commands::TrackMethodMissingCommitTrigger.call(config: self, trigger: trigger) }
|
125
135
|
end
|
126
136
|
|
127
137
|
private
|
128
138
|
|
129
139
|
##
|
130
|
-
# @note: Config is committed either by `commit_config` or `method_missing` from `ConvenientService::Core::ClassMethods`.
|
140
|
+
# @note: Config is committed either by `commit_config` or `method_missing` from `ConvenientService::Core::InstanceMethods` and `ConvenientService::Core::ClassMethods`.
|
131
141
|
#
|
132
142
|
# @return [void]
|
133
143
|
# @raise [ConvenientService::Core::Entities::Config::Errors::ConfigIsCommitted]
|
@@ -31,15 +31,17 @@ module ConvenientService
|
|
31
31
|
#
|
32
32
|
# @param method [Symbol]
|
33
33
|
# @param args [Array<Object>]
|
34
|
-
# @param kwargs [Hash
|
35
|
-
# @param block [Proc]
|
34
|
+
# @param kwargs [Hash{Symbol => Object}]
|
35
|
+
# @param block [Proc, nil]
|
36
36
|
# @return [void]
|
37
37
|
#
|
38
38
|
# @internal
|
39
|
-
# IMPORTANT: `method_missing`
|
39
|
+
# IMPORTANT: `method_missing` MUST be thread-safe.
|
40
|
+
#
|
41
|
+
# NOTE: `__send__` is used instead of `Support::SafeMethod` intentionally, since checking whether a method is defined is performed earlier by `Utils::Module.instance_method_defined?`.
|
40
42
|
#
|
41
43
|
def method_missing(method, *args, **kwargs, &block)
|
42
|
-
self.class.commit_config!
|
44
|
+
self.class.commit_config!(trigger: Constants::Triggers::INSTANCE_METHOD_MISSING)
|
43
45
|
|
44
46
|
return super unless Utils::Module.instance_method_defined?(self.class, method, private: true)
|
45
47
|
|
@@ -3,10 +3,26 @@
|
|
3
3
|
module ConvenientService
|
4
4
|
module Dependencies
|
5
5
|
module Extractions
|
6
|
+
##
|
7
|
+
# @internal
|
8
|
+
# NOTE:
|
9
|
+
# Copied from `rails/rails` with some logic modification.
|
10
|
+
# Version: v7.0.3.1.
|
11
|
+
# Wrapped in a namespace `ConvenientService::Dependencies::Extractions::ActiveSupportConcern`.
|
12
|
+
# Added `instance_methods` that works in a similar way as `class_methods`.
|
13
|
+
# Also `ClassMethods` (and `InstanceMethods`) are loaded after `included` block, not as in the original implementation.
|
14
|
+
#
|
15
|
+
# - https://github.com/marian13/rails/blob/v7.0.3.1/activesupport/lib/active_support/concern.rb
|
16
|
+
# - https://github.com/rails/rails/blob/v7.0.3.1/activesupport/lib/active_support/concern.rb
|
17
|
+
# - https://github.com/rails/rails
|
18
|
+
#
|
19
|
+
# NOTE: It is ok that `MultipleIncludedBlocks` and `MultiplePrependBlocks` inherit from `StandardError` since dependencies are on the lower layer.
|
20
|
+
#
|
21
|
+
# TODO: Move `Concern` to support? Rescue and reraise errors?
|
22
|
+
# - https://github.com/marian13/convenient_service/wiki/Design:-Communication-Graph
|
23
|
+
#
|
6
24
|
module ActiveSupportConcern
|
7
25
|
##
|
8
|
-
# https://github.com/marian13/rails/blob/v7.0.3.1/activesupport/lib/active_support/concern.rb
|
9
|
-
#
|
10
26
|
# A typical module looks like this:
|
11
27
|
#
|
12
28
|
# module M
|
@@ -13,4 +13,8 @@
|
|
13
13
|
# - https://github.com/rails/rails/blob/v7.0.3.1/activesupport/lib/active_support/concern.rb
|
14
14
|
# - https://github.com/rails/rails
|
15
15
|
#
|
16
|
+
# NOTE: It is ok that `MultipleIncludedBlocks` and `MultiplePrependBlocks` inherit from `StandardError` since dependencies are on the lower layer.
|
17
|
+
# TODO: Move `Concern` to support? Rescue and reraise errors?
|
18
|
+
# - https://github.com/marian13/convenient_service/wiki/Design:-Communication-Graph
|
19
|
+
#
|
16
20
|
require_relative "active_support_concern/concern"
|
@@ -5,7 +5,13 @@ module ConvenientService
|
|
5
5
|
module Extractions
|
6
6
|
module RubyMiddleware
|
7
7
|
##
|
8
|
-
#
|
8
|
+
# @internal
|
9
|
+
# NOTE:
|
10
|
+
# Copied from `Ibsciss/ruby-middleware` without any logic modification.
|
11
|
+
# Version: v0.4.2.
|
12
|
+
# - Wrapped in a namespace `ConvenientService::Dependencies::Extractions::RubyMiddleware`.
|
13
|
+
#
|
14
|
+
# - https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb
|
9
15
|
#
|
10
16
|
module Middleware
|
11
17
|
# This provides a DSL for building up a stack of middlewares.
|
@@ -6,7 +6,13 @@ module ConvenientService
|
|
6
6
|
module Extractions
|
7
7
|
module RubyMiddleware
|
8
8
|
##
|
9
|
-
#
|
9
|
+
# @internal
|
10
|
+
# NOTE:
|
11
|
+
# Copied from `Ibsciss/ruby-middleware` without any logic modification.
|
12
|
+
# Version: v0.4.2.
|
13
|
+
# - Wrapped in a namespace `ConvenientService::Dependencies::Extractions::RubyMiddleware`.
|
14
|
+
#
|
15
|
+
# - https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/logger.rb
|
10
16
|
#
|
11
17
|
module Middleware
|
12
18
|
|
@@ -3,7 +3,14 @@ module ConvenientService
|
|
3
3
|
module Extractions
|
4
4
|
module RubyMiddleware
|
5
5
|
##
|
6
|
-
#
|
6
|
+
# @internal
|
7
|
+
# NOTE:
|
8
|
+
# Copied from `Ibsciss/ruby-middleware` without any logic modification.
|
9
|
+
# Version: v0.4.2.
|
10
|
+
# - Wrapped in a namespace `ConvenientService::Dependencies::Extractions::RubyMiddleware`.
|
11
|
+
# - Added support of middleware creators.
|
12
|
+
#
|
13
|
+
# - https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/runner.rb
|
7
14
|
#
|
8
15
|
module Middleware
|
9
16
|
# This is a basic runner for middleware stacks. This runner does
|
@@ -60,6 +67,13 @@ module ConvenientService
|
|
60
67
|
# If the klass actually is a class, then instantiate it with
|
61
68
|
# the app and any other arguments given.
|
62
69
|
klass.new(next_middleware, *args, &block)
|
70
|
+
##
|
71
|
+
# IMPORTANT: Customization compared to the original `Runner` implementation.
|
72
|
+
#
|
73
|
+
# NOTE: Added support of middleware creators.
|
74
|
+
#
|
75
|
+
elsif klass.respond_to?(:new)
|
76
|
+
klass.new(next_middleware, *args, &block)
|
63
77
|
elsif klass.respond_to?(:call)
|
64
78
|
# Make it a lambda which calls the item then forwards up
|
65
79
|
# the chain.
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
##
|
4
4
|
# @internal
|
5
|
-
#
|
5
|
+
# NOTE:
|
6
|
+
# Copied from `Ibsciss/ruby-middleware` without any logic modification.
|
7
|
+
# Version: v0.4.2.
|
8
|
+
# - Wrapped in a namespace `ConvenientService::Dependencies::Extractions::RubyMiddleware`.
|
9
|
+
# - Replaced `require` into `require_relative`.
|
10
|
+
# - Added support of middleware creators.
|
11
|
+
#
|
12
|
+
# - https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware.rb
|
6
13
|
#
|
7
14
|
require_relative "middleware/builder"
|
8
15
|
require_relative "middleware/runner"
|
@@ -5,8 +5,9 @@
|
|
5
5
|
# NOTE:
|
6
6
|
# Copied from `Ibsciss/ruby-middleware` without any logic modification.
|
7
7
|
# Version: v0.4.2.
|
8
|
-
#
|
9
|
-
# Replaced `require` into `require_relative`.
|
8
|
+
# - Wrapped in a namespace `ConvenientService::Dependencies::Extractions::RubyMiddleware`.
|
9
|
+
# - Replaced `require` into `require_relative`.
|
10
|
+
# - Added support of middleware creators.
|
10
11
|
#
|
11
12
|
# - https://github.com/marian13/ruby-middleware/blob/v0.4.2
|
12
13
|
# - https://github.com/Ibsciss/ruby-middleware/blob/v0.4.2
|
@@ -87,15 +87,28 @@ module ConvenientService
|
|
87
87
|
# @return [Boolean]
|
88
88
|
# @note Expected to be called from `irb`, `pry`, `spec_helper.rb`, etc.
|
89
89
|
#
|
90
|
+
# @internal
|
91
|
+
# NOTE: `byebug` has C extensions, that is why it is NOT supported in JRuby.
|
92
|
+
# - https://github.com/deivid-rodriguez/byebug/tree/master/ext/byebug
|
93
|
+
# - https://github.com/deivid-rodriguez/byebug/issues/179#issuecomment-152727003
|
94
|
+
#
|
90
95
|
def require_development_tools
|
91
96
|
require "awesome_print"
|
92
|
-
require "byebug"
|
97
|
+
require "byebug" unless ruby.jruby?
|
93
98
|
require "paint"
|
94
99
|
require "rouge"
|
95
100
|
require "tempfile"
|
96
101
|
|
97
|
-
require_relative "dependencies/extractions/byebug_syntax_highlighting"
|
98
|
-
require_relative "dependencies/extractions/b"
|
102
|
+
require_relative "dependencies/extractions/byebug_syntax_highlighting" unless ruby.jruby?
|
103
|
+
require_relative "dependencies/extractions/b" unless ruby.jruby?
|
104
|
+
end
|
105
|
+
|
106
|
+
##
|
107
|
+
# @return [Boolean]
|
108
|
+
# @note Expected to be called from `spec_helper.rb`.
|
109
|
+
#
|
110
|
+
def require_test_tools
|
111
|
+
require "faker"
|
99
112
|
end
|
100
113
|
|
101
114
|
##
|
@@ -114,18 +127,6 @@ module ConvenientService
|
|
114
127
|
require_relative "rspec"
|
115
128
|
end
|
116
129
|
|
117
|
-
##
|
118
|
-
# Loads test factory.
|
119
|
-
#
|
120
|
-
# @return [Boolean]
|
121
|
-
# @note Expected to be called from `spec_helper.rb`.
|
122
|
-
#
|
123
|
-
def require_factory
|
124
|
-
require "faker"
|
125
|
-
|
126
|
-
require_relative "factory"
|
127
|
-
end
|
128
|
-
|
129
130
|
##
|
130
131
|
# Loads standard config examples.
|
131
132
|
#
|
@@ -14,10 +14,10 @@ module ConvenientService
|
|
14
14
|
module Examples
|
15
15
|
module Dry
|
16
16
|
module Gemfile
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
include ConvenientService::Feature
|
18
|
+
|
19
|
+
entry :format do |path|
|
20
|
+
Services::Format[path: path]
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -14,10 +14,10 @@ module ConvenientService
|
|
14
14
|
module Examples
|
15
15
|
module Rails
|
16
16
|
module Gemfile
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
include ConvenientService::Feature
|
18
|
+
|
19
|
+
entry :format do |path|
|
20
|
+
Services::Format[path: path]
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -13,10 +13,10 @@ module ConvenientService
|
|
13
13
|
module Examples
|
14
14
|
module Standard
|
15
15
|
module Cowsay
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
include ConvenientService::Feature
|
17
|
+
|
18
|
+
entry :print do |text = "Hello World!", out: $stdout|
|
19
|
+
Services::Print[text: text, out: out]
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -13,15 +13,6 @@ module ConvenientService
|
|
13
13
|
class AssertNodeAvailable
|
14
14
|
include ConvenientService::Standard::Config
|
15
15
|
|
16
|
-
##
|
17
|
-
# NOTE: `commit_config!` is used explicitly, since `step` method is NOT missed. It will be taken from `Turnip`.
|
18
|
-
# - https://github.com/jnicklas/turnip/blob/master/lib/turnip.rb#L29
|
19
|
-
# - https://github.com/jnicklas/turnip/blob/8272ef92902329d2d29bb5ba2b29cd431523478f/lib/turnip/define.rb#L3
|
20
|
-
#
|
21
|
-
# TODO: Troubleshooting guide.
|
22
|
-
#
|
23
|
-
commit_config!
|
24
|
-
|
25
16
|
##
|
26
17
|
# NOTE: `> /dev/null 2>&1` is used to hide output.
|
27
18
|
# https://unix.stackexchange.com/a/119650/394253
|
data/lib/convenient_service/examples/standard/gemfile/services/assert_npm_package_available.rb
CHANGED
@@ -13,16 +13,6 @@ module ConvenientService
|
|
13
13
|
class AssertNpmPackageAvailable
|
14
14
|
include ConvenientService::Standard::Config
|
15
15
|
|
16
|
-
##
|
17
|
-
# IMPORTANT:
|
18
|
-
# - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`.
|
19
|
-
# - It will be reenabled after the introduction of thread-safety specs.
|
20
|
-
# - Do not use it in production yet.
|
21
|
-
#
|
22
|
-
middlewares :step, scope: :class do
|
23
|
-
use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware
|
24
|
-
end
|
25
|
-
|
26
16
|
attr_reader :name
|
27
17
|
|
28
18
|
step :validate_name
|
@@ -14,16 +14,6 @@ module ConvenientService
|
|
14
14
|
class Format
|
15
15
|
include ConvenientService::Standard::Config
|
16
16
|
|
17
|
-
##
|
18
|
-
# IMPORTANT:
|
19
|
-
# - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`.
|
20
|
-
# - It will be reenabled after the introduction of thread-safety specs.
|
21
|
-
# - Do not use it in production yet.
|
22
|
-
#
|
23
|
-
middlewares :step, scope: :class do
|
24
|
-
use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware
|
25
|
-
end
|
26
|
-
|
27
17
|
attr_reader :path
|
28
18
|
|
29
19
|
step :validate_path,
|
@@ -8,16 +8,6 @@ module ConvenientService
|
|
8
8
|
class MergeSections
|
9
9
|
include ConvenientService::Standard::Config
|
10
10
|
|
11
|
-
##
|
12
|
-
# IMPORTANT:
|
13
|
-
# - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`.
|
14
|
-
# - It will be reenabled after the introduction of thread-safety specs.
|
15
|
-
# - Do not use it in production yet.
|
16
|
-
#
|
17
|
-
middlewares :step, scope: :class do
|
18
|
-
use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware
|
19
|
-
end
|
20
|
-
|
21
11
|
attr_reader :header, :body
|
22
12
|
|
23
13
|
step :validate_header,
|
@@ -40,16 +40,6 @@ module ConvenientService
|
|
40
40
|
|
41
41
|
include ConvenientService::Standard::Config
|
42
42
|
|
43
|
-
##
|
44
|
-
# IMPORTANT:
|
45
|
-
# - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`.
|
46
|
-
# - It will be reenabled after the introduction of thread-safety specs.
|
47
|
-
# - Do not use it in production yet.
|
48
|
-
#
|
49
|
-
middlewares :step, scope: :class do
|
50
|
-
use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware
|
51
|
-
end
|
52
|
-
|
53
43
|
attr_reader :content
|
54
44
|
|
55
45
|
step :validate_content
|
@@ -8,16 +8,6 @@ module ConvenientService
|
|
8
8
|
class ReadFileContent
|
9
9
|
include ConvenientService::Standard::Config
|
10
10
|
|
11
|
-
##
|
12
|
-
# IMPORTANT:
|
13
|
-
# - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`.
|
14
|
-
# - It will be reenabled after the introduction of thread-safety specs.
|
15
|
-
# - Do not use it in production yet.
|
16
|
-
#
|
17
|
-
middlewares :step, scope: :class do
|
18
|
-
use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware
|
19
|
-
end
|
20
|
-
|
21
11
|
attr_reader :path
|
22
12
|
|
23
13
|
step :validate_path
|
@@ -8,16 +8,6 @@ module ConvenientService
|
|
8
8
|
class ReplaceFileContent
|
9
9
|
include ConvenientService::Standard::Config
|
10
10
|
|
11
|
-
##
|
12
|
-
# IMPORTANT:
|
13
|
-
# - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`.
|
14
|
-
# - It will be reenabled after the introduction of thread-safety specs.
|
15
|
-
# - Do not use it in production yet.
|
16
|
-
#
|
17
|
-
middlewares :step, scope: :class do
|
18
|
-
use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware
|
19
|
-
end
|
20
|
-
|
21
11
|
attr_reader :path, :content
|
22
12
|
|
23
13
|
step :validate_path, in: :path
|
@@ -13,10 +13,10 @@ module ConvenientService
|
|
13
13
|
module Examples
|
14
14
|
module Standard
|
15
15
|
module Gemfile
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
include ConvenientService::Feature
|
17
|
+
|
18
|
+
entry :format do |path|
|
19
|
+
Services::Format[path: path]
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_body.rb
CHANGED
@@ -8,16 +8,6 @@ module ConvenientService
|
|
8
8
|
class ExtractParamsFromBody
|
9
9
|
include ConvenientService::Standard::Config
|
10
10
|
|
11
|
-
##
|
12
|
-
# IMPORTANT:
|
13
|
-
# - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`.
|
14
|
-
# - It will be reenabled after the introduction of thread-safety specs.
|
15
|
-
# - Do not use it in production yet.
|
16
|
-
#
|
17
|
-
middlewares :step, scope: :class do
|
18
|
-
use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware
|
19
|
-
end
|
20
|
-
|
21
11
|
attr_reader :request
|
22
12
|
|
23
13
|
step :parse_body, in: :request, out: :body
|