convenient_service 0.17.0 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -7
- data/lib/convenient_service/commands/is_service.rb +28 -0
- data/lib/convenient_service/commands/is_service_class.rb +30 -0
- data/lib/convenient_service/commands.rb +4 -0
- 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 +3 -3
- data/lib/convenient_service/core/concern/class_methods.rb +3 -0
- data/lib/convenient_service/core/entities/config/entities/concerns/entities/stack.rb +22 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/container/concern/instance_methods.rb +1 -1
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators/observable/entities/event.rb +13 -15
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/commands/normalize_env.rb +55 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/commands.rb +1 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/concern/instance_methods.rb +3 -3
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/classic.rb +14 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/stack.rb +22 -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/built_in.rb +0 -7
- data/lib/convenient_service/dependencies/extractions/ds.rb +45 -0
- data/lib/convenient_service/dependencies/only_queries.rb +29 -0
- data/lib/convenient_service/dependencies/queries/gems/active_model.rb +38 -0
- data/lib/convenient_service/dependencies/queries/gems/logger.rb +39 -0
- data/lib/convenient_service/dependencies/queries/gems/paint.rb +39 -0
- data/lib/convenient_service/dependencies/queries/gems/rspec.rb +60 -0
- data/lib/convenient_service/dependencies/queries/ruby.rb +103 -0
- data/lib/convenient_service/dependencies/queries/version/null_version.rb +87 -0
- data/lib/convenient_service/dependencies/queries/version.rb +87 -0
- data/lib/convenient_service/dependencies/queries.rb +536 -0
- data/lib/convenient_service/dependencies.rb +2 -430
- data/lib/convenient_service/feature/configs/standard.rb +0 -2
- 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/amazing_print_inspect/aliases.rb +7 -0
- data/lib/convenient_service/service/configs/amazing_print_inspect.rb +61 -0
- data/lib/convenient_service/service/configs/awesome_print_inspect.rb +1 -1
- data/lib/convenient_service/service/configs/{minimal.rb → essential.rb} +40 -93
- data/lib/convenient_service/service/configs/standard/v1.rb +47 -34
- data/lib/convenient_service/service/configs/standard.rb +70 -68
- data/lib/convenient_service/service/configs.rb +1 -1
- 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 +136 -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 +224 -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_fallbacks/concern.rb +18 -0
- data/lib/convenient_service/service/plugins/can_have_fallbacks/exceptions.rb +22 -4
- data/lib/convenient_service/service/plugins/can_have_fallbacks/middleware.rb +3 -3
- data/lib/convenient_service/service/plugins/can_have_rollbacks/middleware.rb +66 -0
- data/lib/convenient_service/service/plugins/can_have_rollbacks.rb +3 -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 +61 -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/commands/is_step.rb +34 -0
- data/lib/convenient_service/service/plugins/can_have_steps/commands.rb +1 -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 +166 -83
- 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 +52 -6
- 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/exceptions.rb +53 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware.rb +75 -6
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks.rb +1 -0
- 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/has_amazing_print_inspect/concern.rb +46 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_amazing_print_inspect.rb +3 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_awesome_print_inspect/concern.rb +3 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_result/concern.rb +34 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_result/middleware.rb +58 -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 +41 -1
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/fetch_all_services_stubbed_results_cache.rb +2 -2
- data/lib/convenient_service/service/plugins/forbids_convenient_service_entities_as_constructor_arguments/exceptions.rb +53 -0
- data/lib/convenient_service/service/plugins/forbids_convenient_service_entities_as_constructor_arguments/middleware.rb +108 -0
- data/lib/convenient_service/service/plugins/forbids_convenient_service_entities_as_constructor_arguments.rb +4 -0
- data/lib/convenient_service/service/plugins/has_amazing_print_inspect/concern.rb +39 -0
- data/lib/convenient_service/service/plugins/has_amazing_print_inspect.rb +3 -0
- data/lib/convenient_service/service/plugins/{can_have_steps/entities/step/plugins/can_be_result_step → has_j_send_result/entities/result/plugins/can_be_from_exception}/concern.rb +7 -5
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_exception.rb +3 -0
- 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/can_have_step/concern.rb +7 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_amazing_print_inspect/concern.rb +41 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_amazing_print_inspect.rb +3 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_awesome_print_inspect/concern.rb +2 -2
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/concern/instance_methods.rb +0 -7
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_amazing_print_inspect/concern.rb +46 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_amazing_print_inspect.rb +3 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_amazing_print_inspect/concern.rb +46 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_amazing_print_inspect.rb +3 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_amazing_print_inspect/concern.rb +46 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_amazing_print_inspect.rb +3 -0
- 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/has_amazing_print_inspect/concern.rb +46 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_amazing_print_inspect.rb +3 -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/helps_to_learn_similarities_with_common_objects/concern/instance_methods.rb +161 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/helps_to_learn_similarities_with_common_objects/concern.rb +27 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/helps_to_learn_similarities_with_common_objects/exceptions.rb +34 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/helps_to_learn_similarities_with_common_objects.rb +4 -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 +3 -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_mermaid_flowchart/concern.rb +6 -1
- 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/rescues_result_unhandled_exceptions/middleware.rb +1 -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 +10 -3
- 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/counter.rb +2 -0
- data/lib/convenient_service/support/method_parameters.rb +121 -0
- data/lib/convenient_service/support/middleware/stack_builder.rb +37 -0
- data/lib/convenient_service/support/never_reach_here.rb +21 -0
- data/lib/convenient_service/support/thread_safe_counter.rb +1 -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 -3
- data/lib/convenient_service/utils/array/find_last.rb +8 -3
- data/lib/convenient_service/utils/object/get_own_method.rb +54 -0
- data/lib/convenient_service/utils/object/instance_variable_delete.rb +1 -1
- data/lib/convenient_service/utils/object/safe_send.rb +84 -0
- data/lib/convenient_service/utils/object.rb +24 -0
- data/lib/convenient_service/utils/string/enclose.rb +52 -0
- data/lib/convenient_service/utils/string.rb +5 -0
- data/lib/convenient_service/version.rb +1 -1
- data/lib/convenient_service.rb +85 -0
- metadata +256 -322
- 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/common/plugins/normalizes_env/middleware.rb +0 -31
- data/lib/convenient_service/common/plugins/normalizes_env.rb +0 -3
- 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/can_have_steps/entities/step/plugins/can_have_fallbacks/result.rb +0 -3
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status/middleware.rb +0 -43
- data/lib/convenient_service/services.rb +0 -4
- data/lib/convenient_service/support/gems/active_model.rb +0 -36
- data/lib/convenient_service/support/gems/logger.rb +0 -37
- data/lib/convenient_service/support/gems/paint.rb +0 -37
- data/lib/convenient_service/support/gems/rspec.rb +0 -58
- data/lib/convenient_service/support/ruby.rb +0 -53
- data/lib/convenient_service/support/version/null_version.rb +0 -85
- data/lib/convenient_service/support/version.rb +0 -75
- data/logo.png +0 -0
- data/minitest.rb +0 -30
- data/yard/yard-convenient_service_concern.rb +0 -45
- /data/lib/convenient_service/{support → dependencies/queries}/gems.rb +0 -0
- /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
@@ -42,12 +42,12 @@ module ConvenientService
|
|
42
42
|
# @return [Object] Can be any type.
|
43
43
|
#
|
44
44
|
def call(env)
|
45
|
-
@__env__ = env
|
45
|
+
@__env__ = Commands::NormalizeEnv.call(env: env)
|
46
46
|
|
47
47
|
##
|
48
48
|
# IMPORTANT: This is a library code. Do NOT do things like this in your application code.
|
49
49
|
#
|
50
|
-
chain.instance_variable_set(:@env,
|
50
|
+
chain.instance_variable_set(:@env, @__env__)
|
51
51
|
|
52
52
|
##
|
53
53
|
# NOTE: `__send__` is used since `next` is ruby keyword.
|
@@ -55,7 +55,7 @@ module ConvenientService
|
|
55
55
|
#
|
56
56
|
# TODO: Enforce to always pass args, kwargs, block.
|
57
57
|
#
|
58
|
-
__send__(:next,
|
58
|
+
__send__(:next, *@__env__[:args], **@__env__[:kwargs], &@__env__[:block])
|
59
59
|
end
|
60
60
|
|
61
61
|
##
|
@@ -9,6 +9,20 @@ module ConvenientService
|
|
9
9
|
module Entities
|
10
10
|
module Middlewares
|
11
11
|
##
|
12
|
+
# Class `ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Classic` allows to define middlewares that interacts with `call` and `env` directly.
|
13
|
+
# For example `ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Chain::Commands::NormalizeEnv` was implemeted as middleware up to v0.18.
|
14
|
+
#
|
15
|
+
# class Middleware < MethodClassicMiddleware
|
16
|
+
# intended_for any_method, scope: any_scope, entity: any_entity
|
17
|
+
#
|
18
|
+
# def call(env = nil)
|
19
|
+
# env = env.to_h
|
20
|
+
# env = env.merge(args: env[:args].to_a, kwargs: env[:kwargs].to_h, block: env[:block])
|
21
|
+
#
|
22
|
+
# stack.call(env)
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
#
|
12
26
|
# @abstract Subclass and override `#call`.
|
13
27
|
#
|
14
28
|
# @internal
|
data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/stack.rb
CHANGED
@@ -49,6 +49,23 @@ module ConvenientService
|
|
49
49
|
plain_stack.call(env)
|
50
50
|
end
|
51
51
|
|
52
|
+
##
|
53
|
+
# @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
|
54
|
+
# @param args [Array<Object>]
|
55
|
+
# @param block [Proc, nil]
|
56
|
+
# @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
|
57
|
+
#
|
58
|
+
def unshift(middleware, *args, &block)
|
59
|
+
plain_stack.unshift(middleware, *args, &block)
|
60
|
+
|
61
|
+
self
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
|
66
|
+
#
|
67
|
+
alias_method :prepend, :unshift
|
68
|
+
|
52
69
|
##
|
53
70
|
# @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
|
54
71
|
# @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
|
@@ -140,6 +157,11 @@ module ConvenientService
|
|
140
157
|
self
|
141
158
|
end
|
142
159
|
|
160
|
+
##
|
161
|
+
# @return [ConvenientService::Core::Entities::Config::Entities::Concerns::Entities::Stack]
|
162
|
+
#
|
163
|
+
alias_method :remove, :delete
|
164
|
+
|
143
165
|
##
|
144
166
|
# @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
|
145
167
|
# @param args [Array<Object>]
|
@@ -30,6 +30,8 @@ module ConvenientService
|
|
30
30
|
# TODO: Create a troubleshooting page with possible reasons (preliminary RSpec mocks etc).
|
31
31
|
# Append a link to it to the error message.
|
32
32
|
#
|
33
|
+
# TODO: Add a note of the most common scenario when this issue appears - when the RSpec stub is used before auto config commitment. For example, with `delegate_to`.
|
34
|
+
#
|
33
35
|
def initialize_with_kwargs(config:)
|
34
36
|
message = <<~TEXT
|
35
37
|
`#{config.klass}` config is committed too many times from `method_missing`.
|
@@ -142,6 +142,9 @@ module ConvenientService
|
|
142
142
|
# @internal
|
143
143
|
# IMPORTANT: `commit!` MUST be thread safe.
|
144
144
|
#
|
145
|
+
# NOTE: Inspired by `Response#commit!` and others.
|
146
|
+
# - https://github.com/rails/rails/blob/36c1591bcb5e0ee3084759c7f42a706fe5bb7ca7/actionpack/lib/action_controller/metal/live.rb#L307
|
147
|
+
#
|
145
148
|
def commit!(trigger: Constants::Triggers::USER)
|
146
149
|
(committed? ? false : concerns.include!)
|
147
150
|
.tap { Commands::TrackMethodMissingCommitTrigger.call(config: self, trigger: trigger) }
|
@@ -28,13 +28,6 @@ require "erb"
|
|
28
28
|
#
|
29
29
|
require "logger"
|
30
30
|
|
31
|
-
##
|
32
|
-
# @internal
|
33
|
-
# - https://ruby-doc.org/stdlib-2.7.0/libdoc/observer/rdoc/Observable.html
|
34
|
-
# - https://github.com/ruby/observer
|
35
|
-
#
|
36
|
-
require "observer"
|
37
|
-
|
38
31
|
##
|
39
32
|
# @internal
|
40
33
|
# - https://ruby-doc.org/stdlib-2.7.0/libdoc/rubygems/rdoc/Gem/Version.html
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
# @api private
|
5
|
+
#
|
6
|
+
# Defines `ds` helper in order to have a quick way to find differences between strings like `git diff`.
|
7
|
+
#
|
8
|
+
# @param first_string [String]
|
9
|
+
# @param second_string [String]
|
10
|
+
# @return [nil]
|
11
|
+
#
|
12
|
+
# @note `ds' is a dev-only helper.
|
13
|
+
# @note `ds` is a short for `diff_strings`.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# first_string = <<~TEXT
|
17
|
+
# Step of `AnonymousClass(#14360)` is passed as constructor argument `kwargs[:baz]` to `AnonymousClass(#14360)`.
|
18
|
+
#
|
19
|
+
# It is an antipattern. It neglects the idea of steps.
|
20
|
+
#
|
21
|
+
# Please, try to reorganize `AnonymousClass(#14400)` service.
|
22
|
+
# TEXT
|
23
|
+
#
|
24
|
+
# second_string = <<~TEXT
|
25
|
+
# Step of `AnonymousClass(#14360)` is passed as constructor argument `kwargs[:baz]` to `AnonymousClass(#14400)`.
|
26
|
+
#
|
27
|
+
# It is an antipattern. It neglects the idea of steps.
|
28
|
+
#
|
29
|
+
# Please, try to reorganize `AnonymousClass(#14400)` service.
|
30
|
+
# TEXT
|
31
|
+
#
|
32
|
+
# ds(first_string, second_string)
|
33
|
+
# =>
|
34
|
+
# -Step of `AnonymousClass(#14360)` is passed as constructor argument `kwargs[:baz]` to `AnonymousClass(#14360)`.
|
35
|
+
# +Step of `AnonymousClass(#14360)` is passed as constructor argument `kwargs[:baz]` to `AnonymousClass(#14400)`.
|
36
|
+
#
|
37
|
+
# It is an antipattern. It neglects the idea of steps.
|
38
|
+
#
|
39
|
+
# Please, try to reorganize `AnonymousClass(#14400)` service.
|
40
|
+
#
|
41
|
+
def ds(first_string, second_string)
|
42
|
+
require "diffy"
|
43
|
+
|
44
|
+
puts ::Diffy::Diff.new(first_string, second_string).to_s(:color)
|
45
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
# @internal
|
5
|
+
# - https://ruby-doc.org/stdlib-2.7.0/libdoc/rubygems/rdoc/Gem/Version.html
|
6
|
+
# - https://github.com/rubygems/rubygems
|
7
|
+
# - https://github.com/rubygems/rubygems/blob/master/lib/rubygems/version.rb
|
8
|
+
#
|
9
|
+
require "rubygems"
|
10
|
+
|
11
|
+
##
|
12
|
+
# This file load extracted dependencies.
|
13
|
+
#
|
14
|
+
# @internal
|
15
|
+
# https://github.com/marian13/convenient_service/wiki/Docs:-Dependencies
|
16
|
+
#
|
17
|
+
require_relative "queries"
|
18
|
+
|
19
|
+
##
|
20
|
+
# `ConvenientService::Dependencies` can dynamically require plugins/extensions that have external dependencies.
|
21
|
+
#
|
22
|
+
# @internal
|
23
|
+
# https://github.com/marian13/convenient_service/wiki/Docs:-Dependencies
|
24
|
+
#
|
25
|
+
module ConvenientService
|
26
|
+
module Dependencies
|
27
|
+
extend Queries
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Dependencies
|
5
|
+
module Queries
|
6
|
+
module Gems
|
7
|
+
##
|
8
|
+
# @api private
|
9
|
+
#
|
10
|
+
class ActiveModel
|
11
|
+
class << self
|
12
|
+
##
|
13
|
+
# @return [Boolean]
|
14
|
+
#
|
15
|
+
# @internal
|
16
|
+
# `Style/TernaryParentheses` is disabled since `defined?` has too low priority without parentheses.
|
17
|
+
#
|
18
|
+
# rubocop:disable Style/TernaryParentheses
|
19
|
+
def loaded?
|
20
|
+
(defined? ::ActiveModel) ? true : false
|
21
|
+
end
|
22
|
+
# rubocop:enable Style/TernaryParentheses
|
23
|
+
|
24
|
+
##
|
25
|
+
# @return [ConvenientService::Dependencies::Queries::Version]
|
26
|
+
#
|
27
|
+
# @internal
|
28
|
+
# https://github.com/rails/rails/blob/main/activemodel/lib/active_model/version.rb
|
29
|
+
#
|
30
|
+
def version
|
31
|
+
loaded? ? Version.new(::ActiveModel.version) : Version.null_version
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Dependencies
|
5
|
+
module Queries
|
6
|
+
module Gems
|
7
|
+
class Logger
|
8
|
+
class << self
|
9
|
+
##
|
10
|
+
# @api private
|
11
|
+
#
|
12
|
+
# @return [Boolean]
|
13
|
+
#
|
14
|
+
# @internal
|
15
|
+
# `Style/TernaryParentheses` is disabled since `defined?` has too low priority without parentheses.
|
16
|
+
#
|
17
|
+
# rubocop:disable Style/TernaryParentheses
|
18
|
+
def loaded?
|
19
|
+
(defined? ::Logger) ? true : false
|
20
|
+
end
|
21
|
+
# rubocop:enable Style/TernaryParentheses
|
22
|
+
|
23
|
+
##
|
24
|
+
# @api private
|
25
|
+
#
|
26
|
+
# @return [ConvenientService::Dependencies::Queries::Version]
|
27
|
+
#
|
28
|
+
# @internal
|
29
|
+
# - https://github.com/ruby/logger/blob/v1.5.3/lib/logger/version.rb
|
30
|
+
#
|
31
|
+
def version
|
32
|
+
loaded? ? Version.new(::Logger::VERSION) : Version.null_version
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Dependencies
|
5
|
+
module Queries
|
6
|
+
module Gems
|
7
|
+
class Paint
|
8
|
+
class << self
|
9
|
+
##
|
10
|
+
# @api private
|
11
|
+
#
|
12
|
+
# @return [Boolean]
|
13
|
+
#
|
14
|
+
# @internal
|
15
|
+
# `Style/TernaryParentheses` is disabled since `defined?` has too low priority without parentheses.
|
16
|
+
#
|
17
|
+
# rubocop:disable Style/TernaryParentheses
|
18
|
+
def loaded?
|
19
|
+
(defined? ::Paint) ? true : false
|
20
|
+
end
|
21
|
+
# rubocop:enable Style/TernaryParentheses
|
22
|
+
|
23
|
+
##
|
24
|
+
# @api private
|
25
|
+
#
|
26
|
+
# @return [ConvenientService::Dependencies::Queries::Version]
|
27
|
+
#
|
28
|
+
# @internal
|
29
|
+
# - https://github.com/janlelis/paint/blob/v2.2.1/lib/paint/version.rb
|
30
|
+
#
|
31
|
+
def version
|
32
|
+
loaded? ? Version.new(::Paint::VERSION) : Version.null_version
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Dependencies
|
5
|
+
module Queries
|
6
|
+
module Gems
|
7
|
+
##
|
8
|
+
# @api private
|
9
|
+
#
|
10
|
+
class RSpec
|
11
|
+
class << self
|
12
|
+
##
|
13
|
+
# @return [Boolean]
|
14
|
+
#
|
15
|
+
# @internal
|
16
|
+
# `Style/TernaryParentheses` is disabled since `defined?` has too low priority without parentheses.
|
17
|
+
#
|
18
|
+
# rubocop:disable Style/TernaryParentheses
|
19
|
+
def loaded?
|
20
|
+
(defined? ::RSpec) ? true : false
|
21
|
+
end
|
22
|
+
# rubocop:enable Style/TernaryParentheses
|
23
|
+
|
24
|
+
##
|
25
|
+
# @return [ConvenientService::Dependencies::Queries::Version]
|
26
|
+
#
|
27
|
+
# @internal
|
28
|
+
# https://github.com/rspec/rspec-core/blob/main/lib/rspec/core/version.rb
|
29
|
+
#
|
30
|
+
def version
|
31
|
+
loaded? ? Version.new(::RSpec::Core::Version::STRING) : Version.null_version
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# @return [RSpec::Core::Example, nil]
|
36
|
+
#
|
37
|
+
# @internal
|
38
|
+
# NOTE: Returns `nil` in environments where RSpec is NOT fully loaded, e.g: irb, rails console, etc.
|
39
|
+
#
|
40
|
+
# `::RSpec.current_example` docs:
|
41
|
+
# - https://www.rubydoc.info/github/rspec/rspec-core/RSpec.current_example
|
42
|
+
# - https://github.com/rspec/rspec-core/blob/v3.12.0/lib/rspec/core.rb#L122
|
43
|
+
# - https://relishapp.com/rspec/rspec-core/docs/metadata/current-example
|
44
|
+
#
|
45
|
+
def current_example
|
46
|
+
return unless loaded?
|
47
|
+
|
48
|
+
##
|
49
|
+
# NOTE: This happens in Ruby-only projects where RSpec is loaded by `Bundler.require`, not by `bundle exec rspec`.
|
50
|
+
#
|
51
|
+
return unless ::RSpec.respond_to?(:current_example)
|
52
|
+
|
53
|
+
::RSpec.current_example
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Dependencies
|
5
|
+
module Queries
|
6
|
+
##
|
7
|
+
# @api private
|
8
|
+
#
|
9
|
+
class Ruby
|
10
|
+
class << self
|
11
|
+
##
|
12
|
+
# @return [ConvenientService::Dependencies::Queries::Version]
|
13
|
+
#
|
14
|
+
# @internal
|
15
|
+
# NOTE: Ruby defines `RUBY_VERSION` global variable.
|
16
|
+
# - https://ruby-doc.org/core-2.7.2/doc/globals_rdoc.html
|
17
|
+
#
|
18
|
+
def version
|
19
|
+
@version ||= Version.new(::RUBY_VERSION)
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# @return [String]
|
24
|
+
#
|
25
|
+
# @internal
|
26
|
+
# TODO: Add direct specs.
|
27
|
+
#
|
28
|
+
def engine
|
29
|
+
::RUBY_ENGINE.to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# @return [ConvenientService::Dependencies::Queries::Version]
|
34
|
+
#
|
35
|
+
# @internal
|
36
|
+
# NOTE: Ruby defines `RUBY_ENGINE_VERSION` global variable.
|
37
|
+
# - https://ruby-doc.org/core-2.7.2/doc/globals_rdoc.html
|
38
|
+
#
|
39
|
+
# NOTE: JRuby defines `RUBY_ENGINE_VERSION` global variable.
|
40
|
+
# - https://github.com/jruby/jruby/blob/9.4.0.0/spec/jruby/compat_spec.rb#L6
|
41
|
+
#
|
42
|
+
# NOTE: TruffleRuby defines `RUBY_ENGINE_VERSION` global variable.
|
43
|
+
# - https://github.com/oracle/truffleruby/blob/vm-22.3.0/spec/truffle/identity_spec.rb#L23
|
44
|
+
#
|
45
|
+
# TODO: Add direct specs.
|
46
|
+
#
|
47
|
+
def engine_version
|
48
|
+
@engine_version ||= Version.new(::RUBY_ENGINE_VERSION)
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Returns `true` when MRI, `false` otherwise.
|
53
|
+
#
|
54
|
+
# @return [Boolean]
|
55
|
+
#
|
56
|
+
# @see https://github.com/janlelis/ruby_engine
|
57
|
+
#
|
58
|
+
# @internal
|
59
|
+
# NOTE: Gratefully copied from the `ruby_engine` gem. Version `1.1.4`.
|
60
|
+
# - https://github.com/janlelis/ruby_engine/blob/v2.0.0/lib/ruby_engine.rb#L19
|
61
|
+
#
|
62
|
+
def mri?
|
63
|
+
::RUBY_ENGINE.to_s == "ruby"
|
64
|
+
end
|
65
|
+
|
66
|
+
alias_method :ruby?, :mri?
|
67
|
+
|
68
|
+
##
|
69
|
+
# Returns `true` when JRuby, `false` otherwise.
|
70
|
+
#
|
71
|
+
# @return [Boolean]
|
72
|
+
#
|
73
|
+
# @see https://github.com/rdp/os
|
74
|
+
#
|
75
|
+
# @internal
|
76
|
+
# NOTE: Gratefully copied from the `os` gem. Version `1.1.4`.
|
77
|
+
# - https://github.com/rdp/os/blob/v1.1.4/lib/os.rb#L101
|
78
|
+
#
|
79
|
+
# NOTE: Modified original implementation in order to return a boolean.
|
80
|
+
# NOTE: Consider to use `RUBY_ENGINE` as for others?
|
81
|
+
#
|
82
|
+
def jruby?
|
83
|
+
::RUBY_PLATFORM.to_s.match?(/java/)
|
84
|
+
end
|
85
|
+
|
86
|
+
##
|
87
|
+
# Returns `true` when TruffleRuby, `false` otherwise.
|
88
|
+
#
|
89
|
+
# @return [Boolean]
|
90
|
+
#
|
91
|
+
# @internal
|
92
|
+
# NOTE: Taken from irb testing. May NOT be stable.
|
93
|
+
#
|
94
|
+
# TODO: Find a confirmation of stability.
|
95
|
+
#
|
96
|
+
def truffleruby?
|
97
|
+
::RUBY_ENGINE.to_s.match?(/truffleruby/)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Dependencies
|
5
|
+
module Queries
|
6
|
+
class Version
|
7
|
+
##
|
8
|
+
# @api private
|
9
|
+
#
|
10
|
+
# @internal
|
11
|
+
# - https://thoughtbot.com/blog/rails-refactoring-example-introduce-null-object
|
12
|
+
# - https://avdi.codes/null-objects-and-falsiness/
|
13
|
+
#
|
14
|
+
class NullVersion
|
15
|
+
##
|
16
|
+
# @return [Boolean]
|
17
|
+
#
|
18
|
+
def null_version?
|
19
|
+
true
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# @return [nil]
|
24
|
+
#
|
25
|
+
def gem_version
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# @param other [Object] Can be any type.
|
31
|
+
# @return [nil]
|
32
|
+
#
|
33
|
+
def <=>(other)
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# @param other [Object] Can be any type.
|
39
|
+
# @return [nil]
|
40
|
+
#
|
41
|
+
def <(other)
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# @param other [Object] Can be any type.
|
47
|
+
# @return [nil]
|
48
|
+
#
|
49
|
+
def <=(other)
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# @param other [Object] Can be any type.
|
55
|
+
# @return [nil]
|
56
|
+
#
|
57
|
+
def ==(other)
|
58
|
+
nil
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# @param other [Object] Can be any type.
|
63
|
+
# @return [nil]
|
64
|
+
#
|
65
|
+
def >(other)
|
66
|
+
nil
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# @param other [Object] Can be any type.
|
71
|
+
# @return [nil]
|
72
|
+
#
|
73
|
+
def >=(other)
|
74
|
+
nil
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# @return [String]
|
79
|
+
#
|
80
|
+
def to_s
|
81
|
+
""
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "version/null_version"
|
4
|
+
|
5
|
+
module ConvenientService
|
6
|
+
module Dependencies
|
7
|
+
module Queries
|
8
|
+
class Version
|
9
|
+
include ::Comparable
|
10
|
+
|
11
|
+
undef_method :between?
|
12
|
+
|
13
|
+
undef_method :clamp
|
14
|
+
|
15
|
+
##
|
16
|
+
# @param value [String]
|
17
|
+
# @return [void]
|
18
|
+
#
|
19
|
+
def initialize(value)
|
20
|
+
@value = value
|
21
|
+
end
|
22
|
+
|
23
|
+
class << self
|
24
|
+
##
|
25
|
+
# @return [ConvenientService::Dependencies::Queries::Version::NullVersion]
|
26
|
+
#
|
27
|
+
def null_version
|
28
|
+
@null_version ||= Version::NullVersion.new
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# @return [Boolean]
|
34
|
+
#
|
35
|
+
def null_version?
|
36
|
+
false
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# @return [Gem::Version, nil]
|
41
|
+
#
|
42
|
+
def gem_version
|
43
|
+
cast_gem_version(value)
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# @return [String]
|
48
|
+
#
|
49
|
+
# @internal
|
50
|
+
# TODO: Add direct specs.
|
51
|
+
#
|
52
|
+
def major_minor
|
53
|
+
to_s[/\d+\.\d+/]
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# @param other [Object] Can be any type.
|
58
|
+
# @return [Boolean, nil]
|
59
|
+
#
|
60
|
+
def <=>(other)
|
61
|
+
gem_version <=> cast_gem_version(other)
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# @return [String]
|
66
|
+
#
|
67
|
+
def to_s
|
68
|
+
gem_version.to_s
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
##
|
74
|
+
# @return [String]
|
75
|
+
#
|
76
|
+
attr_reader :value
|
77
|
+
|
78
|
+
##
|
79
|
+
# @return [Gem::Version, nil]
|
80
|
+
#
|
81
|
+
def cast_gem_version(value)
|
82
|
+
::Gem::Version.create(value.to_s) if ::Gem::Version.correct?(value.to_s)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|