convenient_service 0.13.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -0
- data/.vscode/CacheItsValue.code-snippets +1 -1
- data/.yardopts +3 -0
- data/CHANGELOG.md +67 -0
- data/README.md +1 -1
- data/Taskfile.yml +14 -2
- data/lib/convenient_service/dependencies.rb +15 -12
- data/lib/convenient_service/examples/dry/gemfile/services/assert_file_exists.rb +1 -1
- data/lib/convenient_service/examples/dry/gemfile/services/assert_file_not_empty.rb +1 -1
- data/lib/convenient_service/examples/dry/gemfile/services/parse_content.rb +1 -1
- data/lib/convenient_service/examples/dry/gemfile/services/print_shell_command.rb +3 -3
- data/lib/convenient_service/examples/dry/gemfile/services/read_file_content.rb +1 -1
- data/lib/convenient_service/examples/dry/gemfile/services/run_shell_command.rb +1 -1
- data/lib/convenient_service/examples/dry/gemfile/services/strip_comments.rb +1 -1
- data/lib/convenient_service/examples/dry/gemfile.rb +1 -1
- data/lib/convenient_service/examples/dry/v1/gemfile/dry_service/config.rb +47 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/dry_service.rb +3 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_file_exists.rb +31 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_file_not_empty.rb +31 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_node_available.rb +28 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_npm_package_available.rb +41 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_valid_ruby_syntax.rb +43 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format.rb +39 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_body.rb +95 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_gems_with_envs.rb +98 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_gems_without_envs.rb +86 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_header.rb +76 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/parse_content.rb +95 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/read_file_content.rb +33 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/run_shell_command.rb +43 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/strip_comments.rb +111 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services.rb +17 -0
- data/lib/convenient_service/examples/dry/v1/gemfile.rb +27 -0
- data/lib/convenient_service/examples/rails/gemfile/services/assert_file_exists.rb +1 -1
- data/lib/convenient_service/examples/rails/gemfile/services/assert_file_not_empty.rb +1 -1
- data/lib/convenient_service/examples/rails/gemfile/services/parse_content.rb +1 -1
- data/lib/convenient_service/examples/rails/gemfile/services/print_shell_command.rb +3 -3
- data/lib/convenient_service/examples/rails/gemfile/services/read_file_content.rb +1 -1
- data/lib/convenient_service/examples/rails/gemfile/services/run_shell_command.rb +1 -1
- data/lib/convenient_service/examples/rails/gemfile/services/strip_comments.rb +1 -1
- data/lib/convenient_service/examples/rails/gemfile.rb +1 -1
- data/lib/convenient_service/examples/rails/v1/gemfile/rails_service/config.rb +58 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/rails_service.rb +3 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_file_exists.rb +27 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_file_not_empty.rb +27 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_node_available.rb +28 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_npm_package_available.rb +37 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_valid_ruby_syntax.rb +37 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format.rb +68 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_body.rb +81 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_gems_with_envs.rb +84 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_gems_without_envs.rb +72 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_header.rb +70 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/merge_sections.rb +27 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/parse_content.rb +91 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/read_file_content.rb +29 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/replace_file_content.rb +39 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/run_shell_command.rb +38 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/strip_comments.rb +109 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services.rb +20 -0
- data/lib/convenient_service/examples/rails/v1/gemfile.rb +27 -0
- data/lib/convenient_service/examples/standard/cowsay.rb +1 -1
- data/lib/convenient_service/examples/standard/date_time/services/safe_parse.rb +1 -1
- data/lib/convenient_service/examples/standard/date_time.rb +1 -1
- data/lib/convenient_service/examples/standard/factorial/services/calculate.rb +9 -3
- data/lib/convenient_service/examples/standard/factorial.rb +1 -1
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb +3 -3
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb +3 -3
- data/lib/convenient_service/examples/standard/gemfile/services/assert_npm_package_available.rb +2 -2
- data/lib/convenient_service/examples/standard/gemfile/services/format.rb +4 -4
- data/lib/convenient_service/examples/standard/gemfile/services/merge_sections.rb +4 -4
- data/lib/convenient_service/examples/standard/gemfile/services/parse_content.rb +3 -3
- data/lib/convenient_service/examples/standard/gemfile/services/print_shell_command.rb +4 -4
- data/lib/convenient_service/examples/standard/gemfile/services/read_file_content.rb +3 -3
- data/lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb +3 -3
- data/lib/convenient_service/examples/standard/gemfile/services/run_shell_command.rb +3 -3
- data/lib/convenient_service/examples/standard/gemfile/services/strip_comments.rb +1 -1
- data/lib/convenient_service/examples/standard/gemfile.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params.rb +1 -1
- data/lib/convenient_service/examples/standard/v1/cowsay/services/build_cloud.rb +44 -0
- data/lib/convenient_service/examples/standard/v1/cowsay/services/build_cow.rb +40 -0
- data/lib/convenient_service/examples/standard/v1/cowsay/services/print.rb +34 -0
- data/lib/convenient_service/examples/standard/v1/cowsay/services.rb +5 -0
- data/lib/convenient_service/examples/standard/v1/cowsay.rb +26 -0
- data/lib/convenient_service/examples/standard/v1/date_time/services/safe_parse.rb +33 -0
- data/lib/convenient_service/examples/standard/v1/date_time/services.rb +3 -0
- data/lib/convenient_service/examples/standard/v1/date_time.rb +25 -0
- data/lib/convenient_service/examples/standard/v1/factorial/services/calculate.rb +51 -0
- data/lib/convenient_service/examples/standard/v1/factorial/services.rb +3 -0
- data/lib/convenient_service/examples/standard/v1/factorial/utils/timeout/with_timeout.rb +52 -0
- data/lib/convenient_service/examples/standard/v1/factorial/utils/timeout.rb +23 -0
- data/lib/convenient_service/examples/standard/v1/factorial/utils.rb +3 -0
- data/lib/convenient_service/examples/standard/v1/factorial.rb +26 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_file_exists.rb +32 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_file_not_empty.rb +32 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_node_available.rb +28 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_npm_package_available.rb +50 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_valid_ruby_syntax.rb +41 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format.rb +82 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_body.rb +85 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_gems_with_envs.rb +88 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_gems_without_envs.rb +76 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_header.rb +68 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/merge_sections.rb +54 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/parse_content.rb +103 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/print_shell_command.rb +47 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/read_file_content.rb +41 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/replace_file_content.rb +50 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/run_shell_command.rb +52 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/strip_comments.rb +113 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services.rb +20 -0
- data/lib/convenient_service/examples/standard/v1/gemfile.rb +26 -0
- data/lib/convenient_service/examples/standard/v1/request_params/constants.rb +17 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/description.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/format.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/id.rb +49 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/logger.rb +23 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/request.rb +25 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/source.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/tag.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/title.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities.rb +11 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/apply_default_param_values.rb +28 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/cast_params.rb +40 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/extract_params_from_body.rb +72 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/extract_params_from_path.rb +64 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/filter_out_unpermitted_params.rb +28 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/log_request_params.rb +56 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/merge_params.rb +28 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/prepare.rb +67 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/validate_casted_params.rb +96 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/validate_uncasted_params.rb +74 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services.rb +13 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/array/wrap.rb +48 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/array.rb +23 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request/parse_body.rb +44 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request/parse_path.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request.rb +30 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http.rb +3 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/integer/safe_parse.rb +33 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/integer.rb +27 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/json/safe_parse.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/json.rb +23 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object/blank.rb +36 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object/present.rb +33 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object.rb +28 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/url/valid.rb +49 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/url.rb +23 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils.rb +8 -0
- data/lib/convenient_service/examples/standard/v1/request_params.rb +50 -0
- data/lib/convenient_service/feature/configs/aliases.rb +9 -0
- data/lib/convenient_service/feature/configs/standard.rb +22 -0
- data/lib/convenient_service/feature/configs.rb +5 -0
- data/lib/convenient_service/feature/plugins/aliases.rb +7 -0
- data/lib/convenient_service/feature/plugins/can_have_entries/commands/define_entry.rb +51 -0
- data/lib/convenient_service/feature/plugins/can_have_entries/commands.rb +3 -0
- data/lib/convenient_service/feature/plugins/can_have_entries/concern.rb +24 -0
- data/lib/convenient_service/feature/plugins/can_have_entries.rb +4 -0
- data/lib/convenient_service/feature/plugins.rb +5 -0
- data/lib/convenient_service/feature.rb +2 -9
- data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/constants.rb +1 -1
- data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/entities/result_spec.rb +8 -8
- data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/entities/stubbed_service.rb +6 -6
- data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service.rb +1 -1
- data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method/entities/wrapped_method.rb +6 -6
- data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method/exceptions.rb +1 -1
- data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method.rb +2 -2
- data/lib/convenient_service/rspec/helpers/classes.rb +4 -0
- data/lib/convenient_service/rspec/helpers/ignoring_exception.rb +1 -1
- data/lib/convenient_service/rspec/helpers/stub_service.rb +5 -5
- data/lib/convenient_service/rspec/helpers/wrap_method.rb +1 -1
- data/lib/convenient_service/rspec/helpers.rb +4 -6
- data/lib/convenient_service/rspec/matchers/call_chain_next.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/call_chain_next.rb +8 -8
- data/lib/convenient_service/rspec/matchers/{custom → classes}/export.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/constants.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/chain.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_code_part.rb +4 -4
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_data_part.rb +4 -4
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_message_part.rb +4 -4
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_parts.rb +3 -3
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_service_part.rb +4 -4
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_status_part.rb +4 -4
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_step_part.rb +4 -4
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_got_parts.rb +3 -3
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_got_service_part.rb +4 -4
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_got_step_part.rb +4 -4
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base.rb +4 -4
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/error/commands/generate_got_jsend_attributes_part.rb +19 -10
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/error.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/failure/commands/generate_got_jsend_attributes_part.rb +28 -20
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/failure.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/null.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/success/commands/generate_got_jsend_attributes_part.rb +41 -8
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/success.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers.rb +3 -3
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result.rb +4 -4
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_code.rb +5 -5
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_data.rb +5 -5
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_message.rb +5 -5
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_service.rb +5 -5
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_status.rb +5 -5
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_step.rb +6 -6
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_type.rb +5 -5
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator.rb +3 -3
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/exceptions.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base.rb +15 -15
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_error.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_failure.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_not_error.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_not_failure.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_not_success.rb +1 -1
- data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_success.rb +1 -1
- data/lib/convenient_service/rspec/matchers/classes.rb +5 -0
- data/lib/convenient_service/rspec/matchers/delegate_to.rb +1 -1
- data/lib/convenient_service/rspec/matchers/export.rb +1 -1
- data/lib/convenient_service/rspec/matchers/include_module.rb +1 -1
- data/lib/convenient_service/rspec/matchers/results/be_error.rb +1 -1
- data/lib/convenient_service/rspec/matchers/results/be_failure.rb +1 -1
- data/lib/convenient_service/rspec/matchers/results/be_not_error.rb +1 -1
- data/lib/convenient_service/rspec/matchers/results/be_not_failure.rb +1 -1
- data/lib/convenient_service/rspec/matchers/results/be_not_success.rb +1 -1
- data/lib/convenient_service/rspec/matchers/results/be_result.rb +31 -0
- data/lib/convenient_service/rspec/matchers/results/be_success.rb +1 -1
- data/lib/convenient_service/rspec/matchers/results.rb +4 -0
- data/lib/convenient_service/rspec/matchers.rb +6 -28
- data/lib/convenient_service/rspec/{helpers/custom → primitive_helpers/classes}/ignoring_exception/exceptions.rb +2 -2
- data/lib/convenient_service/rspec/{helpers/custom → primitive_helpers/classes}/ignoring_exception.rb +3 -3
- data/lib/convenient_service/rspec/{helpers/custom → primitive_helpers/classes}/in_threads.rb +2 -2
- data/lib/convenient_service/rspec/primitive_helpers/classes.rb +4 -0
- data/lib/convenient_service/rspec/primitive_helpers/ignoring_exception.rb +13 -0
- data/lib/convenient_service/rspec/{helpers → primitive_helpers}/in_threads.rb +2 -2
- data/lib/convenient_service/rspec/primitive_helpers.rb +19 -0
- data/lib/convenient_service/rspec/{matchers → primitive_matchers}/be_descendant_of.rb +2 -2
- data/lib/convenient_service/rspec/{matchers → primitive_matchers}/be_direct_descendant_of.rb +2 -2
- data/lib/convenient_service/rspec/{matchers → primitive_matchers}/cache_its_value.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/be_descendant_of.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/be_direct_descendant_of.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/cache_its_value.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/commands/generate_printable_method.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands/apply_stub_to_track_delegations.rb +4 -4
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands/generate_printable_arguments.rb +4 -4
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/base.rb +5 -5
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/return_its_value.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_any_arguments.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_concrete_arguments.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/without_arguments.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/values/base.rb +4 -4
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/values/with_calling_original.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/values/without_calling_original.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings_collection/exceptions.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings_collection.rb +13 -13
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/delegation.rb +3 -3
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher.rb +13 -13
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to.rb +13 -13
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/extend_module.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_abstract_method.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_alias_method.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_attr_accessor.rb +4 -4
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_attr_reader.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_attr_writer.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/include_module.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/prepend_module.rb +2 -2
- data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/singleton_prepend_module.rb +2 -2
- data/lib/convenient_service/rspec/primitive_matchers/classes.rb +15 -0
- data/lib/convenient_service/rspec/primitive_matchers/delegate_to.rb +13 -0
- data/lib/convenient_service/rspec/{matchers → primitive_matchers}/extend_module.rb +2 -2
- data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_abstract_method.rb +2 -2
- data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_alias_method.rb +2 -2
- data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_attr_accessor.rb +2 -2
- data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_attr_reader.rb +2 -2
- data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_attr_writer.rb +2 -2
- data/lib/convenient_service/rspec/primitive_matchers/include_module.rb +13 -0
- data/lib/convenient_service/rspec/{matchers → primitive_matchers}/prepend_module.rb +2 -2
- data/lib/convenient_service/rspec/{matchers → primitive_matchers}/singleton_prepend_module.rb +2 -2
- data/lib/convenient_service/rspec/primitive_matchers.rb +41 -0
- data/lib/convenient_service/rspec.rb +3 -0
- data/lib/convenient_service/{configs → service/configs}/aliases.rb +1 -1
- data/lib/convenient_service/{configs → service/configs}/awesome_print_inspect/aliases.rb +1 -1
- data/lib/convenient_service/service/configs/awesome_print_inspect.rb +61 -0
- data/lib/convenient_service/service/configs/minimal.rb +261 -0
- data/lib/convenient_service/service/configs/standard/aliases.rb +9 -0
- data/lib/convenient_service/service/configs/standard/v1.rb +185 -0
- data/lib/convenient_service/service/configs/standard.rb +238 -0
- data/lib/convenient_service/service/plugins/{can_have_fallback → can_have_fallbacks}/concern.rb +29 -17
- data/lib/convenient_service/service/plugins/{can_have_fallback → can_have_fallbacks}/exceptions.rb +7 -7
- data/lib/convenient_service/service/plugins/can_have_fallbacks/middleware.rb +36 -0
- data/lib/convenient_service/service/plugins/can_have_fallbacks.rb +5 -0
- data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +9 -3
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/concern.rb +97 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware.rb +74 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks.rb +4 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/exceptions.rb +32 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/middleware.rb +33 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value.rb +4 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb +2 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step_collection.rb +16 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/commands.rb +0 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb +10 -17
- data/lib/convenient_service/service/plugins/has_j_send_result/concern/instance_methods.rb +0 -9
- data/lib/convenient_service/service/plugins/has_j_send_result/constants.rb +4 -4
- data/lib/convenient_service/service/plugins/has_j_send_result/container.rb +8 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/{can_have_fallback → can_have_fallbacks}/concern.rb +16 -2
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_fallbacks.rb +3 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_awesome_print_inspect/concern.rb +3 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_inspect/concern.rb +9 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb +7 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/instance_methods.rb +7 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_params_validations/using_active_model_validations/middleware.rb +18 -7
- data/lib/convenient_service/service/plugins/has_j_send_result_params_validations/using_dry_validation/middleware.rb +26 -4
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/exceptions.rb +41 -0
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/middleware.rb +33 -6
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error.rb +0 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/exceptions.rb +67 -6
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/middleware.rb +36 -3
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure.rb +0 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/commands/refute_kwargs_contain_j_send_and_extra_keys.rb +67 -0
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/commands.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/exceptions.rb +15 -2
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/middleware.rb +8 -2
- data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/middleware.rb +11 -3
- data/lib/convenient_service/service/plugins.rb +1 -1
- data/lib/convenient_service/service.rb +1 -0
- data/lib/convenient_service/support/dependency_container/commands.rb +0 -1
- data/lib/convenient_service/support/dependency_container.rb +0 -1
- data/lib/convenient_service/version.rb +1 -1
- data/lib/convenient_service.rb +0 -1
- data/yard/yard-convenient_service_concern.rb +45 -0
- metadata +258 -133
- data/lib/convenient_service/configs/awesome_print_inspect.rb +0 -59
- data/lib/convenient_service/configs/minimal.rb +0 -257
- data/lib/convenient_service/configs/standard.rb +0 -208
- data/lib/convenient_service/rspec/helpers/custom.rb +0 -6
- data/lib/convenient_service/rspec/matchers/custom.rb +0 -18
- data/lib/convenient_service/service/plugins/can_have_fallback/middleware.rb +0 -30
- data/lib/convenient_service/service/plugins/can_have_fallback.rb +0 -5
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback/concern.rb +0 -53
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback/middleware.rb +0 -34
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback.rb +0 -4
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_fallback.rb +0 -3
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/commands/assert_args_count_lower_than_three.rb +0 -25
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/commands/assert_either_args_or_kwargs_are_passed.rb +0 -26
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/commands.rb +0 -4
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/commands/assert_kwargs_contain_only_j_send_keys.rb +0 -53
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/commands.rb +0 -3
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/commands/refute_kwargs_contain_data_and_extra_keys.rb +0 -29
- data/lib/convenient_service/support/dependency_container/commands/define_entry.rb +0 -49
- data/lib/convenient_service/support/dependency_container/entry.rb +0 -22
- /data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/entities.rb +0 -0
- /data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method/entities.rb +0 -0
- /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands.rb +0 -0
- /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/error/commands.rb +0 -0
- /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/failure/commands.rb +0 -0
- /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/success/commands.rb +0 -0
- /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands.rb +0 -0
- /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities.rb +0 -0
- /data/lib/convenient_service/rspec/matchers/{custom → classes}/results.rb +0 -0
- /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/commands.rb +0 -0
- /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands.rb +0 -0
- /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings.rb +0 -0
- /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities.rb +0 -0
- /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities.rb +0 -0
- /data/lib/convenient_service/{configs.rb → service/configs.rb} +0 -0
- /data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/{can_have_fallback → can_have_fallbacks}/result.rb +0 -0
@@ -1,257 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ConvenientService
|
4
|
-
module Configs
|
5
|
-
##
|
6
|
-
# Defines minimal configuration that adds a constructor, JSend-inspired result, steps, basic inspects, and internals to services.
|
7
|
-
#
|
8
|
-
# @note This config is NOT intented for the end-user usage. Use `Standard` instead.
|
9
|
-
#
|
10
|
-
# @note
|
11
|
-
# `use Plugins::Common::NormalizesEnv::Middleware` should be used in a config that has the first `concern` that introduces a method.
|
12
|
-
# For example, `:result` is added by `use Plugins::Service::HasJSendResult::Concern` in `Minimal`.
|
13
|
-
# That is why the following code is written in the `Minimal` config.
|
14
|
-
#
|
15
|
-
# middlewares :result do
|
16
|
-
# use Plugins::Common::NormalizesEnv::Middleware
|
17
|
-
#
|
18
|
-
# # ...
|
19
|
-
# end
|
20
|
-
#
|
21
|
-
# In turn, `:fallback_result` is added by `use Plugins::Service::CanHaveFallback::Concern` in `Standard`.
|
22
|
-
# That is why it is the responsibility of the `Standard` config, to define:
|
23
|
-
#
|
24
|
-
# middlewares :fallback_result do
|
25
|
-
# use Plugins::Common::NormalizesEnv::Middleware
|
26
|
-
#
|
27
|
-
# # ...
|
28
|
-
# end
|
29
|
-
#
|
30
|
-
# @internal
|
31
|
-
# NOTE: Heavily used in specs to test concerns and middlewares in isolation.
|
32
|
-
#
|
33
|
-
module Minimal
|
34
|
-
include Support::Concern
|
35
|
-
|
36
|
-
##
|
37
|
-
# @internal
|
38
|
-
# IMPORTANT: Order of plugins matters.
|
39
|
-
#
|
40
|
-
# NOTE: `class_exec` (that is used under the hood by `included`) defines `class Result` in the global namespace.
|
41
|
-
# That is why `class self::Result` is used.
|
42
|
-
# - https://stackoverflow.com/a/51965126/12201472
|
43
|
-
#
|
44
|
-
# rubocop:disable Lint/ConstantDefinitionInBlock
|
45
|
-
included do
|
46
|
-
include Core
|
47
|
-
|
48
|
-
concerns do
|
49
|
-
use Plugins::Common::HasInternals::Concern
|
50
|
-
|
51
|
-
use Plugins::Service::HasInspect::Concern
|
52
|
-
|
53
|
-
use Plugins::Common::HasConstructor::Concern
|
54
|
-
use Plugins::Common::HasConstructorWithoutInitialize::Concern
|
55
|
-
|
56
|
-
use Plugins::Service::HasResult::Concern
|
57
|
-
use Plugins::Service::HasJSendResult::Concern
|
58
|
-
use Plugins::Service::CanHaveSteps::Concern
|
59
|
-
end
|
60
|
-
|
61
|
-
middlewares :initialize do
|
62
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
63
|
-
end
|
64
|
-
|
65
|
-
middlewares :result do
|
66
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
67
|
-
use Plugins::Common::CachesReturnValue::Middleware
|
68
|
-
|
69
|
-
use Plugins::Service::RaisesOnNotResultReturnValue::Middleware
|
70
|
-
|
71
|
-
use Plugins::Service::CanHaveSteps::Middleware
|
72
|
-
end
|
73
|
-
|
74
|
-
middlewares :step do
|
75
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
76
|
-
end
|
77
|
-
|
78
|
-
middlewares :success do
|
79
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
80
|
-
end
|
81
|
-
|
82
|
-
middlewares :failure do
|
83
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
84
|
-
end
|
85
|
-
|
86
|
-
middlewares :error do
|
87
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
88
|
-
end
|
89
|
-
|
90
|
-
middlewares :result, scope: :class do
|
91
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
92
|
-
end
|
93
|
-
|
94
|
-
middlewares :step, scope: :class do
|
95
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
96
|
-
|
97
|
-
use Plugins::Service::CanHaveMethodSteps::Middleware
|
98
|
-
end
|
99
|
-
|
100
|
-
class self::Internals
|
101
|
-
include Core
|
102
|
-
|
103
|
-
concerns do
|
104
|
-
use Plugins::Internals::HasCache::Concern
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
class self::Result
|
109
|
-
include Core
|
110
|
-
|
111
|
-
concerns do
|
112
|
-
use Plugins::Common::HasInternals::Concern
|
113
|
-
|
114
|
-
use Plugins::Result::HasInspect::Concern
|
115
|
-
|
116
|
-
use Plugins::Common::HasConstructor::Concern
|
117
|
-
use Plugins::Common::HasConstructorWithoutInitialize::Concern
|
118
|
-
|
119
|
-
use Plugins::Result::HasJSendStatusAndAttributes::Concern
|
120
|
-
end
|
121
|
-
|
122
|
-
middlewares :initialize do
|
123
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
124
|
-
|
125
|
-
use Plugins::Result::HasJSendStatusAndAttributes::Middleware
|
126
|
-
end
|
127
|
-
|
128
|
-
middlewares :success? do
|
129
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
130
|
-
end
|
131
|
-
|
132
|
-
middlewares :failure? do
|
133
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
134
|
-
end
|
135
|
-
|
136
|
-
middlewares :error? do
|
137
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
138
|
-
end
|
139
|
-
|
140
|
-
middlewares :not_success? do
|
141
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
142
|
-
end
|
143
|
-
|
144
|
-
middlewares :not_failure? do
|
145
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
146
|
-
end
|
147
|
-
|
148
|
-
middlewares :not_error? do
|
149
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
150
|
-
end
|
151
|
-
|
152
|
-
middlewares :data do
|
153
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
154
|
-
end
|
155
|
-
|
156
|
-
middlewares :message do
|
157
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
158
|
-
end
|
159
|
-
|
160
|
-
middlewares :code do
|
161
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
162
|
-
end
|
163
|
-
|
164
|
-
middlewares :to_kwargs do
|
165
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
166
|
-
end
|
167
|
-
|
168
|
-
class self::Data
|
169
|
-
include Core
|
170
|
-
|
171
|
-
concerns do
|
172
|
-
use Plugins::Data::HasInspect::Concern
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
class self::Message
|
177
|
-
include Core
|
178
|
-
|
179
|
-
concerns do
|
180
|
-
use Plugins::Message::HasInspect::Concern
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
class self::Code
|
185
|
-
include Core
|
186
|
-
|
187
|
-
concerns do
|
188
|
-
use Plugins::Code::HasInspect::Concern
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
class self::Status
|
193
|
-
include Core
|
194
|
-
|
195
|
-
concerns do
|
196
|
-
use Plugins::Status::HasInspect::Concern
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
class self::Internals
|
201
|
-
include Core
|
202
|
-
|
203
|
-
concerns do
|
204
|
-
use Plugins::Internals::HasCache::Concern
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
class self::Step
|
210
|
-
include Core
|
211
|
-
|
212
|
-
concerns do
|
213
|
-
use Plugins::Common::HasInternals::Concern
|
214
|
-
|
215
|
-
use Plugins::Step::CanBeCompleted::Concern
|
216
|
-
|
217
|
-
use Plugins::Step::CanBeMethodStep::Concern
|
218
|
-
use Plugins::Step::CanBeResultStep::Concern
|
219
|
-
|
220
|
-
use Plugins::Step::HasInspect::Concern
|
221
|
-
end
|
222
|
-
|
223
|
-
middlewares :service_result do
|
224
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
225
|
-
use Plugins::Common::CachesReturnValue::Middleware
|
226
|
-
|
227
|
-
use Plugins::Step::CanBeResultStep::CanBeExecuted::Middleware
|
228
|
-
use Plugins::Step::CanBeMethodStep::CanBeExecuted::Middleware
|
229
|
-
end
|
230
|
-
|
231
|
-
middlewares :result do
|
232
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
233
|
-
use Plugins::Common::CachesReturnValue::Middleware
|
234
|
-
end
|
235
|
-
|
236
|
-
##
|
237
|
-
# TODO: Rename.
|
238
|
-
#
|
239
|
-
middlewares :printable_service do
|
240
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
241
|
-
|
242
|
-
use Plugins::Step::CanBeMethodStep::CanBePrinted::Middleware
|
243
|
-
end
|
244
|
-
|
245
|
-
class self::Internals
|
246
|
-
include Core
|
247
|
-
|
248
|
-
concerns do
|
249
|
-
use Plugins::Internals::HasCache::Concern
|
250
|
-
end
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
# rubocop:enable Lint/ConstantDefinitionInBlock
|
255
|
-
end
|
256
|
-
end
|
257
|
-
end
|
@@ -1,208 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ConvenientService
|
4
|
-
module Configs
|
5
|
-
##
|
6
|
-
# Default configuration for the user-defined services.
|
7
|
-
#
|
8
|
-
module Standard
|
9
|
-
include Support::Concern
|
10
|
-
|
11
|
-
##
|
12
|
-
# @internal
|
13
|
-
# IMPORTANT: Order of plugins matters.
|
14
|
-
#
|
15
|
-
# NOTE: `class_exec` (that is used under the hood by `included`) defines `class Result` in the global namespace.
|
16
|
-
# That is why `class self::Result` is used.
|
17
|
-
# - https://stackoverflow.com/a/51965126/12201472
|
18
|
-
#
|
19
|
-
# rubocop:disable Lint/ConstantDefinitionInBlock
|
20
|
-
included do
|
21
|
-
include Configs::Minimal
|
22
|
-
|
23
|
-
concerns do
|
24
|
-
use Plugins::Common::CachesConstructorArguments::Concern
|
25
|
-
use Plugins::Common::CanBeCopied::Concern
|
26
|
-
use Plugins::Service::CanRecalculateResult::Concern
|
27
|
-
use Plugins::Service::HasJSendResultShortSyntax::Concern
|
28
|
-
use Plugins::Service::HasJSendResultStatusCheckShortSyntax::Concern
|
29
|
-
|
30
|
-
use Plugins::Common::HasCallbacks::Concern
|
31
|
-
use Plugins::Common::HasAroundCallbacks::Concern
|
32
|
-
|
33
|
-
use Plugins::Service::CanHaveFallback::Concern
|
34
|
-
use Plugins::Service::HasMermaidFlowchart::Concern
|
35
|
-
end
|
36
|
-
|
37
|
-
middlewares :initialize do
|
38
|
-
use Plugins::Service::CollectsServicesInException::Middleware
|
39
|
-
use Plugins::Common::CachesConstructorArguments::Middleware
|
40
|
-
end
|
41
|
-
|
42
|
-
middlewares :result do
|
43
|
-
insert_after \
|
44
|
-
Plugins::Common::NormalizesEnv::Middleware,
|
45
|
-
Plugins::Service::CollectsServicesInException::Middleware
|
46
|
-
|
47
|
-
insert_before \
|
48
|
-
Plugins::Service::RaisesOnNotResultReturnValue::Middleware,
|
49
|
-
Plugins::Common::HasCallbacks::Middleware
|
50
|
-
|
51
|
-
insert_after \
|
52
|
-
Plugins::Common::HasCallbacks::Middleware,
|
53
|
-
Plugins::Common::HasAroundCallbacks::Middleware
|
54
|
-
|
55
|
-
##
|
56
|
-
# TODO: Rewrite. This plugin does NOT do what it states. Probably I was NOT with a clear mind while writing it (facepalm).
|
57
|
-
#
|
58
|
-
# use Plugins::Service::RaisesOnDoubleResult::Middleware
|
59
|
-
|
60
|
-
insert_before \
|
61
|
-
Plugins::Service::RaisesOnNotResultReturnValue::Middleware,
|
62
|
-
Plugins::Service::SetsParentToForeignResult::Middleware
|
63
|
-
end
|
64
|
-
|
65
|
-
##
|
66
|
-
# @internal
|
67
|
-
# NOTE: Check `Minimal` docs to understand why `use Plugins::Common::NormalizesEnv::Middleware` for `:fallback_result` is used in `Standard`, not in `Minimal` config.
|
68
|
-
#
|
69
|
-
middlewares :fallback_result do
|
70
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
71
|
-
use Plugins::Service::CollectsServicesInException::Middleware
|
72
|
-
use Plugins::Common::CachesReturnValue::Middleware
|
73
|
-
|
74
|
-
use Plugins::Service::RaisesOnNotResultReturnValue::Middleware
|
75
|
-
use Plugins::Service::CanHaveFallback::Middleware
|
76
|
-
end
|
77
|
-
|
78
|
-
middlewares :step do
|
79
|
-
use Plugins::Common::HasCallbacks::Middleware
|
80
|
-
use Plugins::Common::HasAroundCallbacks::Middleware
|
81
|
-
end
|
82
|
-
|
83
|
-
middlewares :success do
|
84
|
-
use Plugins::Service::HasJSendResultShortSyntax::Success::Middleware
|
85
|
-
end
|
86
|
-
|
87
|
-
middlewares :failure do
|
88
|
-
use Plugins::Service::HasJSendResultShortSyntax::Failure::Middleware
|
89
|
-
end
|
90
|
-
|
91
|
-
middlewares :error do
|
92
|
-
use Plugins::Service::HasJSendResultShortSyntax::Error::Middleware
|
93
|
-
end
|
94
|
-
|
95
|
-
class self::Result
|
96
|
-
concerns do
|
97
|
-
use Plugins::Common::HasJSendResultDuckShortSyntax::Concern
|
98
|
-
use Plugins::Result::CanRecalculateResult::Concern
|
99
|
-
|
100
|
-
use Plugins::Result::CanHaveStep::Concern
|
101
|
-
use Plugins::Result::CanBeOwnResult::Concern
|
102
|
-
use Plugins::Result::CanHaveFallback::Concern
|
103
|
-
use Plugins::Result::CanHaveParentResult::Concern
|
104
|
-
use Plugins::Result::CanHaveCheckedStatus::Concern
|
105
|
-
end
|
106
|
-
|
107
|
-
middlewares :success? do
|
108
|
-
use Plugins::Result::CanHaveCheckedStatus::Middleware
|
109
|
-
end
|
110
|
-
|
111
|
-
middlewares :failure? do
|
112
|
-
use Plugins::Result::CanHaveCheckedStatus::Middleware
|
113
|
-
end
|
114
|
-
|
115
|
-
middlewares :error? do
|
116
|
-
use Plugins::Result::CanHaveCheckedStatus::Middleware
|
117
|
-
end
|
118
|
-
|
119
|
-
middlewares :not_success? do
|
120
|
-
use Plugins::Result::CanHaveCheckedStatus::Middleware
|
121
|
-
end
|
122
|
-
|
123
|
-
middlewares :not_failure? do
|
124
|
-
use Plugins::Result::CanHaveCheckedStatus::Middleware
|
125
|
-
end
|
126
|
-
|
127
|
-
middlewares :not_error? do
|
128
|
-
use Plugins::Result::CanHaveCheckedStatus::Middleware
|
129
|
-
end
|
130
|
-
|
131
|
-
middlewares :data do
|
132
|
-
use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
|
133
|
-
end
|
134
|
-
|
135
|
-
middlewares :message do
|
136
|
-
use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
|
137
|
-
end
|
138
|
-
|
139
|
-
middlewares :code do
|
140
|
-
use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
class self::Step
|
145
|
-
concerns do
|
146
|
-
use Plugins::Common::HasJSendResultDuckShortSyntax::Concern
|
147
|
-
use Plugins::Step::CanHaveFallback::Concern
|
148
|
-
end
|
149
|
-
|
150
|
-
middlewares :result do
|
151
|
-
use Plugins::Step::CanHaveFallback::Middleware
|
152
|
-
use Plugins::Step::CanHaveParentResult::Middleware
|
153
|
-
end
|
154
|
-
|
155
|
-
middlewares :service_fallback_result do
|
156
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
157
|
-
use Plugins::Common::CachesReturnValue::Middleware
|
158
|
-
end
|
159
|
-
|
160
|
-
middlewares :fallback_result do
|
161
|
-
use Plugins::Common::NormalizesEnv::Middleware
|
162
|
-
use Plugins::Common::CachesReturnValue::Middleware
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
if Dependencies.rspec.loaded?
|
167
|
-
concerns do
|
168
|
-
insert_before 0, Plugins::Service::CanHaveStubbedResults::Concern
|
169
|
-
end
|
170
|
-
|
171
|
-
middlewares :result do
|
172
|
-
insert_after \
|
173
|
-
Plugins::Common::NormalizesEnv::Middleware,
|
174
|
-
Plugins::Service::CanHaveStubbedResults::Middleware
|
175
|
-
|
176
|
-
insert_before \
|
177
|
-
Plugins::Service::CanHaveStubbedResults::Middleware,
|
178
|
-
Plugins::Service::CountsStubbedResultsInvocations::Middleware
|
179
|
-
end
|
180
|
-
|
181
|
-
middlewares :result, scope: :class do
|
182
|
-
insert_after \
|
183
|
-
Plugins::Common::NormalizesEnv::Middleware,
|
184
|
-
Plugins::Service::CanHaveStubbedResults::Middleware
|
185
|
-
|
186
|
-
insert_before \
|
187
|
-
Plugins::Service::CanHaveStubbedResults::Middleware,
|
188
|
-
Plugins::Service::CountsStubbedResultsInvocations::Middleware
|
189
|
-
end
|
190
|
-
|
191
|
-
class self::Result
|
192
|
-
concerns do
|
193
|
-
use Plugins::Result::CanBeStubbedResult::Concern
|
194
|
-
use Plugins::Result::HasStubbedResultInvocationsCounter::Concern
|
195
|
-
end
|
196
|
-
|
197
|
-
middlewares :initialize do
|
198
|
-
insert_before \
|
199
|
-
Plugins::Result::HasJSendStatusAndAttributes::Middleware,
|
200
|
-
Plugins::Result::HasStubbedResultInvocationsCounter::Middleware
|
201
|
-
end
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
# rubocop:enable Lint/ConstantDefinitionInBlock
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "custom/be_descendant_of"
|
4
|
-
require_relative "custom/be_direct_descendant_of"
|
5
|
-
require_relative "custom/cache_its_value"
|
6
|
-
require_relative "custom/call_chain_next"
|
7
|
-
require_relative "custom/delegate_to"
|
8
|
-
require_relative "custom/export"
|
9
|
-
require_relative "custom/extend_module"
|
10
|
-
require_relative "custom/have_abstract_method"
|
11
|
-
require_relative "custom/have_alias_method"
|
12
|
-
require_relative "custom/have_attr_accessor"
|
13
|
-
require_relative "custom/have_attr_reader"
|
14
|
-
require_relative "custom/have_attr_writer"
|
15
|
-
require_relative "custom/include_module"
|
16
|
-
require_relative "custom/prepend_module"
|
17
|
-
require_relative "custom/results"
|
18
|
-
require_relative "custom/singleton_prepend_module"
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ConvenientService
|
4
|
-
module Service
|
5
|
-
module Plugins
|
6
|
-
module CanHaveFallback
|
7
|
-
class Middleware < MethodChainMiddleware
|
8
|
-
intended_for :fallback_result, entity: :service
|
9
|
-
|
10
|
-
##
|
11
|
-
# @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
|
12
|
-
#
|
13
|
-
# @note `fallback_result` is always successful, that is why its status is pre-checked.
|
14
|
-
#
|
15
|
-
# @internal
|
16
|
-
# NOTE: Copy is returned to have a fresh status.
|
17
|
-
#
|
18
|
-
def next(...)
|
19
|
-
fallback_result = chain.next(...)
|
20
|
-
|
21
|
-
raise Exceptions::ServiceFallbackReturnValueNotSuccess.new(service: entity, result: fallback_result) unless fallback_result.success?
|
22
|
-
|
23
|
-
fallback_result.copy(overrides: {kwargs: {fallback_result: true}})
|
24
|
-
.tap { |result| result.success? }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ConvenientService
|
4
|
-
module Service
|
5
|
-
module Plugins
|
6
|
-
module CanHaveSteps
|
7
|
-
module Entities
|
8
|
-
class Step
|
9
|
-
module Plugins
|
10
|
-
module CanHaveFallback
|
11
|
-
module Concern
|
12
|
-
include Support::Concern
|
13
|
-
|
14
|
-
instance_methods do
|
15
|
-
##
|
16
|
-
# @return [Bool]
|
17
|
-
#
|
18
|
-
def fallback_step?
|
19
|
-
Utils.to_bool(params.extra_kwargs[:fallback])
|
20
|
-
end
|
21
|
-
|
22
|
-
##
|
23
|
-
# @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
|
24
|
-
# @raise [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Exceptions::StepHasNoOrganizer]
|
25
|
-
#
|
26
|
-
# @note `service_fallback_result` has middlewares.
|
27
|
-
#
|
28
|
-
# @internal
|
29
|
-
# IMPORTANT: `service.klass.fallback_result(**input_values)` is the reason, why services should have only kwargs as arguments.
|
30
|
-
# TODO: Extract `StepDefinition`. This way `has_organizer?` check can be avoided completely.
|
31
|
-
#
|
32
|
-
def service_fallback_result
|
33
|
-
service.klass.fallback_result(**input_values)
|
34
|
-
end
|
35
|
-
|
36
|
-
##
|
37
|
-
# @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
|
38
|
-
# @raise [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Exceptions::StepHasNoOrganizer]
|
39
|
-
# @note `fallback_result` has middlewares.
|
40
|
-
#
|
41
|
-
def fallback_result
|
42
|
-
convert_to_step_result(service_fallback_result)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ConvenientService
|
4
|
-
module Service
|
5
|
-
module Plugins
|
6
|
-
module CanHaveSteps
|
7
|
-
module Entities
|
8
|
-
class Step
|
9
|
-
module Plugins
|
10
|
-
module CanHaveFallback
|
11
|
-
class Middleware < MethodChainMiddleware
|
12
|
-
intended_for :result, entity: :step
|
13
|
-
|
14
|
-
##
|
15
|
-
# @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
|
16
|
-
#
|
17
|
-
def next(...)
|
18
|
-
result = chain.next(...)
|
19
|
-
|
20
|
-
return result unless entity.fallback_step?
|
21
|
-
|
22
|
-
return result if result.success?(mark_status_as_checked: false)
|
23
|
-
|
24
|
-
entity.fallback_result(...)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ConvenientService
|
4
|
-
module Service
|
5
|
-
module Plugins
|
6
|
-
module HasJSendResultShortSyntax
|
7
|
-
module Error
|
8
|
-
module Commands
|
9
|
-
class AssertArgsCountLowerThanThree < Support::Command
|
10
|
-
attr_reader :args
|
11
|
-
|
12
|
-
def initialize(args:)
|
13
|
-
@args = args
|
14
|
-
end
|
15
|
-
|
16
|
-
def call
|
17
|
-
raise Exceptions::MoreThanTwoArgsArePassed.new if args.size > 2
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ConvenientService
|
4
|
-
module Service
|
5
|
-
module Plugins
|
6
|
-
module HasJSendResultShortSyntax
|
7
|
-
module Error
|
8
|
-
module Commands
|
9
|
-
class AssertEitherArgsOrKwargsArePassed < Support::Command
|
10
|
-
attr_reader :args, :kwargs
|
11
|
-
|
12
|
-
def initialize(args:, kwargs:)
|
13
|
-
@args = args
|
14
|
-
@kwargs = kwargs
|
15
|
-
end
|
16
|
-
|
17
|
-
def call
|
18
|
-
raise Exceptions::BothArgsAndKwargsArePassed.new if args.any? && kwargs.any?
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|