convenient_service 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/convenient_service/common/plugins/ensures_negated_j_send_result/middleware.rb +22 -0
- data/lib/convenient_service/common/plugins/ensures_negated_j_send_result.rb +3 -0
- data/lib/convenient_service/common/plugins/has_around_callbacks/concern.rb +8 -1
- data/lib/convenient_service/common/plugins/has_around_callbacks/middleware.rb +28 -7
- data/lib/convenient_service/common/plugins/has_callbacks/concern.rb +19 -9
- data/lib/convenient_service/common/plugins/has_callbacks/entities/callback_collection.rb +49 -1
- data/lib/convenient_service/common/plugins/has_callbacks/middleware.rb +21 -3
- data/lib/convenient_service/common/plugins/has_callbacks.rb +0 -1
- data/lib/convenient_service/common/plugins/has_instance_proxy/entities/instance_proxy.rb +1 -1
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins/has_cache/concern.rb +12 -0
- data/lib/convenient_service/common/plugins.rb +1 -0
- data/lib/convenient_service/core/entities/config/exceptions.rb +2 -0
- data/lib/convenient_service/core/entities/config.rb +3 -0
- data/lib/convenient_service/dependencies.rb +11 -3
- data/lib/convenient_service/logger.rb +9 -1
- data/lib/convenient_service/rspec/matchers/classes/call_chain_next.rb +41 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/commands/generate_printable_method.rb +46 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb +89 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb +223 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/outputs.rb +38 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb +157 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/apply_stub_to_track_delegations.rb +77 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb +94 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments.rb +89 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/base.rb +99 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/return_custom_value.rb +91 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/return_delegation_value.rb +129 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/with_any_arguments.rb +31 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/with_concrete_arguments.rb +31 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/without_arguments.rb +31 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers.rb +11 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities.rb +5 -1
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/exceptions.rb +65 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to.rb +163 -41
- data/lib/convenient_service/service/configs/minimal.rb +85 -33
- data/lib/convenient_service/service/configs/standard/v1.rb +42 -24
- data/lib/convenient_service/service/configs/standard.rb +60 -46
- data/lib/convenient_service/service/plugins/can_have_connected_steps/concern.rb +503 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb +133 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/base.rb +126 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/empty.rb +104 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/group.rb +118 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/not.rb +118 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/or.rb +145 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/scalar.rb +133 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions.rb +10 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/step_collection.rb +217 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities.rb +4 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/exceptions.rb +95 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/middleware.rb +30 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps.rb +6 -0
- data/lib/convenient_service/service/plugins/can_have_sequential_steps/concern.rb +76 -0
- data/lib/convenient_service/service/plugins/{can_have_steps → can_have_sequential_steps}/entities/step_collection.rb +54 -10
- data/lib/convenient_service/service/plugins/can_have_sequential_steps/entities.rb +3 -0
- data/lib/convenient_service/service/plugins/{can_have_steps → can_have_sequential_steps}/middleware.rb +7 -3
- data/lib/convenient_service/service/plugins/can_have_sequential_steps.rb +5 -0
- data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +4 -57
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb +45 -26
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment.rb +0 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/exceptions.rb +4 -24
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb +155 -80
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/exceptions.rb +19 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/{can_be_result_step → can_be_method_step}/can_be_executed/exceptions.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_executed/middleware.rb +64 -4
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_executed.rb +1 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/concern.rb +7 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_alternative_steps.rb +3 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/concern.rb +0 -46
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware.rb +26 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_parent_result/middleware.rb +13 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/{can_be_result_step → has_result}/concern.rb +8 -4
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_result/middleware.rb +33 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_result.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.rb +0 -1
- data/lib/convenient_service/service/plugins/can_have_steps.rb +0 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status/concern.rb +2 -2
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status.rb +0 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/concern/instance_methods.rb +135 -2
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/instance_methods.rb +45 -17
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/can_be_checked/concern.rb +38 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/can_be_checked/middleware.rb +51 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/can_be_checked.rb +4 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins.rb +1 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/exceptions.rb +15 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_negated_result/concern.rb +72 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_negated_result.rb +3 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/raises_on_not_checked_result_status/middleware.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins.rb +1 -0
- data/lib/convenient_service/service/plugins/has_j_send_result.rb +0 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_params_validations/using_dry_validation/middleware.rb +4 -0
- data/lib/convenient_service/service/plugins/has_negated_j_send_result/concern.rb +23 -0
- data/lib/convenient_service/service/plugins/has_negated_j_send_result.rb +3 -0
- data/lib/convenient_service/service/plugins/has_negated_result/concern.rb +33 -0
- data/lib/convenient_service/service/plugins/{has_j_send_result → has_negated_result}/exceptions.rb +3 -3
- data/lib/convenient_service/service/plugins/has_negated_result.rb +4 -0
- data/lib/convenient_service/service/plugins/{wraps_result_in_db_transaction → wraps_result_in_d_b_transaction}/middleware.rb +1 -1
- data/lib/convenient_service/service/plugins.rb +7 -2
- data/lib/convenient_service/specification.rb +28 -0
- data/lib/convenient_service/support/backtrace_cleaner.rb +6 -1
- data/lib/convenient_service/support/cache/entities/caches/base.rb +3 -0
- data/lib/convenient_service/support/method_parameters.rb +121 -0
- data/lib/convenient_service/support/never_reach_here.rb +21 -0
- data/lib/convenient_service/support/unique_value.rb +3 -0
- data/lib/convenient_service/support/value.rb +78 -0
- data/lib/convenient_service/support.rb +3 -0
- data/lib/convenient_service/utils/array/find_last.rb +8 -3
- data/lib/convenient_service/utils/object/instance_variable_delete.rb +1 -1
- data/lib/convenient_service/version.rb +1 -1
- data/lib/convenient_service.rb +23 -0
- metadata +109 -308
- data/.dev/.tmuxinator.yml +0 -22
- data/.dockerignore +0 -1
- data/.gem_release.yml +0 -11
- data/.github/contributing.md +0 -15
- data/.github/issue_template.md +0 -35
- data/.github/pull_request_template.md +0 -31
- data/.github/workflows/cd.yml +0 -68
- data/.github/workflows/ci.yml +0 -212
- data/.gitignore +0 -66
- data/.inch.yml +0 -7
- data/.rspec +0 -3
- data/.rubocop.yml +0 -45
- data/.rubocop_rspec.yml +0 -58
- data/.ruby-version +0 -1
- data/.tool-versions +0 -1
- data/.vscode/CacheItsValue.code-snippets +0 -15
- data/.vscode/DelegateTo.code-snippets +0 -15
- data/.vscode/cache_its_value.code-snippets +0 -17
- data/.vscode/comparison.code-snippets +0 -41
- data/.vscode/delegate_to.code-snippets +0 -20
- data/.yardopts +0 -16
- data/Appraisals +0 -146
- data/CHANGELOG.md +0 -504
- data/Gemfile +0 -17
- data/ROADMAP.md +0 -92
- data/Rakefile +0 -54
- data/Taskfile.yml +0 -679
- data/benchmark/commit_config/ips.rb +0 -18
- data/benchmark/commit_config/profile.rb +0 -30
- data/benchmark/empty_service/ips.rb +0 -123
- data/benchmark/has_committed_config/ips.rb +0 -78
- data/benchmark/has_committed_config/profile.rb +0 -30
- data/convenient_service.gemspec +0 -233
- data/coverage/.gitkeep +0 -0
- data/docker/2.7/Dockerfile +0 -73
- data/docker/3.0/Dockerfile +0 -73
- data/docker/3.1/Dockerfile +0 -73
- data/docker/3.2/Dockerfile +0 -73
- data/docker/jruby-9.4/Dockerfile +0 -88
- data/docker/truffleruby-22.3/Dockerfile +0 -91
- data/docs/.gitkeep +0 -0
- data/docs/api/.gitkeep +0 -0
- data/env.rb +0 -23
- data/gemfiles/.gitkeep +0 -0
- data/lib/convenient_service/common/plugins/has_callbacks/container.rb +0 -17
- data/lib/convenient_service/examples/dry/gemfile/dry_service/config.rb +0 -45
- data/lib/convenient_service/examples/dry/gemfile/dry_service.rb +0 -3
- data/lib/convenient_service/examples/dry/gemfile/services/assert_file_exists.rb +0 -29
- data/lib/convenient_service/examples/dry/gemfile/services/assert_file_not_empty.rb +0 -29
- data/lib/convenient_service/examples/dry/gemfile/services/assert_node_available.rb +0 -26
- data/lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb +0 -39
- data/lib/convenient_service/examples/dry/gemfile/services/assert_valid_ruby_syntax.rb +0 -41
- data/lib/convenient_service/examples/dry/gemfile/services/format.rb +0 -37
- data/lib/convenient_service/examples/dry/gemfile/services/format_body.rb +0 -93
- data/lib/convenient_service/examples/dry/gemfile/services/format_gems_with_envs.rb +0 -96
- data/lib/convenient_service/examples/dry/gemfile/services/format_gems_without_envs.rb +0 -84
- data/lib/convenient_service/examples/dry/gemfile/services/format_header.rb +0 -74
- data/lib/convenient_service/examples/dry/gemfile/services/parse_content.rb +0 -93
- data/lib/convenient_service/examples/dry/gemfile/services/print_shell_command.rb +0 -44
- data/lib/convenient_service/examples/dry/gemfile/services/read_file_content.rb +0 -31
- data/lib/convenient_service/examples/dry/gemfile/services/run_shell_command.rb +0 -45
- data/lib/convenient_service/examples/dry/gemfile/services/strip_comments.rb +0 -109
- data/lib/convenient_service/examples/dry/gemfile/services.rb +0 -18
- data/lib/convenient_service/examples/dry/gemfile.rb +0 -27
- data/lib/convenient_service/examples/dry/v1/gemfile/dry_service/config.rb +0 -47
- data/lib/convenient_service/examples/dry/v1/gemfile/dry_service.rb +0 -3
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_file_exists.rb +0 -31
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_file_not_empty.rb +0 -31
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_node_available.rb +0 -28
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_npm_package_available.rb +0 -41
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_valid_ruby_syntax.rb +0 -43
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format.rb +0 -39
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_body.rb +0 -95
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_gems_with_envs.rb +0 -98
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_gems_without_envs.rb +0 -86
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_header.rb +0 -76
- data/lib/convenient_service/examples/dry/v1/gemfile/services/parse_content.rb +0 -95
- data/lib/convenient_service/examples/dry/v1/gemfile/services/read_file_content.rb +0 -33
- data/lib/convenient_service/examples/dry/v1/gemfile/services/run_shell_command.rb +0 -43
- data/lib/convenient_service/examples/dry/v1/gemfile/services/strip_comments.rb +0 -111
- data/lib/convenient_service/examples/dry/v1/gemfile/services.rb +0 -17
- data/lib/convenient_service/examples/dry/v1/gemfile.rb +0 -29
- data/lib/convenient_service/examples/rails/gemfile/rails_service/config.rb +0 -56
- data/lib/convenient_service/examples/rails/gemfile/rails_service.rb +0 -3
- data/lib/convenient_service/examples/rails/gemfile/services/assert_file_exists.rb +0 -25
- data/lib/convenient_service/examples/rails/gemfile/services/assert_file_not_empty.rb +0 -25
- data/lib/convenient_service/examples/rails/gemfile/services/assert_node_available.rb +0 -26
- data/lib/convenient_service/examples/rails/gemfile/services/assert_npm_package_available.rb +0 -35
- data/lib/convenient_service/examples/rails/gemfile/services/assert_valid_ruby_syntax.rb +0 -35
- data/lib/convenient_service/examples/rails/gemfile/services/format.rb +0 -66
- data/lib/convenient_service/examples/rails/gemfile/services/format_body.rb +0 -79
- data/lib/convenient_service/examples/rails/gemfile/services/format_gems_with_envs.rb +0 -82
- data/lib/convenient_service/examples/rails/gemfile/services/format_gems_without_envs.rb +0 -70
- data/lib/convenient_service/examples/rails/gemfile/services/format_header.rb +0 -68
- data/lib/convenient_service/examples/rails/gemfile/services/merge_sections.rb +0 -25
- data/lib/convenient_service/examples/rails/gemfile/services/parse_content.rb +0 -89
- data/lib/convenient_service/examples/rails/gemfile/services/print_shell_command.rb +0 -40
- data/lib/convenient_service/examples/rails/gemfile/services/read_file_content.rb +0 -27
- data/lib/convenient_service/examples/rails/gemfile/services/replace_file_content.rb +0 -37
- data/lib/convenient_service/examples/rails/gemfile/services/run_shell_command.rb +0 -40
- data/lib/convenient_service/examples/rails/gemfile/services/strip_comments.rb +0 -107
- data/lib/convenient_service/examples/rails/gemfile/services.rb +0 -21
- data/lib/convenient_service/examples/rails/gemfile.rb +0 -27
- data/lib/convenient_service/examples/rails/v1/gemfile/rails_service/config.rb +0 -58
- data/lib/convenient_service/examples/rails/v1/gemfile/rails_service.rb +0 -3
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_file_exists.rb +0 -27
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_file_not_empty.rb +0 -27
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_node_available.rb +0 -28
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_npm_package_available.rb +0 -37
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_valid_ruby_syntax.rb +0 -37
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format.rb +0 -68
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_body.rb +0 -81
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_gems_with_envs.rb +0 -84
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_gems_without_envs.rb +0 -72
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_header.rb +0 -70
- data/lib/convenient_service/examples/rails/v1/gemfile/services/merge_sections.rb +0 -27
- data/lib/convenient_service/examples/rails/v1/gemfile/services/parse_content.rb +0 -91
- data/lib/convenient_service/examples/rails/v1/gemfile/services/read_file_content.rb +0 -29
- data/lib/convenient_service/examples/rails/v1/gemfile/services/replace_file_content.rb +0 -39
- data/lib/convenient_service/examples/rails/v1/gemfile/services/run_shell_command.rb +0 -38
- data/lib/convenient_service/examples/rails/v1/gemfile/services/strip_comments.rb +0 -109
- data/lib/convenient_service/examples/rails/v1/gemfile/services.rb +0 -20
- data/lib/convenient_service/examples/rails/v1/gemfile.rb +0 -29
- data/lib/convenient_service/examples/standard/cowsay/services/build_cloud.rb +0 -42
- data/lib/convenient_service/examples/standard/cowsay/services/build_cow.rb +0 -38
- data/lib/convenient_service/examples/standard/cowsay/services/print.rb +0 -32
- data/lib/convenient_service/examples/standard/cowsay/services.rb +0 -5
- data/lib/convenient_service/examples/standard/cowsay.rb +0 -26
- data/lib/convenient_service/examples/standard/date_time/services/safe_parse.rb +0 -31
- data/lib/convenient_service/examples/standard/date_time/services.rb +0 -3
- data/lib/convenient_service/examples/standard/date_time.rb +0 -25
- data/lib/convenient_service/examples/standard/factorial/services/calculate.rb +0 -55
- data/lib/convenient_service/examples/standard/factorial/services.rb +0 -3
- data/lib/convenient_service/examples/standard/factorial/utils/timeout/with_timeout.rb +0 -50
- data/lib/convenient_service/examples/standard/factorial/utils/timeout.rb +0 -21
- data/lib/convenient_service/examples/standard/factorial/utils.rb +0 -3
- data/lib/convenient_service/examples/standard/factorial.rb +0 -26
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb +0 -30
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb +0 -30
- data/lib/convenient_service/examples/standard/gemfile/services/assert_node_available.rb +0 -26
- data/lib/convenient_service/examples/standard/gemfile/services/assert_npm_package_available.rb +0 -48
- data/lib/convenient_service/examples/standard/gemfile/services/assert_valid_ruby_syntax.rb +0 -39
- data/lib/convenient_service/examples/standard/gemfile/services/format.rb +0 -80
- data/lib/convenient_service/examples/standard/gemfile/services/format_body.rb +0 -83
- data/lib/convenient_service/examples/standard/gemfile/services/format_gems_with_envs.rb +0 -86
- data/lib/convenient_service/examples/standard/gemfile/services/format_gems_without_envs.rb +0 -74
- data/lib/convenient_service/examples/standard/gemfile/services/format_header.rb +0 -66
- data/lib/convenient_service/examples/standard/gemfile/services/merge_sections.rb +0 -52
- data/lib/convenient_service/examples/standard/gemfile/services/parse_content.rb +0 -101
- data/lib/convenient_service/examples/standard/gemfile/services/print_shell_command.rb +0 -45
- data/lib/convenient_service/examples/standard/gemfile/services/read_file_content.rb +0 -39
- data/lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb +0 -48
- data/lib/convenient_service/examples/standard/gemfile/services/run_shell_command.rb +0 -54
- data/lib/convenient_service/examples/standard/gemfile/services/strip_comments.rb +0 -111
- data/lib/convenient_service/examples/standard/gemfile/services.rb +0 -21
- data/lib/convenient_service/examples/standard/gemfile.rb +0 -26
- data/lib/convenient_service/examples/standard/request_params/constants.rb +0 -15
- data/lib/convenient_service/examples/standard/request_params/entities/description.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/entities/format.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/entities/id.rb +0 -47
- data/lib/convenient_service/examples/standard/request_params/entities/logger.rb +0 -21
- data/lib/convenient_service/examples/standard/request_params/entities/request.rb +0 -23
- data/lib/convenient_service/examples/standard/request_params/entities/source.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/entities/tag.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/entities/title.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/entities.rb +0 -11
- data/lib/convenient_service/examples/standard/request_params/services/apply_default_param_values.rb +0 -26
- data/lib/convenient_service/examples/standard/request_params/services/cast_params.rb +0 -38
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_body.rb +0 -70
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_path.rb +0 -62
- data/lib/convenient_service/examples/standard/request_params/services/filter_out_unpermitted_params.rb +0 -26
- data/lib/convenient_service/examples/standard/request_params/services/log_request_params.rb +0 -54
- data/lib/convenient_service/examples/standard/request_params/services/merge_params.rb +0 -26
- data/lib/convenient_service/examples/standard/request_params/services/prepare.rb +0 -65
- data/lib/convenient_service/examples/standard/request_params/services/validate_casted_params.rb +0 -94
- data/lib/convenient_service/examples/standard/request_params/services/validate_uncasted_params.rb +0 -72
- data/lib/convenient_service/examples/standard/request_params/services.rb +0 -13
- data/lib/convenient_service/examples/standard/request_params/utils/array/wrap.rb +0 -46
- data/lib/convenient_service/examples/standard/request_params/utils/array.rb +0 -21
- data/lib/convenient_service/examples/standard/request_params/utils/http/request/parse_body.rb +0 -42
- data/lib/convenient_service/examples/standard/request_params/utils/http/request/parse_path.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/utils/http/request.rb +0 -28
- data/lib/convenient_service/examples/standard/request_params/utils/http.rb +0 -3
- data/lib/convenient_service/examples/standard/request_params/utils/integer/safe_parse.rb +0 -31
- data/lib/convenient_service/examples/standard/request_params/utils/integer.rb +0 -25
- data/lib/convenient_service/examples/standard/request_params/utils/json/safe_parse.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/utils/json.rb +0 -21
- data/lib/convenient_service/examples/standard/request_params/utils/object/blank.rb +0 -34
- data/lib/convenient_service/examples/standard/request_params/utils/object/present.rb +0 -31
- data/lib/convenient_service/examples/standard/request_params/utils/object.rb +0 -26
- data/lib/convenient_service/examples/standard/request_params/utils/url/valid.rb +0 -47
- data/lib/convenient_service/examples/standard/request_params/utils/url.rb +0 -21
- data/lib/convenient_service/examples/standard/request_params/utils.rb +0 -8
- data/lib/convenient_service/examples/standard/request_params.rb +0 -49
- data/lib/convenient_service/examples/standard/v1/cowsay/services/build_cloud.rb +0 -44
- data/lib/convenient_service/examples/standard/v1/cowsay/services/build_cow.rb +0 -40
- data/lib/convenient_service/examples/standard/v1/cowsay/services/print.rb +0 -34
- data/lib/convenient_service/examples/standard/v1/cowsay/services.rb +0 -5
- data/lib/convenient_service/examples/standard/v1/cowsay.rb +0 -26
- data/lib/convenient_service/examples/standard/v1/date_time/services/safe_parse.rb +0 -33
- data/lib/convenient_service/examples/standard/v1/date_time/services.rb +0 -3
- data/lib/convenient_service/examples/standard/v1/date_time.rb +0 -25
- data/lib/convenient_service/examples/standard/v1/factorial/services/calculate.rb +0 -51
- data/lib/convenient_service/examples/standard/v1/factorial/services.rb +0 -3
- data/lib/convenient_service/examples/standard/v1/factorial/utils/timeout/with_timeout.rb +0 -52
- data/lib/convenient_service/examples/standard/v1/factorial/utils/timeout.rb +0 -23
- data/lib/convenient_service/examples/standard/v1/factorial/utils.rb +0 -3
- data/lib/convenient_service/examples/standard/v1/factorial.rb +0 -26
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_file_exists.rb +0 -32
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_file_not_empty.rb +0 -32
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_node_available.rb +0 -28
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_npm_package_available.rb +0 -50
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_valid_ruby_syntax.rb +0 -41
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format.rb +0 -82
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_body.rb +0 -85
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_gems_with_envs.rb +0 -88
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_gems_without_envs.rb +0 -76
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_header.rb +0 -68
- data/lib/convenient_service/examples/standard/v1/gemfile/services/merge_sections.rb +0 -54
- data/lib/convenient_service/examples/standard/v1/gemfile/services/parse_content.rb +0 -103
- data/lib/convenient_service/examples/standard/v1/gemfile/services/read_file_content.rb +0 -41
- data/lib/convenient_service/examples/standard/v1/gemfile/services/replace_file_content.rb +0 -50
- data/lib/convenient_service/examples/standard/v1/gemfile/services/run_shell_command.rb +0 -52
- data/lib/convenient_service/examples/standard/v1/gemfile/services/strip_comments.rb +0 -113
- data/lib/convenient_service/examples/standard/v1/gemfile/services.rb +0 -20
- data/lib/convenient_service/examples/standard/v1/gemfile.rb +0 -26
- data/lib/convenient_service/examples/standard/v1/request_params/constants.rb +0 -17
- data/lib/convenient_service/examples/standard/v1/request_params/entities/description.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/entities/format.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/entities/id.rb +0 -49
- data/lib/convenient_service/examples/standard/v1/request_params/entities/logger.rb +0 -23
- data/lib/convenient_service/examples/standard/v1/request_params/entities/request.rb +0 -25
- data/lib/convenient_service/examples/standard/v1/request_params/entities/source.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/entities/tag.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/entities/title.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/entities.rb +0 -11
- data/lib/convenient_service/examples/standard/v1/request_params/services/apply_default_param_values.rb +0 -28
- data/lib/convenient_service/examples/standard/v1/request_params/services/cast_params.rb +0 -40
- data/lib/convenient_service/examples/standard/v1/request_params/services/extract_params_from_body.rb +0 -72
- data/lib/convenient_service/examples/standard/v1/request_params/services/extract_params_from_path.rb +0 -64
- data/lib/convenient_service/examples/standard/v1/request_params/services/filter_out_unpermitted_params.rb +0 -28
- data/lib/convenient_service/examples/standard/v1/request_params/services/log_request_params.rb +0 -56
- data/lib/convenient_service/examples/standard/v1/request_params/services/merge_params.rb +0 -28
- data/lib/convenient_service/examples/standard/v1/request_params/services/prepare.rb +0 -67
- data/lib/convenient_service/examples/standard/v1/request_params/services/validate_casted_params.rb +0 -96
- data/lib/convenient_service/examples/standard/v1/request_params/services/validate_uncasted_params.rb +0 -74
- data/lib/convenient_service/examples/standard/v1/request_params/services.rb +0 -13
- data/lib/convenient_service/examples/standard/v1/request_params/utils/array/wrap.rb +0 -48
- data/lib/convenient_service/examples/standard/v1/request_params/utils/array.rb +0 -23
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request/parse_body.rb +0 -44
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request/parse_path.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request.rb +0 -30
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http.rb +0 -3
- data/lib/convenient_service/examples/standard/v1/request_params/utils/integer/safe_parse.rb +0 -33
- data/lib/convenient_service/examples/standard/v1/request_params/utils/integer.rb +0 -27
- data/lib/convenient_service/examples/standard/v1/request_params/utils/json/safe_parse.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/utils/json.rb +0 -23
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object/blank.rb +0 -36
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object/present.rb +0 -33
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object.rb +0 -28
- data/lib/convenient_service/examples/standard/v1/request_params/utils/url/valid.rb +0 -49
- data/lib/convenient_service/examples/standard/v1/request_params/utils/url.rb +0 -23
- data/lib/convenient_service/examples/standard/v1/request_params/utils.rb +0 -8
- data/lib/convenient_service/examples/standard/v1/request_params.rb +0 -49
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/commands/generate_printable_method.rb +0 -50
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands/apply_stub_to_track_delegations.rb +0 -82
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands/generate_printable_arguments.rb +0 -100
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments.rb +0 -95
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/base.rb +0 -87
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/return_its_value.rb +0 -132
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_any_arguments.rb +0 -37
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_concrete_arguments.rb +0 -37
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/without_arguments.rb +0 -37
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/values/base.rb +0 -41
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/values/with_calling_original.rb +0 -30
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/values/without_calling_original.rb +0 -30
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings.rb +0 -12
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings_collection/exceptions.rb +0 -57
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings_collection.rb +0 -171
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/delegation.rb +0 -79
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities.rb +0 -5
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher.rb +0 -276
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment/commands/define_method_in_container.rb +0 -74
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment/commands.rb +0 -3
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed/middleware.rb +0 -72
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed.rb +0 -4
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step.rb +0 -5
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status/middleware.rb +0 -43
- data/logo.png +0 -0
- data/minitest.rb +0 -30
- data/yard/yard-convenient_service_concern.rb +0 -45
- /data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/{entities/matcher/commands.rb → commands.rb} +0 -0
- /data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/{matcher/entities/chainings/sub_matchers → sub_matchers}/arguments/commands.rb +0 -0
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "convenient_service"
|
5
|
-
require "stackprof"
|
6
|
-
|
7
|
-
class Service
|
8
|
-
include ConvenientService::Standard::Config
|
9
|
-
end
|
10
|
-
|
11
|
-
Service.commit_config!
|
12
|
-
|
13
|
-
##
|
14
|
-
# Quotes:
|
15
|
-
# - stackprof will tell you what is impeding your progress.
|
16
|
-
# - The assumption is the more times something shows up in the sample the more time it is taking.
|
17
|
-
#
|
18
|
-
# Docs:
|
19
|
-
# - https://www.johnnunemaker.com/how-to-benchmark-your-ruby-gem
|
20
|
-
# - https://github.com/tmm1/stackprof
|
21
|
-
#
|
22
|
-
profile = StackProf.run(mode: :wall, interval: 1_000) do
|
23
|
-
2_000_000.times { Service.commit_config! }
|
24
|
-
end
|
25
|
-
|
26
|
-
result = StackProf::Report.new(profile)
|
27
|
-
puts
|
28
|
-
result.print_text
|
29
|
-
puts "\n\n\n"
|
30
|
-
result.print_method(/commit_config!/)
|
@@ -1,123 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "service_actor"
|
5
|
-
require "interactor"
|
6
|
-
require "trailblazer/operation"
|
7
|
-
require "active_interaction"
|
8
|
-
require "light-service"
|
9
|
-
require "mutations"
|
10
|
-
require "convenient_service"
|
11
|
-
require "benchmark/ips"
|
12
|
-
|
13
|
-
##
|
14
|
-
# Imaginary no gem service. Used as unattainable standard.
|
15
|
-
#
|
16
|
-
class NoGemService
|
17
|
-
Result = Struct.new(:success?, :data)
|
18
|
-
|
19
|
-
def self.result(**kwargs)
|
20
|
-
new(**kwargs).result
|
21
|
-
end
|
22
|
-
|
23
|
-
def result
|
24
|
-
Result.new
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def success(**kwargs)
|
30
|
-
Result.new(success?: true, data: kwargs)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
##
|
35
|
-
# ServiceActor - Composable Ruby service objects.
|
36
|
-
# - https://github.com/sunny/actor
|
37
|
-
#
|
38
|
-
class ActorService < Actor
|
39
|
-
def call
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
##
|
44
|
-
# Interactor - Interactor provides a common interface for performing complex user interactions.
|
45
|
-
# - https://github.com/collectiveidea/interactor
|
46
|
-
#
|
47
|
-
class InteractorService
|
48
|
-
include Interactor
|
49
|
-
|
50
|
-
def call
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
##
|
55
|
-
# Trailblazer-operation - Trailblazer's Operation implementation.
|
56
|
-
# - https://trailblazer.to/2.1/docs/operation.html#operation-overview
|
57
|
-
# - https://github.com/trailblazer/trailblazer-operation
|
58
|
-
#
|
59
|
-
class TrailblazerService < Trailblazer::Operation
|
60
|
-
step :result
|
61
|
-
|
62
|
-
def result(options, *)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
##
|
67
|
-
# ActiveInteraction - Manage application specific business logic.
|
68
|
-
# - https://github.com/AaronLasseigne/active_interaction
|
69
|
-
#
|
70
|
-
class ActiveInteractionService < ActiveInteraction::Base
|
71
|
-
def execute
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
##
|
76
|
-
# LightService - Series of Actions with an emphasis on simplicity.
|
77
|
-
# - https://github.com/adomokos/light-service
|
78
|
-
#
|
79
|
-
class LightServiceService
|
80
|
-
extend ::LightService::Action
|
81
|
-
|
82
|
-
executed do |context|
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
##
|
87
|
-
# Mutations - Compose your business logic into commands that sanitize and validate input.
|
88
|
-
# - https://github.com/cypriss/mutations
|
89
|
-
#
|
90
|
-
class MutationsService < Mutations::Command
|
91
|
-
def execute
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
##
|
96
|
-
# Convenient Service - Service object pattern implementation in Ruby.
|
97
|
-
# - https://github.com/marian13/convenient_service
|
98
|
-
#
|
99
|
-
class ConvenientServiceService
|
100
|
-
include ConvenientService::Standard::Config
|
101
|
-
|
102
|
-
def result
|
103
|
-
success
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
ConvenientServiceService.commit_config! # Warmup.
|
108
|
-
|
109
|
-
Benchmark.ips do |x|
|
110
|
-
x.time = 10 # Seconds.
|
111
|
-
x.warmup = 0 # No additional warmup required. It is already performed outside.
|
112
|
-
|
113
|
-
x.report("Empty service - Without any gem") { NoGemService.result }
|
114
|
-
x.report("Empty service - With Actor") { ActorService.call }
|
115
|
-
x.report("Empty service - With Interactor") { InteractorService.call }
|
116
|
-
x.report("Empty service - With Trailblazer Operation") { TrailblazerService.call }
|
117
|
-
x.report("Empty service - With ActiveInteraction") { ActiveInteractionService.run! }
|
118
|
-
x.report("Empty service - With LightService") { LightServiceService.execute }
|
119
|
-
x.report("Empty service - With Mutations") { MutationsService.run }
|
120
|
-
x.report("Empty service - With Convenient Service") { ConvenientServiceService.result }
|
121
|
-
|
122
|
-
x.compare!(order: :baseline)
|
123
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "convenient_service"
|
5
|
-
require "benchmark/ips"
|
6
|
-
|
7
|
-
##
|
8
|
-
# Introduction.
|
9
|
-
#
|
10
|
-
# This benchmark is checking `.has_committed_config?`. As a result, keep in mind that everything in this file should be reviewed in its context.
|
11
|
-
# For example, there is a class called `CurrentImplementation`. Actually, it is the `ImplementationWithoutMemoizationOfHasCommittedConfigInService`.
|
12
|
-
# Or `WithMemoizationInService` - means `ImplementationWithMemoizationOfHasCommittedConfigInService`, etc.
|
13
|
-
#
|
14
|
-
# For the current implementation source, see `ConvenientService::Core::Concern::ClassMethods#has_committed_config?`.
|
15
|
-
##
|
16
|
-
|
17
|
-
class CurrentImplementation
|
18
|
-
include ConvenientService::Standard::Config
|
19
|
-
end
|
20
|
-
|
21
|
-
class WithMemoizationInService
|
22
|
-
include ConvenientService::Standard::Config
|
23
|
-
|
24
|
-
class << self
|
25
|
-
def has_committed_config?
|
26
|
-
@__convenient_service_has_committed_config__ ||= super
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
##
|
32
|
-
# Warmup.
|
33
|
-
#
|
34
|
-
implementations = [CurrentImplementation, WithMemoizationInService]
|
35
|
-
|
36
|
-
implementations.each(&:commit_config!)
|
37
|
-
|
38
|
-
##
|
39
|
-
# Benchmarking of iterations per second.
|
40
|
-
#
|
41
|
-
Benchmark.ips do |x|
|
42
|
-
x.time = 5 # Seconds.
|
43
|
-
x.warmup = 0 # No additional warmup required. It is already performed outside.
|
44
|
-
|
45
|
-
x.report("`.has_committed_config?` - No memoization in service") { CurrentImplementation.has_committed_config? }
|
46
|
-
x.report("`.has_committed_config?` - Memoization in service") { WithMemoizationInService.has_committed_config? }
|
47
|
-
|
48
|
-
x.compare!(order: :baseline)
|
49
|
-
end
|
50
|
-
|
51
|
-
##
|
52
|
-
# Example result.
|
53
|
-
#
|
54
|
-
# Calculating -------------------------------------
|
55
|
-
# `.has_committed_config?` - No memoization in service
|
56
|
-
# 131.142k (± 8.9%) i/s - 220.039k in 1.777241s
|
57
|
-
# `.has_committed_config?` - Memoization in service
|
58
|
-
# 131.319k (±10.5%) i/s - 216.215k in 1.763880s
|
59
|
-
|
60
|
-
# Comparison:
|
61
|
-
# `.has_committed_config?` - No memoization in service: 131142.1 i/s
|
62
|
-
# `.has_committed_config?` - Memoization in service: 131319.1 i/s - same-ish: difference falls within error
|
63
|
-
##
|
64
|
-
|
65
|
-
##
|
66
|
-
# Summary.
|
67
|
-
#
|
68
|
-
# It is one of the Convenient Service design goals to NOT pollute the end-user public interface with extra private methods, instance variables, etc.
|
69
|
-
# Since memoization does NOT bring too big performance improvement, no extra instance variables are introduced.
|
70
|
-
##
|
71
|
-
|
72
|
-
##
|
73
|
-
# More info.
|
74
|
-
# - https://johnnunemaker.com/how-to-benchmark-your-ruby-gem
|
75
|
-
# - https://github.com/evanphx/benchmark-ips
|
76
|
-
# - https://rubydoc.info/gems/benchmark-ips/Benchmark/Compare
|
77
|
-
# - https://en.wikipedia.org/wiki/Standard_deviation
|
78
|
-
##
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "convenient_service"
|
5
|
-
require "stackprof"
|
6
|
-
|
7
|
-
class Service
|
8
|
-
include ConvenientService::Standard::Config
|
9
|
-
end
|
10
|
-
|
11
|
-
Service.commit_config!
|
12
|
-
|
13
|
-
##
|
14
|
-
# Quotes:
|
15
|
-
# - stackprof will tell you what is impeding your progress.
|
16
|
-
# - The assumption is the more times something shows up in the sample the more time it is taking.
|
17
|
-
#
|
18
|
-
# Docs:
|
19
|
-
# - https://www.johnnunemaker.com/how-to-benchmark-your-ruby-gem
|
20
|
-
# - https://github.com/tmm1/stackprof
|
21
|
-
#
|
22
|
-
profile = StackProf.run(mode: :wall, interval: 1_000) do
|
23
|
-
2_000_000.times { Service.has_committed_config? }
|
24
|
-
end
|
25
|
-
|
26
|
-
result = StackProf::Report.new(profile)
|
27
|
-
puts
|
28
|
-
result.print_text
|
29
|
-
puts "\n\n\n"
|
30
|
-
result.print_method(/has_committed_config?/)
|
data/convenient_service.gemspec
DELETED
@@ -1,233 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/convenient_service/specification"
|
4
|
-
require_relative "lib/convenient_service/version"
|
5
|
-
|
6
|
-
##
|
7
|
-
# NOTE:
|
8
|
-
# - Use `ConvenientService::Support::Ruby.jruby?` directly only in the files that do not require to load all dependencies.
|
9
|
-
# - Prefer `ConvenientService::Dependencies.ruby.jruby?` for the rest of the files.
|
10
|
-
#
|
11
|
-
require_relative "lib/convenient_service/support/ruby"
|
12
|
-
|
13
|
-
Gem::Specification.new do |spec|
|
14
|
-
spec.name = ConvenientService::Specification::NAME
|
15
|
-
spec.authors = ConvenientService::Specification::AUTHORS
|
16
|
-
spec.email = ConvenientService::Specification::EMAIL
|
17
|
-
spec.homepage = ConvenientService::Specification::HOMEPAGE
|
18
|
-
spec.summary = ConvenientService::Specification::SUMMARY
|
19
|
-
spec.description = ConvenientService::Specification::DESCRIPTION
|
20
|
-
|
21
|
-
spec.version = ConvenientService::VERSION
|
22
|
-
|
23
|
-
spec.license = "MIT"
|
24
|
-
|
25
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
26
|
-
|
27
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
28
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
29
|
-
spec.metadata["changelog_uri"] = "#{spec.homepage}/CHANGELOG.md"
|
30
|
-
|
31
|
-
# Specify which files should be added to the gem when it is released.
|
32
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
33
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
34
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
35
|
-
end
|
36
|
-
|
37
|
-
spec.require_paths = ["lib"]
|
38
|
-
|
39
|
-
##
|
40
|
-
# Used to run specs with multiple versions of gems.
|
41
|
-
# - https://github.com/thoughtbot/appraisal
|
42
|
-
#
|
43
|
-
spec.add_development_dependency "appraisal", "~> 2.5.0"
|
44
|
-
|
45
|
-
spec.add_development_dependency "awesome_print"
|
46
|
-
|
47
|
-
##
|
48
|
-
# Used for benchmarking (iteration per second). See `benchmark` directory.
|
49
|
-
# - https://github.com/evanphx/benchmark-ips
|
50
|
-
# - https://www.johnnunemaker.com/how-to-benchmark-your-ruby-gem
|
51
|
-
#
|
52
|
-
spec.add_development_dependency "benchmark-ips", "~> 2.12.0"
|
53
|
-
|
54
|
-
##
|
55
|
-
# Used for debugging any Ruby code (CRuby, JRuby, etc), since it written in plain Ruby.
|
56
|
-
# Has minimalistic interface.
|
57
|
-
# Does NOT support frame filtering.
|
58
|
-
# - https://github.com/gsamokovarov/break
|
59
|
-
#
|
60
|
-
spec.add_development_dependency "break"
|
61
|
-
|
62
|
-
##
|
63
|
-
# Used for debugging CRuby code.
|
64
|
-
# Check `debug` if you need frame filtering.
|
65
|
-
# Check `break` if you need to debug JRuby.
|
66
|
-
# - https://github.com/deivid-rodriguez/byebug
|
67
|
-
#
|
68
|
-
# NOTE: `byebug` has C extensions, that is why it is NOT supported in JRuby.
|
69
|
-
# - https://github.com/deivid-rodriguez/byebug/tree/master/ext/byebug
|
70
|
-
# - https://github.com/deivid-rodriguez/byebug/issues/179#issuecomment-152727003
|
71
|
-
#
|
72
|
-
spec.add_development_dependency "byebug", "~> 10.0" unless ConvenientService::Support::Ruby.jruby?
|
73
|
-
|
74
|
-
##
|
75
|
-
# Used for parsing Markdown in YARD docs.
|
76
|
-
# - https://github.com/gjtorikian/commonmarker
|
77
|
-
#
|
78
|
-
# NOTE: `commonmarker` has C extensions, that is why it is NOT supported in JRuby.
|
79
|
-
# - https://github.com/gjtorikian/commonmarker/tree/main/ext/commonmarker
|
80
|
-
#
|
81
|
-
# TODO: `commonmarker` v1 does NOT work with `yard-junk`.
|
82
|
-
#
|
83
|
-
spec.add_development_dependency "commonmarker", "~> 0.23.10" unless ConvenientService::Support::Ruby.jruby?
|
84
|
-
|
85
|
-
##
|
86
|
-
# Used for debugging CRuby code.
|
87
|
-
# Has almost the same public API as `byebug`, but supports frame filtering.
|
88
|
-
# Check `break` if you need to debug JRuby.
|
89
|
-
# - https://github.com/ruby/debug
|
90
|
-
# - https://st0012.dev/from-byebug-to-ruby-debug
|
91
|
-
# - https://st0012.dev/from-byebug-to-ruby-debug#heading-configuration
|
92
|
-
# - https://github.com/ruby/debug#configuration
|
93
|
-
# - ENV["RUBY_DEBUG_SKIP_PATH"]
|
94
|
-
#
|
95
|
-
# NOTE: `debug` has C extensions, that is why it is NOT supported in JRuby.
|
96
|
-
# - https://github.com/ruby/debug/tree/master/ext/debug
|
97
|
-
#
|
98
|
-
spec.add_development_dependency "debug" unless ConvenientService::Support::Ruby.jruby?
|
99
|
-
|
100
|
-
spec.add_development_dependency "faker"
|
101
|
-
|
102
|
-
spec.add_development_dependency "gem-release"
|
103
|
-
|
104
|
-
spec.add_development_dependency "inch"
|
105
|
-
|
106
|
-
spec.add_development_dependency "json"
|
107
|
-
|
108
|
-
##
|
109
|
-
# Used for memory profiling of Ruby code.
|
110
|
-
# - https://github.com/SamSaffron/memory_profiler
|
111
|
-
# - https://thoughtbot.com/blog/a-crash-course-in-analyzing-memory-usage-in-ruby
|
112
|
-
#
|
113
|
-
spec.add_development_dependency "memory_profiler"
|
114
|
-
|
115
|
-
##
|
116
|
-
# Used for testing Ruby code outside RSpec.
|
117
|
-
# - https://github.com/minitest/minitest
|
118
|
-
# - https://semaphoreci.com/community/tutorials/getting-started-with-minitest
|
119
|
-
# - https://cloudbees.com/blog/getting-started-with-minitest
|
120
|
-
#
|
121
|
-
spec.add_development_dependency "minitest", "~> 5.18.0"
|
122
|
-
|
123
|
-
##
|
124
|
-
# Used for mutation testing of Ruby code.
|
125
|
-
# - https://github.com/mbj/mutant
|
126
|
-
# - https://github.com/mbj/mutant/blob/main/docs/nomenclature.md
|
127
|
-
# - https://github.com/mbj/mutant/blob/main/docs/mutant-rspec.md
|
128
|
-
# - https://github.com/mbj/mutant/blob/main/docs/incremental.md
|
129
|
-
#
|
130
|
-
# NOTE: How to get a licence key?
|
131
|
-
# - https://github.com/mbj/mutant/issues/1396
|
132
|
-
#
|
133
|
-
if ::ENV["CONVENIENT_SERVICE_MUTANT_LICENCE_KEY"]
|
134
|
-
spec.add_development_dependency "mutant", "~> 0.11.21"
|
135
|
-
spec.add_development_dependency "mutant-rspec", "~> 0.11.21"
|
136
|
-
end
|
137
|
-
|
138
|
-
##
|
139
|
-
# Used for coloring logs.
|
140
|
-
# - https://github.com/janlelis/paint
|
141
|
-
#
|
142
|
-
spec.add_development_dependency "paint"
|
143
|
-
|
144
|
-
spec.add_development_dependency "progressbar"
|
145
|
-
|
146
|
-
spec.add_development_dependency "rake", "~> 12.0"
|
147
|
-
|
148
|
-
spec.add_development_dependency "rerun"
|
149
|
-
|
150
|
-
spec.add_development_dependency "rouge"
|
151
|
-
|
152
|
-
##
|
153
|
-
# Used for testing Ruby code.
|
154
|
-
# https://rspec.info
|
155
|
-
#
|
156
|
-
spec.add_development_dependency "rspec", "~> 3.11.0"
|
157
|
-
|
158
|
-
##
|
159
|
-
# Used for performance testing with RSpec.
|
160
|
-
# https://github.com/piotrmurach
|
161
|
-
#
|
162
|
-
spec.add_development_dependency "rspec-benchmark", "~> 0.6.0"
|
163
|
-
|
164
|
-
##
|
165
|
-
# Used for linting Ruby files.
|
166
|
-
# https://github.com/rubocop/rubocop
|
167
|
-
#
|
168
|
-
spec.add_development_dependency "rubocop", "~> 1.52.0"
|
169
|
-
|
170
|
-
##
|
171
|
-
# Used as a set of rules for rubocop for linting RSpec files.
|
172
|
-
# https://github.com/rubocop/rubocop-rspec
|
173
|
-
#
|
174
|
-
spec.add_development_dependency "rubocop-rspec", "~> 2.22.0"
|
175
|
-
|
176
|
-
spec.add_development_dependency "tty-prompt"
|
177
|
-
|
178
|
-
##
|
179
|
-
# Used as a set of rules for robocop for linting source files.
|
180
|
-
# https://github.com/testdouble/standard
|
181
|
-
#
|
182
|
-
spec.add_development_dependency "standard", "~> 1.30.1"
|
183
|
-
|
184
|
-
spec.add_development_dependency "simplecov"
|
185
|
-
|
186
|
-
spec.add_development_dependency "simplecov-lcov"
|
187
|
-
|
188
|
-
##
|
189
|
-
# Used to have a simplified public API of minitest.
|
190
|
-
# - https://github.com/thoughtbot/shoulda-context
|
191
|
-
#
|
192
|
-
spec.add_development_dependency "shoulda-context", "~> 2.0.0"
|
193
|
-
|
194
|
-
##
|
195
|
-
# Used for benchmarking (call-stack profiler). See `benchmark` directory.
|
196
|
-
# - https://github.com/tmm1/stackprof
|
197
|
-
# - https://www.johnnunemaker.com/how-to-benchmark-your-ruby-gem
|
198
|
-
#
|
199
|
-
spec.add_development_dependency "stackprof", "~> 0.2.25" unless ConvenientService::Support::Ruby.jruby?
|
200
|
-
|
201
|
-
spec.add_development_dependency "webrick"
|
202
|
-
|
203
|
-
##
|
204
|
-
# Used for generation of API docs for Ruby code.
|
205
|
-
# - https://github.com/lsegal/yard
|
206
|
-
# - https://yardoc.org
|
207
|
-
#
|
208
|
-
spec.add_development_dependency "yard", "~> 0.9.34"
|
209
|
-
|
210
|
-
##
|
211
|
-
# Used for linting YARD docs.
|
212
|
-
# - https://github.com/zverok/yard-junk
|
213
|
-
#
|
214
|
-
spec.add_development_dependency "yard-junk", "~> 0.0.9"
|
215
|
-
|
216
|
-
##
|
217
|
-
# The following gems are Convenient Service alternatives.
|
218
|
-
# Used for performance comparisons.
|
219
|
-
# See `benchmark/empty_service`.
|
220
|
-
# - https://github.com/sunny/actor
|
221
|
-
# - https://github.com/collectiveidea/interactor
|
222
|
-
# - https://github.com/trailblazer/trailblazer-operation
|
223
|
-
# - https://github.com/AaronLasseigne/active_interaction
|
224
|
-
# - https://github.com/adomokos/light-service
|
225
|
-
# - https://github.com/cypriss/mutations
|
226
|
-
#
|
227
|
-
spec.add_development_dependency "service_actor", "~> 3.7.0"
|
228
|
-
spec.add_development_dependency "interactor", "~> 3.1.2"
|
229
|
-
spec.add_development_dependency "trailblazer-operation", "~> 0.10.1"
|
230
|
-
spec.add_development_dependency "active_interaction", "~> 5.3.0"
|
231
|
-
spec.add_development_dependency "light-service", "~> 0.18.0"
|
232
|
-
spec.add_development_dependency "mutations", "~> 0.9.1"
|
233
|
-
end
|
data/coverage/.gitkeep
DELETED
File without changes
|
data/docker/2.7/Dockerfile
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Ruby 2.7 with Node.js 16.x.
|
3
|
-
#
|
4
|
-
# NOTE: Linted by hadolint.
|
5
|
-
#
|
6
|
-
# docker run --rm -i ghcr.io/hadolint/hadolint < docker/2.7/Dockerfile
|
7
|
-
#
|
8
|
-
# NOTE: A command to build image.
|
9
|
-
#
|
10
|
-
# cd convenient_service
|
11
|
-
# cp Gemfile Gemfile.2.7
|
12
|
-
# docker build . -f docker/2.7/Dockerfile -t convenient_service:2.7
|
13
|
-
# # or `task docker:build:ruby_2.7`
|
14
|
-
#
|
15
|
-
# NOTE: A command to run bash in container.
|
16
|
-
#
|
17
|
-
# cd convenient_service
|
18
|
-
# docker run --rm -it -v $(pwd):/gem convenient_service:2.7 bash
|
19
|
-
# # or `task docker:bash:ruby_2.7`
|
20
|
-
#
|
21
|
-
# NOTE: If there are no memory, performance, or cost constraints, prefer to use as standard Linux distribution as it is possible.
|
22
|
-
# In a general case, you simply won't have enough time to resolve all the "quirks" of more specific distributions if you are an application developer.
|
23
|
-
# That is why a `slim` version is used instead of `alpine`.
|
24
|
-
# Also `slim` is more similar to Ubuntu.
|
25
|
-
# - https://github.com/timbru31/docker-ruby-node/tree/master/2.7/16
|
26
|
-
# - https://medium.com/swlh/alpine-slim-stretch-buster-jessie-bullseye-bookworm-what-are-the-differences-in-docker-62171ed4531d
|
27
|
-
# - https://hub.docker.com/r/timbru31/ruby-node/tags
|
28
|
-
#
|
29
|
-
# NOTE: Gallium means Node.js 16.x.
|
30
|
-
# https://github.com/nodejs/Release
|
31
|
-
#
|
32
|
-
FROM timbru31/ruby-node:2.7-slim-gallium
|
33
|
-
|
34
|
-
##
|
35
|
-
# NOTE: `bundle install` dependencies.
|
36
|
-
#
|
37
|
-
RUN apt-get update -qq \
|
38
|
-
&& apt-get install --no-install-recommends -y git \
|
39
|
-
&& apt-get install --no-install-recommends -y make \
|
40
|
-
&& apt-get install --no-install-recommends -y gcc \
|
41
|
-
&& apt-get clean \
|
42
|
-
&& rm -rf /var/lib/apt/lists/*
|
43
|
-
|
44
|
-
RUN mkdir -p /gem
|
45
|
-
|
46
|
-
WORKDIR /gem
|
47
|
-
|
48
|
-
COPY . /gem
|
49
|
-
|
50
|
-
##
|
51
|
-
# NOTE: Every container has its own copy of `Gemfile`. This way a developer doesn't need to delete `Gemfile.lock` all the time when changing containers.
|
52
|
-
# - https://docs.docker.com/engine/reference/builder/#env
|
53
|
-
# - https://stackoverflow.com/questions/48863711/is-it-possible-to-override-gemfile-for-local-development
|
54
|
-
#
|
55
|
-
ENV BUNDLE_GEMFILE=Gemfile.2.7
|
56
|
-
|
57
|
-
RUN bundle install
|
58
|
-
|
59
|
-
RUN bundle exec appraisal install
|
60
|
-
|
61
|
-
##
|
62
|
-
# NOTE: Installs `task`.
|
63
|
-
# https://taskfile.dev/installation/#install-script
|
64
|
-
#
|
65
|
-
# NOTE: `task` is installed into `~/bin`. That is why `-b /bin` is used. See `echo ${PATH}` to debug.
|
66
|
-
#
|
67
|
-
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /bin
|
68
|
-
|
69
|
-
##
|
70
|
-
# NOTE: Is used to check whether a command is executed inside a Docker container. See Rakefile for examples.
|
71
|
-
# https://stackoverflow.com/a/65942222/12201472
|
72
|
-
#
|
73
|
-
ENV IN_DOCKER_CONTAINER=true
|
data/docker/3.0/Dockerfile
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Ruby 3.0 with Node.js 16.x.
|
3
|
-
#
|
4
|
-
# NOTE: Linted by hadolint.
|
5
|
-
#
|
6
|
-
# docker run --rm -i ghcr.io/hadolint/hadolint < docker/3.0/Dockerfile
|
7
|
-
#
|
8
|
-
# NOTE: A command to build image.
|
9
|
-
#
|
10
|
-
# cd convenient_service
|
11
|
-
# cp Gemfile Gemfile.3.0
|
12
|
-
# docker build . -f docker/3.0/Dockerfile -t convenient_service:3.0
|
13
|
-
# # or `task docker:build:ruby_3.0`
|
14
|
-
#
|
15
|
-
# NOTE: A command to run bash in container.
|
16
|
-
#
|
17
|
-
# cd convenient_service
|
18
|
-
# docker run --rm -it -v $(pwd):/gem convenient_service:3.0 bash
|
19
|
-
# # or `task docker:bash:ruby_3.0`
|
20
|
-
#
|
21
|
-
# NOTE: If there are no memory, performance, or cost constraints, prefer to use as standard Linux distribution as it is possible.
|
22
|
-
# In a general case, you simply won't have enough time to resolve all the "quirks" of more specific distributions if you are an application developer.
|
23
|
-
# That is why a `slim` version is used instead of `alpine`.
|
24
|
-
# Also `slim` is more similar to Ubuntu.
|
25
|
-
# - https://github.com/timbru31/docker-ruby-node/tree/master/3.0/16
|
26
|
-
# - https://medium.com/swlh/alpine-slim-stretch-buster-jessie-bullseye-bookworm-what-are-the-differences-in-docker-62171ed4531d
|
27
|
-
# - https://hub.docker.com/r/timbru31/ruby-node/tags
|
28
|
-
#
|
29
|
-
# NOTE: Gallium means Node.js 16.x.
|
30
|
-
# https://github.com/nodejs/Release
|
31
|
-
#
|
32
|
-
FROM timbru31/ruby-node:3.0-slim-gallium
|
33
|
-
|
34
|
-
##
|
35
|
-
# NOTE: `bundle install` dependencies.
|
36
|
-
#
|
37
|
-
RUN apt-get update -qq \
|
38
|
-
&& apt-get install --no-install-recommends -y git \
|
39
|
-
&& apt-get install --no-install-recommends -y make \
|
40
|
-
&& apt-get install --no-install-recommends -y gcc \
|
41
|
-
&& apt-get clean \
|
42
|
-
&& rm -rf /var/lib/apt/lists/*
|
43
|
-
|
44
|
-
RUN mkdir -p /gem
|
45
|
-
|
46
|
-
WORKDIR /gem
|
47
|
-
|
48
|
-
COPY . /gem
|
49
|
-
|
50
|
-
##
|
51
|
-
# NOTE: Every container has its own copy of `Gemfile`. This way a developer doesn't need to delete `Gemfile.lock` all the time when changing containers.
|
52
|
-
# - https://docs.docker.com/engine/reference/builder/#env
|
53
|
-
# - https://stackoverflow.com/questions/48863711/is-it-possible-to-override-gemfile-for-local-development
|
54
|
-
#
|
55
|
-
ENV BUNDLE_GEMFILE=Gemfile.3.0
|
56
|
-
|
57
|
-
RUN bundle install
|
58
|
-
|
59
|
-
RUN bundle exec appraisal install
|
60
|
-
|
61
|
-
##
|
62
|
-
# NOTE: Installs `task`.
|
63
|
-
# https://taskfile.dev/installation/#install-script
|
64
|
-
#
|
65
|
-
# NOTE: `task` is installed into `~/bin`. That is why `-b /bin` is used. See `echo ${PATH}` to debug.
|
66
|
-
#
|
67
|
-
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /bin
|
68
|
-
|
69
|
-
##
|
70
|
-
# NOTE: Is used to check whether a command is executed inside a Docker container. See Rakefile for examples.
|
71
|
-
# https://stackoverflow.com/a/65942222/12201472
|
72
|
-
#
|
73
|
-
ENV IN_DOCKER_CONTAINER=true
|