convenient_service 0.1.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 +7 -0
- data/.dockerignore +1 -0
- data/.gem_release.yml +23 -0
- data/.github/workflows/cd.yml +54 -0
- data/.github/workflows/ci.yml +190 -0
- data/.gitignore +34 -0
- data/.inch.yml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +45 -0
- data/.rubocop_rspec.yml +58 -0
- data/.ruby-version +1 -0
- data/.tool-versions +1 -0
- data/.yardopts +13 -0
- data/Appraisals +124 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +55 -0
- data/ROADMAP.md +41 -0
- data/Rakefile +54 -0
- data/Taskfile.yml +316 -0
- data/convenient_service.gemspec +52 -0
- data/coverage/.gitkeep +0 -0
- data/docker/2.7/Dockerfile +73 -0
- data/docker/3.0/Dockerfile +73 -0
- data/docker/3.1/Dockerfile +73 -0
- data/env.rb +19 -0
- data/lib/convenient_service/common/plugins/aliases.rb +8 -0
- data/lib/convenient_service/common/plugins/assigns_attributes_in_constructor/using_active_model_attribute_assignment/concern.rb +21 -0
- data/lib/convenient_service/common/plugins/assigns_attributes_in_constructor/using_active_model_attribute_assignment/middleware.rb +29 -0
- data/lib/convenient_service/common/plugins/assigns_attributes_in_constructor/using_active_model_attribute_assignment.rb +4 -0
- data/lib/convenient_service/common/plugins/assigns_attributes_in_constructor/using_dry_initializer/concern.rb +21 -0
- data/lib/convenient_service/common/plugins/assigns_attributes_in_constructor/using_dry_initializer.rb +3 -0
- data/lib/convenient_service/common/plugins/caches_constructor_params/concern.rb +22 -0
- data/lib/convenient_service/common/plugins/caches_constructor_params/entities/constructor_params.rb +34 -0
- data/lib/convenient_service/common/plugins/caches_constructor_params/entities.rb +3 -0
- data/lib/convenient_service/common/plugins/caches_constructor_params/middleware.rb +17 -0
- data/lib/convenient_service/common/plugins/caches_constructor_params.rb +5 -0
- data/lib/convenient_service/common/plugins/caches_return_value/entities/key.rb +79 -0
- data/lib/convenient_service/common/plugins/caches_return_value/entities.rb +3 -0
- data/lib/convenient_service/common/plugins/caches_return_value/middleware.rb +17 -0
- data/lib/convenient_service/common/plugins/caches_return_value.rb +4 -0
- data/lib/convenient_service/common/plugins/can_be_copied/concern.rb +33 -0
- data/lib/convenient_service/common/plugins/can_be_copied.rb +3 -0
- data/lib/convenient_service/common/plugins/has_around_callbacks/concern.rb +19 -0
- data/lib/convenient_service/common/plugins/has_around_callbacks/errors.rb +29 -0
- data/lib/convenient_service/common/plugins/has_around_callbacks/middleware.rb +113 -0
- data/lib/convenient_service/common/plugins/has_around_callbacks.rb +5 -0
- data/lib/convenient_service/common/plugins/has_attributes/using_active_model_attributes/concern.rb +19 -0
- data/lib/convenient_service/common/plugins/has_attributes/using_active_model_attributes/patches/active_model_attributes.rb +45 -0
- data/lib/convenient_service/common/plugins/has_attributes/using_active_model_attributes/patches.rb +3 -0
- data/lib/convenient_service/common/plugins/has_attributes/using_active_model_attributes.rb +4 -0
- data/lib/convenient_service/common/plugins/has_callbacks/concern.rb +36 -0
- data/lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb +59 -0
- data/lib/convenient_service/common/plugins/has_callbacks/entities/callback_collection.rb +35 -0
- data/lib/convenient_service/common/plugins/has_callbacks/entities/type/class_methods.rb +26 -0
- data/lib/convenient_service/common/plugins/has_callbacks/entities/type.rb +50 -0
- data/lib/convenient_service/common/plugins/has_callbacks/entities/type_collection.rb +33 -0
- data/lib/convenient_service/common/plugins/has_callbacks/entities.rb +6 -0
- data/lib/convenient_service/common/plugins/has_callbacks/middleware.rb +21 -0
- data/lib/convenient_service/common/plugins/has_callbacks.rb +5 -0
- data/lib/convenient_service/common/plugins/has_constructor/concern.rb +18 -0
- data/lib/convenient_service/common/plugins/has_constructor.rb +3 -0
- data/lib/convenient_service/common/plugins/has_internals/commands/create_internals_class.rb +56 -0
- data/lib/convenient_service/common/plugins/has_internals/commands.rb +3 -0
- data/lib/convenient_service/common/plugins/has_internals/concern.rb +28 -0
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/concern.rb +25 -0
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins/has_cache/concern.rb +30 -0
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins/has_cache/entities/cache.rb +81 -0
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins/has_cache/entities.rb +3 -0
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins/has_cache.rb +4 -0
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins.rb +3 -0
- data/lib/convenient_service/common/plugins/has_internals/entities/internals.rb +18 -0
- data/lib/convenient_service/common/plugins/has_internals/entities.rb +3 -0
- data/lib/convenient_service/common/plugins/has_internals.rb +5 -0
- data/lib/convenient_service/common/plugins/normalizes_env/middleware.rb +29 -0
- data/lib/convenient_service/common/plugins/normalizes_env.rb +3 -0
- data/lib/convenient_service/common/plugins.rb +16 -0
- data/lib/convenient_service/common.rb +3 -0
- data/lib/convenient_service/configs/aliases.rb +7 -0
- data/lib/convenient_service/configs/standard.rb +193 -0
- data/lib/convenient_service/configs.rb +5 -0
- data/lib/convenient_service/core/aliases.rb +9 -0
- data/lib/convenient_service/core/class_methods.rb +81 -0
- data/lib/convenient_service/core/entities/classic_middleware.rb +32 -0
- data/lib/convenient_service/core/entities/config/entities/concerns/entities/default_concern.rb +18 -0
- data/lib/convenient_service/core/entities/config/entities/concerns/entities/middleware/commands/cast_middleware.rb +78 -0
- data/lib/convenient_service/core/entities/config/entities/concerns/entities/middleware/commands.rb +3 -0
- data/lib/convenient_service/core/entities/config/entities/concerns/entities/middleware.rb +103 -0
- data/lib/convenient_service/core/entities/config/entities/concerns/entities/stack.rb +206 -0
- data/lib/convenient_service/core/entities/config/entities/concerns/entities.rb +5 -0
- data/lib/convenient_service/core/entities/config/entities/concerns.rb +216 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb +95 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/commands.rb +3 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/commands/cast_caller.rb +72 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/commands/define_method_middlewares_caller.rb +134 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/commands.rb +4 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/concern/class_methods.rb +29 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/concern/instance_methods.rb +66 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/concern.rb +32 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller.rb +25 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/chain.rb +71 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/container/commands/cast_container.rb +76 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/container/commands/resolve_methods_middlewares_callers.rb +72 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/container/commands.rb +4 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/container/concern/class_methods.rb +29 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/container/concern/instance_methods.rb +165 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/container/concern.rb +32 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/container.rb +22 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware.rb +114 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/stack.rb +193 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities.rb +7 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares.rb +182 -0
- data/lib/convenient_service/core/entities/config/entities.rb +4 -0
- data/lib/convenient_service/core/entities/config/errors.rb +27 -0
- data/lib/convenient_service/core/entities/config.rb +147 -0
- data/lib/convenient_service/core/entities.rb +4 -0
- data/lib/convenient_service/core/instance_methods.rb +54 -0
- data/lib/convenient_service/core.rb +19 -0
- data/lib/convenient_service/dependencies/built_in.rb +36 -0
- data/lib/convenient_service/dependencies/extractions/active_support_concern/concern.rb +258 -0
- data/lib/convenient_service/dependencies/extractions/active_support_concern.rb +16 -0
- data/lib/convenient_service/dependencies/extractions/b.rb +12 -0
- data/lib/convenient_service/dependencies/extractions/byebug_syntax_highlighting.rb +58 -0
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/builder.rb +194 -0
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/logger.rb +60 -0
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/runner.rb +79 -0
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware.rb +8 -0
- data/lib/convenient_service/dependencies/extractions/ruby_middleware.rb +15 -0
- data/lib/convenient_service/dependencies/extractions.rb +10 -0
- data/lib/convenient_service/dependencies.rb +133 -0
- data/lib/convenient_service/error.rb +16 -0
- data/lib/convenient_service/examples/dry/gemfile/dry_service/config.rb +43 -0
- data/lib/convenient_service/examples/dry/gemfile/dry_service.rb +3 -0
- data/lib/convenient_service/examples/dry/gemfile/services/assert_file_exists.rb +29 -0
- data/lib/convenient_service/examples/dry/gemfile/services/assert_file_not_empty.rb +29 -0
- data/lib/convenient_service/examples/dry/gemfile/services/assert_node_available.rb +26 -0
- data/lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb +39 -0
- data/lib/convenient_service/examples/dry/gemfile/services/assert_valid_ruby_syntax.rb +41 -0
- data/lib/convenient_service/examples/dry/gemfile/services/format.rb +37 -0
- data/lib/convenient_service/examples/dry/gemfile/services/format_body.rb +93 -0
- data/lib/convenient_service/examples/dry/gemfile/services/format_gems_with_envs.rb +96 -0
- data/lib/convenient_service/examples/dry/gemfile/services/format_gems_without_envs.rb +84 -0
- data/lib/convenient_service/examples/dry/gemfile/services/format_header.rb +74 -0
- data/lib/convenient_service/examples/dry/gemfile/services/parse_content.rb +93 -0
- data/lib/convenient_service/examples/dry/gemfile/services/print_shell_command.rb +37 -0
- data/lib/convenient_service/examples/dry/gemfile/services/read_file_content.rb +31 -0
- data/lib/convenient_service/examples/dry/gemfile/services/run_shell.rb +40 -0
- data/lib/convenient_service/examples/dry/gemfile/services/strip_comments.rb +109 -0
- data/lib/convenient_service/examples/dry/gemfile/services.rb +17 -0
- data/lib/convenient_service/examples/dry/gemfile.rb +24 -0
- data/lib/convenient_service/examples/rails/gemfile/rails_service/config.rb +54 -0
- data/lib/convenient_service/examples/rails/gemfile/rails_service.rb +3 -0
- data/lib/convenient_service/examples/rails/gemfile/services/assert_file_exists.rb +25 -0
- data/lib/convenient_service/examples/rails/gemfile/services/assert_file_not_empty.rb +25 -0
- data/lib/convenient_service/examples/rails/gemfile/services/assert_node_available.rb +26 -0
- data/lib/convenient_service/examples/rails/gemfile/services/assert_npm_package_available.rb +35 -0
- data/lib/convenient_service/examples/rails/gemfile/services/assert_valid_ruby_syntax.rb +35 -0
- data/lib/convenient_service/examples/rails/gemfile/services/format.rb +37 -0
- data/lib/convenient_service/examples/rails/gemfile/services/format_body.rb +79 -0
- data/lib/convenient_service/examples/rails/gemfile/services/format_gems_with_envs.rb +82 -0
- data/lib/convenient_service/examples/rails/gemfile/services/format_gems_without_envs.rb +70 -0
- data/lib/convenient_service/examples/rails/gemfile/services/format_header.rb +69 -0
- data/lib/convenient_service/examples/rails/gemfile/services/parse_content.rb +89 -0
- data/lib/convenient_service/examples/rails/gemfile/services/print_shell_command.rb +33 -0
- data/lib/convenient_service/examples/rails/gemfile/services/read_file_content.rb +27 -0
- data/lib/convenient_service/examples/rails/gemfile/services/run_shell.rb +35 -0
- data/lib/convenient_service/examples/rails/gemfile/services/strip_comments.rb +107 -0
- data/lib/convenient_service/examples/rails/gemfile/services.rb +17 -0
- data/lib/convenient_service/examples/rails/gemfile.rb +24 -0
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb +30 -0
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb +30 -0
- data/lib/convenient_service/examples/standard/gemfile/services/assert_node_available.rb +35 -0
- data/lib/convenient_service/examples/standard/gemfile/services/assert_npm_package_available.rb +48 -0
- data/lib/convenient_service/examples/standard/gemfile/services/assert_valid_ruby_syntax.rb +39 -0
- data/lib/convenient_service/examples/standard/gemfile/services/format.rb +39 -0
- data/lib/convenient_service/examples/standard/gemfile/services/format_body.rb +83 -0
- data/lib/convenient_service/examples/standard/gemfile/services/format_gems_with_envs.rb +86 -0
- data/lib/convenient_service/examples/standard/gemfile/services/format_gems_without_envs.rb +74 -0
- data/lib/convenient_service/examples/standard/gemfile/services/format_header.rb +66 -0
- data/lib/convenient_service/examples/standard/gemfile/services/parse_content.rb +101 -0
- data/lib/convenient_service/examples/standard/gemfile/services/print_shell_command.rb +38 -0
- data/lib/convenient_service/examples/standard/gemfile/services/read_file_content.rb +39 -0
- data/lib/convenient_service/examples/standard/gemfile/services/run_shell.rb +37 -0
- data/lib/convenient_service/examples/standard/gemfile/services/strip_comments.rb +111 -0
- data/lib/convenient_service/examples/standard/gemfile/services.rb +17 -0
- data/lib/convenient_service/examples/standard/gemfile.rb +23 -0
- data/lib/convenient_service/logger.rb +70 -0
- data/lib/convenient_service/rspec/helpers/custom/ignoring_error.rb +29 -0
- data/lib/convenient_service/rspec/helpers/custom/stub_service/entities/result_spec.rb +119 -0
- data/lib/convenient_service/rspec/helpers/custom/stub_service/entities/stubbed_service.rb +99 -0
- data/lib/convenient_service/rspec/helpers/custom/stub_service/entities.rb +4 -0
- data/lib/convenient_service/rspec/helpers/custom/stub_service.rb +26 -0
- data/lib/convenient_service/rspec/helpers/custom/wrap_method/entities/wrapped_method.rb +80 -0
- data/lib/convenient_service/rspec/helpers/custom/wrap_method/entities.rb +3 -0
- data/lib/convenient_service/rspec/helpers/custom/wrap_method/errors.rb +25 -0
- data/lib/convenient_service/rspec/helpers/custom/wrap_method.rb +27 -0
- data/lib/convenient_service/rspec/helpers/custom.rb +5 -0
- data/lib/convenient_service/rspec/helpers/ignoring_error.rb +13 -0
- data/lib/convenient_service/rspec/helpers/stub_service.rb +29 -0
- data/lib/convenient_service/rspec/helpers/wrap_method.rb +13 -0
- data/lib/convenient_service/rspec/helpers.rb +21 -0
- data/lib/convenient_service/rspec/matchers/be_descendant_of.rb +13 -0
- data/lib/convenient_service/rspec/matchers/be_direct_descendant_of.rb +13 -0
- data/lib/convenient_service/rspec/matchers/cache_its_value.rb +13 -0
- data/lib/convenient_service/rspec/matchers/call_chain_next.rb +13 -0
- data/lib/convenient_service/rspec/matchers/custom/be_descendant_of.rb +55 -0
- data/lib/convenient_service/rspec/matchers/custom/be_direct_descendant_of.rb +55 -0
- data/lib/convenient_service/rspec/matchers/custom/cache_its_value.rb +55 -0
- data/lib/convenient_service/rspec/matchers/custom/call_chain_next.rb +150 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to.rb +255 -0
- data/lib/convenient_service/rspec/matchers/custom/extend_module.rb +40 -0
- data/lib/convenient_service/rspec/matchers/custom/have_abstract_method.rb +45 -0
- data/lib/convenient_service/rspec/matchers/custom/have_alias_method.rb +45 -0
- data/lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb +43 -0
- data/lib/convenient_service/rspec/matchers/custom/have_attr_reader.rb +47 -0
- data/lib/convenient_service/rspec/matchers/custom/have_attr_writer.rb +47 -0
- data/lib/convenient_service/rspec/matchers/custom/include_module.rb +40 -0
- data/lib/convenient_service/rspec/matchers/custom/prepend_module.rb +40 -0
- data/lib/convenient_service/rspec/matchers/custom/results/be_error.rb +153 -0
- data/lib/convenient_service/rspec/matchers/custom/results/be_failure.rb +120 -0
- data/lib/convenient_service/rspec/matchers/custom/results/be_success.rb +120 -0
- data/lib/convenient_service/rspec/matchers/custom/results.rb +5 -0
- data/lib/convenient_service/rspec/matchers/custom.rb +16 -0
- data/lib/convenient_service/rspec/matchers/delegate_to.rb +13 -0
- data/lib/convenient_service/rspec/matchers/extend_module.rb +13 -0
- data/lib/convenient_service/rspec/matchers/have_abstract_method.rb +13 -0
- data/lib/convenient_service/rspec/matchers/have_alias_method.rb +13 -0
- data/lib/convenient_service/rspec/matchers/have_attr_accessor.rb +13 -0
- data/lib/convenient_service/rspec/matchers/have_attr_reader.rb +13 -0
- data/lib/convenient_service/rspec/matchers/have_attr_writer.rb +13 -0
- data/lib/convenient_service/rspec/matchers/include_module.rb +13 -0
- data/lib/convenient_service/rspec/matchers/prepend_module.rb +13 -0
- data/lib/convenient_service/rspec/matchers/results/be_error.rb +15 -0
- data/lib/convenient_service/rspec/matchers/results/be_failure.rb +15 -0
- data/lib/convenient_service/rspec/matchers/results/be_success.rb +15 -0
- data/lib/convenient_service/rspec/matchers/results.rb +21 -0
- data/lib/convenient_service/rspec/matchers.rb +43 -0
- data/lib/convenient_service/rspec.rb +4 -0
- data/lib/convenient_service/service/plugins/aliases.rb +8 -0
- data/lib/convenient_service/service/plugins/can_recalculate_result/concern.rb +26 -0
- data/lib/convenient_service/service/plugins/can_recalculate_result.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/commands/create_result_class.rb +56 -0
- data/lib/convenient_service/service/plugins/has_result/commands.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/concern/class_methods.rb +82 -0
- data/lib/convenient_service/service/plugins/has_result/concern/instance_methods.rb +32 -0
- data/lib/convenient_service/service/plugins/has_result/concern.rb +22 -0
- data/lib/convenient_service/service/plugins/has_result/constants.rb +33 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/commands/cast_result_params.rb +33 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/commands.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/concern/instance_methods.rb +64 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/concern.rb +19 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/entities/code/class_methods.rb +30 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/entities/code.rb +45 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/entities/data/class_methods.rb +28 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/entities/data.rb +45 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/entities/message/class_methods.rb +30 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/entities/message.rb +41 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/entities/status/class_methods.rb +30 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/entities/status.rb +69 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/entities.rb +6 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/errors.rb +25 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_recalculate_result/concern.rb +27 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_recalculate_result.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_result_short_syntax/concern/instance_methods.rb +28 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_result_short_syntax/concern.rb +30 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_result_short_syntax.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/marks_result_status_as_checked/middleware.rb +25 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/marks_result_status_as_checked.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/raises_on_not_checked_result_status/errors.rb +31 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/raises_on_not_checked_result_status/middleware.rb +33 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/raises_on_not_checked_result_status.rb +4 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins.rb +6 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/structs/result_params.rb +17 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/structs.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result.rb +22 -0
- data/lib/convenient_service/service/plugins/has_result/entities.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/errors.rb +34 -0
- data/lib/convenient_service/service/plugins/has_result/middleware.rb +19 -0
- data/lib/convenient_service/service/plugins/has_result.rb +8 -0
- data/lib/convenient_service/service/plugins/has_result_method_steps/errors.rb +23 -0
- data/lib/convenient_service/service/plugins/has_result_method_steps/middleware.rb +37 -0
- data/lib/convenient_service/service/plugins/has_result_method_steps/services/method_step_config.rb +29 -0
- data/lib/convenient_service/service/plugins/has_result_method_steps/services/run_method_in_organizer.rb +30 -0
- data/lib/convenient_service/service/plugins/has_result_method_steps/services/run_own_method_in_organizer.rb +52 -0
- data/lib/convenient_service/service/plugins/has_result_method_steps/services.rb +5 -0
- data/lib/convenient_service/service/plugins/has_result_method_steps.rb +5 -0
- data/lib/convenient_service/service/plugins/has_result_params_validations/using_active_model_validations/concern.rb +19 -0
- data/lib/convenient_service/service/plugins/has_result_params_validations/using_active_model_validations/middleware.rb +35 -0
- data/lib/convenient_service/service/plugins/has_result_params_validations/using_active_model_validations.rb +4 -0
- data/lib/convenient_service/service/plugins/has_result_params_validations/using_dry_validation/concern.rb +22 -0
- data/lib/convenient_service/service/plugins/has_result_params_validations/using_dry_validation/middleware.rb +39 -0
- data/lib/convenient_service/service/plugins/has_result_params_validations/using_dry_validation.rb +4 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/concern.rb +30 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/error/commands/assert_args_count_lower_than_three.rb +25 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/error/commands/assert_either_args_or_kwargs_are_passed.rb +26 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/error/commands.rb +4 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/error/errors.rb +46 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/error/middleware.rb +27 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/error.rb +5 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/failure/commands/refute_kwargs_contain_data_and_extra_keys.rb +29 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/failure/commands.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/failure/errors.rb +28 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/failure/middleware.rb +19 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/failure.rb +5 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/success/commands/refute_kwargs_contain_data_and_extra_keys.rb +29 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/success/commands.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/success/errors.rb +28 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/success/middleware.rb +19 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax/success.rb +5 -0
- data/lib/convenient_service/service/plugins/has_result_short_syntax.rb +6 -0
- data/lib/convenient_service/service/plugins/has_result_steps/commands/create_step_class.rb +60 -0
- data/lib/convenient_service/service/plugins/has_result_steps/commands.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result_steps/concern.rb +53 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method.rb +54 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method_caller.rb +67 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method_direction.rb +65 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method_key.rb +71 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method_name.rb +74 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/define_method_in_container.rb +55 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands.rb +8 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/concern/class_methods.rb +21 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/concern/instance_methods.rb +96 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/concern.rb +29 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/alias.rb +39 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/base.rb +49 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/proc.rb +42 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/raw.rb +42 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/usual.rb +39 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers.rb +7 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/directions/base.rb +33 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/directions/input.rb +31 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/directions/output.rb +31 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/directions.rb +5 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/key.rb +40 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/name.rb +40 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/values/raw.rb +48 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/values.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/entities.rb +7 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/errors.rb +127 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method.rb +20 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/service/class_methods.rb +32 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/service.rb +48 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb +61 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/extract_params.rb +38 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/commands.rb +4 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/concern/instance_methods.rb +138 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/concern.rb +23 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/errors.rb +23 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/structs/params.rb +17 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/structs.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step.rb +20 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step_collection.rb +61 -0
- data/lib/convenient_service/service/plugins/has_result_steps/entities.rb +6 -0
- data/lib/convenient_service/service/plugins/has_result_steps/middleware.rb +26 -0
- data/lib/convenient_service/service/plugins/has_result_steps.rb +6 -0
- data/lib/convenient_service/service/plugins/raises_on_double_result/errors.rb +34 -0
- data/lib/convenient_service/service/plugins/raises_on_double_result/middleware.rb +33 -0
- data/lib/convenient_service/service/plugins/raises_on_double_result.rb +4 -0
- data/lib/convenient_service/service/plugins/wraps_result_in_db_transaction/middleware.rb +15 -0
- data/lib/convenient_service/service/plugins/wraps_result_in_db_transaction.rb +3 -0
- data/lib/convenient_service/service/plugins.rb +14 -0
- data/lib/convenient_service/service.rb +3 -0
- data/lib/convenient_service/specification.rb +21 -0
- data/lib/convenient_service/support/abstract_method/errors.rb +22 -0
- data/lib/convenient_service/support/abstract_method.rb +21 -0
- data/lib/convenient_service/support/castable/errors.rb +29 -0
- data/lib/convenient_service/support/castable.rb +44 -0
- data/lib/convenient_service/support/command.rb +25 -0
- data/lib/convenient_service/support/concern.rb +11 -0
- data/lib/convenient_service/support/copyable.rb +56 -0
- data/lib/convenient_service/support/delegate.rb +42 -0
- data/lib/convenient_service/support/finite_loop.rb +49 -0
- data/lib/convenient_service/support/middleware/stack_builder.rb +78 -0
- data/lib/convenient_service/support/middleware.rb +3 -0
- data/lib/convenient_service/support.rb +11 -0
- data/lib/convenient_service/utils/array/contain_exactly.rb +56 -0
- data/lib/convenient_service/utils/array/drop_while.rb +50 -0
- data/lib/convenient_service/utils/array/errors.rb +19 -0
- data/lib/convenient_service/utils/array/find_last.rb +38 -0
- data/lib/convenient_service/utils/array/find_yield.rb +93 -0
- data/lib/convenient_service/utils/array/keep_after.rb +41 -0
- data/lib/convenient_service/utils/array/merge.rb +77 -0
- data/lib/convenient_service/utils/array/rjust.rb +50 -0
- data/lib/convenient_service/utils/array/wrap.rb +40 -0
- data/lib/convenient_service/utils/array.rb +52 -0
- data/lib/convenient_service/utils/bool/to_bool.rb +37 -0
- data/lib/convenient_service/utils/bool.rb +15 -0
- data/lib/convenient_service/utils/hash/except.rb +46 -0
- data/lib/convenient_service/utils/hash.rb +15 -0
- data/lib/convenient_service/utils/method/defined.rb +49 -0
- data/lib/convenient_service/utils/method.rb +15 -0
- data/lib/convenient_service/utils/module/class_method_defined.rb +46 -0
- data/lib/convenient_service/utils/module/get_own_const.rb +60 -0
- data/lib/convenient_service/utils/module/get_own_instance_method.rb +81 -0
- data/lib/convenient_service/utils/module/has_own_instance_method.rb +77 -0
- data/lib/convenient_service/utils/module/instance_method_defined.rb +46 -0
- data/lib/convenient_service/utils/module.rb +40 -0
- data/lib/convenient_service/utils/object/resolve_type.rb +47 -0
- data/lib/convenient_service/utils/object.rb +19 -0
- data/lib/convenient_service/utils/proc/conjunct.rb +48 -0
- data/lib/convenient_service/utils/proc/exec_config.rb +136 -0
- data/lib/convenient_service/utils/proc.rb +20 -0
- data/lib/convenient_service/utils/string/camelize.rb +56 -0
- data/lib/convenient_service/utils/string.rb +15 -0
- data/lib/convenient_service/utils.rb +10 -0
- data/lib/convenient_service/version.rb +5 -0
- data/lib/convenient_service.rb +31 -0
- data/logo.png +0 -0
- metadata +738 -0
data/ROADMAP.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Roadmap
|
|
2
|
+
|
|
3
|
+
| Priority | Status | Goal | Notes |
|
|
4
|
+
| - | - | - | - |
|
|
5
|
+
| High | ✅ | 100% coverage of `Core` | |
|
|
6
|
+
| Medium | 🚧 | Type signatures for the whole codebase ([Yard @param, @overload, @return](https://rubydoc.info/gems/yard/file/docs/Tags.md#taglist)) | |
|
|
7
|
+
| Medium | 🚧 | `Service.success?` shortcut for `Service.result.success?` | |
|
|
8
|
+
| Medium | 🚧 | Release `v0.1.0` with a warning that lib is still under heavy development | |
|
|
9
|
+
| Medium | 🚧 | [Active Record transaction](https://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html) examples | |
|
|
10
|
+
| Low | 🚧 | [Capybara](https://github.com/teamcapybara/capybara) examples | |
|
|
11
|
+
| Low | 🚧 | [Thread.current](https://ruby-doc.org/core-3.1.2/Thread.html#method-c-current) to cache repetable nested steps during an organizer invocation | |
|
|
12
|
+
| Medium | 🚧 | Inline step sequence | |
|
|
13
|
+
| High | 🚧 | Move callbacks to internals | |
|
|
14
|
+
| Low | 🚧 | Create an example of `id_or_record` [attribute](https://api.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html) |
|
|
15
|
+
| Low | 🚧 | GitHub Wiki/Gists for Support | |
|
|
16
|
+
| Low | 🚧 | Contribute to Shoulda Matchers | |
|
|
17
|
+
| High | ✅ | `respond_to_missing?` | [ConvenientService::Core::ClassMethods#respond_to_missing?](https://github.com/marian13/convenient_service/blob/main/lib/convenient_service/core/class_methods.rb#L105), [ConvenientService::Core::InstanceMethods#respond_to_missing?](https://github.com/marian13/convenient_service/blob/main/lib/convenient_service/core/instance_methods.rb#L30) |
|
|
18
|
+
| High | ⏳ | Custom matcher to track `ConvenientService::Logger` messages | |
|
|
19
|
+
| Medium | 🚧 | Remove `respond_to?` from `Copyable` | Investigate before making any decision |
|
|
20
|
+
| High | 🚧 | Unified `inspect` | |
|
|
21
|
+
| High | ✅ | Remove race condition for `method_missing` | https://github.com/marian13/convenient_service/pull/5 |
|
|
22
|
+
| High | ✅ | Remove incompatiility of [Module#include](https://gist.github.com/marian13/9c25041f835564e945d978839097d419) | https://github.com/marian13/convenient_service/pull/3 |
|
|
23
|
+
| Medium | ✅ | Split `Utils` specs into separate files | [convenient_service/spec/lib/convenient_service/utils](https://github.com/marian13/convenient_service/tree/main/spec/lib/convenient_service/utils) |
|
|
24
|
+
| Medium | 🚧 | How to test thread-safety? | |
|
|
25
|
+
| Medium | ✅ | Rename `Utils::Module.find_own_const` to `Utils::Module.get_own_const` | [ConvenientService::Utils::Module::GetOwnConst](https://github.com/marian13/convenient_service/blob/main/lib/convenient_service/utils/module/get_own_const.rb) |
|
|
26
|
+
| Medium | 🚧 | Mark `@api private` methods, classes | [YARD Tags](https://www.rubydoc.info/gems/yard/file/docs/Tags.md) |
|
|
27
|
+
| Medium | ✅ | A way to check if block has one required positional argument | [#proc_has_one_positional_argument?](https://github.com/marian13/convenient_service/blob/main/lib/convenient_service/utils/proc/exec_config.rb#L96) |
|
|
28
|
+
| Medium | 🚧 | Factories for POROs in specs | |
|
|
29
|
+
| Low | 🚧 | Define method middleware caller with visibility | |
|
|
30
|
+
| Low | 🚧 | Dependency containers to remove high coupling | |
|
|
31
|
+
| Low | 🚧 | Measure performance | |
|
|
32
|
+
| Low | 🚧 | Rewrite middleware backend to count [convenient_service](https://github.com/marian13/convenient_service) specifics | |
|
|
33
|
+
| High | 🚧 | Optimize `stack.dup` in `MethodMiddlewares#call` | Core v3 |
|
|
34
|
+
| Medium | 🚧 | Make a decision of what to do with `printable_block` in custom RSpec matchers | |
|
|
35
|
+
| Medium | 🚧 | User-friendly exception messages | |
|
|
36
|
+
| High | 🚧 | Factories for POROs ❗❗❗ | |
|
|
37
|
+
| High | 🚧 | Resolve warning during specs | |
|
|
38
|
+
| Medium | 🚧 | Consider to change/rewrite `delegate` backend to minify its interface | |
|
|
39
|
+
| Medium | 🚧 | Same order of attr macros, delegators, initialize, class methods, attr methods, queries, actions, to_*, comparison, inspect | |
|
|
40
|
+
| Medium | 🚧 | Move `Cache` to `Support` | |
|
|
41
|
+
| Medium | 🚧 | Statically specify plugin dependencies | |
|
data/Rakefile
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# NOTE: Why not `bin` folder? It has a different purpose. It should contain "binaries/executables" that can be used by the end user.
|
|
7
|
+
# Search for `bin` in the following links for more info.
|
|
8
|
+
# - https://guides.rubygems.org/what-is-a-gem/
|
|
9
|
+
# - https://guides.rubygems.org/faqs/
|
|
10
|
+
#
|
|
11
|
+
task :confirm do
|
|
12
|
+
require "tty-prompt"
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# NOTE: `ARGV[0]` contains `confirm` (this task name).
|
|
16
|
+
#
|
|
17
|
+
message = ARGV[1] || "Are you sure?"
|
|
18
|
+
|
|
19
|
+
##
|
|
20
|
+
# NOTE: Why "tty-prompt"? No time to write, maintain complex, cross-platform bash scripts if you are a full-time application developer.
|
|
21
|
+
#
|
|
22
|
+
prompt = TTY::Prompt.new
|
|
23
|
+
|
|
24
|
+
##
|
|
25
|
+
# NOTE: `prompt.yes?` docs.
|
|
26
|
+
# https://github.com/piotrmurach/tty-prompt#25-yesno
|
|
27
|
+
#
|
|
28
|
+
yes = prompt.yes?(message)
|
|
29
|
+
|
|
30
|
+
##
|
|
31
|
+
# NOTE: Use `echo $?` to debug exit code (0 means ok, 1 - error).
|
|
32
|
+
#
|
|
33
|
+
yes ? exit(0) : exit(1)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
task :playground do
|
|
37
|
+
require "irb"
|
|
38
|
+
|
|
39
|
+
require_relative "env"
|
|
40
|
+
|
|
41
|
+
require "convenient_service"
|
|
42
|
+
|
|
43
|
+
require_relative "spec/support/convenient_service"
|
|
44
|
+
require_relative "spec/support/convenient_service/rails" if ENV["APPRAISAL_NAME"] == "all" || ENV["APPRAISAL_NAME"].include?("rails")
|
|
45
|
+
require_relative "spec/support/convenient_service/dry" if ENV["APPRAISAL_NAME"] == "all" || ENV["APPRAISAL_NAME"].include?("dry")
|
|
46
|
+
|
|
47
|
+
##
|
|
48
|
+
# NOTE: Clears `ARGV` since both `rake` and `irb` uses it.
|
|
49
|
+
# https://stackoverflow.com/a/2876645/12201472
|
|
50
|
+
#
|
|
51
|
+
ARGV.clear
|
|
52
|
+
|
|
53
|
+
IRB.start(__FILE__)
|
|
54
|
+
end
|
data/Taskfile.yml
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
version: '3'
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# IMPORTANT: All tasks listed in this file should be executed from the root folder.
|
|
5
|
+
# https://taskfile.dev/usage/#task-directory
|
|
6
|
+
#
|
|
7
|
+
# NOTE: Examples of multiline strings in YAML.
|
|
8
|
+
# https://yaml-multiline.info/
|
|
9
|
+
#
|
|
10
|
+
# NOTE: Use `[ "${IN_DOCKER_CONTAINER}" == "true" ] && echo true || echo false` to debug ``[ "${IN_DOCKER_CONTAINER}" == "true" ]`.
|
|
11
|
+
#
|
|
12
|
+
# NOTE: Forwarding CLI arguments to commands ({{.CLI_ARGS}}).
|
|
13
|
+
# https://taskfile.dev/usage/#forwarding-cli-arguments-to-commands
|
|
14
|
+
#
|
|
15
|
+
tasks:
|
|
16
|
+
default:
|
|
17
|
+
cmds:
|
|
18
|
+
- task: rspec
|
|
19
|
+
|
|
20
|
+
coverage:lcov:merge:
|
|
21
|
+
cmds:
|
|
22
|
+
- npx --yes lcov-result-merger 'coverage/**/lcov.info' coverage/lcov.info
|
|
23
|
+
|
|
24
|
+
coverage:open:
|
|
25
|
+
cmds:
|
|
26
|
+
- open coverage/index.html
|
|
27
|
+
preconditions:
|
|
28
|
+
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
|
29
|
+
msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization)
|
|
30
|
+
|
|
31
|
+
deps:
|
|
32
|
+
cmds:
|
|
33
|
+
- task: deps:install
|
|
34
|
+
|
|
35
|
+
deps:install:
|
|
36
|
+
cmds:
|
|
37
|
+
- bundle install
|
|
38
|
+
- bundle exec appraisal install
|
|
39
|
+
|
|
40
|
+
deps:clean:
|
|
41
|
+
cmds:
|
|
42
|
+
- "bundle exec rake confirm \"This task removes Gemfile*.lock and gemfiles/**/*. Are you sure?\""
|
|
43
|
+
- rm Gemfile*.lock
|
|
44
|
+
- rm -rf gemfiles
|
|
45
|
+
|
|
46
|
+
docker:bash:ruby_2.7:
|
|
47
|
+
cmds:
|
|
48
|
+
- docker run --rm -it -v $(pwd):/gem convenient_service:2.7 bash
|
|
49
|
+
interactive: true
|
|
50
|
+
preconditions:
|
|
51
|
+
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
|
52
|
+
msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization)
|
|
53
|
+
|
|
54
|
+
docker:bash:ruby_3.0:
|
|
55
|
+
cmds:
|
|
56
|
+
- docker run --rm -it -v $(pwd):/gem convenient_service:3.0 bash
|
|
57
|
+
interactive: true
|
|
58
|
+
preconditions:
|
|
59
|
+
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
|
60
|
+
msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization)
|
|
61
|
+
|
|
62
|
+
docker:bash:ruby_3.1:
|
|
63
|
+
cmds:
|
|
64
|
+
- docker run --rm -it -v $(pwd):/gem convenient_service:3.1 bash
|
|
65
|
+
interactive: true
|
|
66
|
+
preconditions:
|
|
67
|
+
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
|
68
|
+
msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization)
|
|
69
|
+
|
|
70
|
+
docker:build:
|
|
71
|
+
cmds:
|
|
72
|
+
- task: docker:build:ruby_2.7
|
|
73
|
+
- task: docker:build:ruby_3.0
|
|
74
|
+
- task: docker:build:ruby_3.1
|
|
75
|
+
preconditions:
|
|
76
|
+
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
|
77
|
+
msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization)
|
|
78
|
+
|
|
79
|
+
docker:build:ruby_2.7:
|
|
80
|
+
cmds:
|
|
81
|
+
- docker build . -f docker/2.7/Dockerfile -t convenient_service:2.7
|
|
82
|
+
preconditions:
|
|
83
|
+
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
|
84
|
+
msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization)
|
|
85
|
+
|
|
86
|
+
docker:build:ruby_3.0:
|
|
87
|
+
cmds:
|
|
88
|
+
- docker build . -f docker/3.0/Dockerfile -t convenient_service:3.0
|
|
89
|
+
preconditions:
|
|
90
|
+
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
|
91
|
+
msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization)
|
|
92
|
+
|
|
93
|
+
docker:build:ruby_3.1:
|
|
94
|
+
cmds:
|
|
95
|
+
- docker build . -f docker/3.1/Dockerfile -t convenient_service:3.1
|
|
96
|
+
preconditions:
|
|
97
|
+
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
|
98
|
+
msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization)
|
|
99
|
+
|
|
100
|
+
##
|
|
101
|
+
# NOTE: `sdoc` (wrapper for `rdoc`) is replaced by `yard`, since you have a feeling like every time is a first time with `rdoc`.
|
|
102
|
+
# - https://kapeli.com/cheat_sheets/Yard.docset/Contents/Resources/Documents/index
|
|
103
|
+
# - https://rubydoc.info/gems/yard/file/README.md
|
|
104
|
+
# - `yardoc --help`
|
|
105
|
+
#
|
|
106
|
+
# NOTE: `commonmarker` supports GitHub Flavored Markdown.
|
|
107
|
+
# - https://github.com/gjtorikian/commonmarker
|
|
108
|
+
# - https://github.github.com/gfm/
|
|
109
|
+
# - https://github.com/github/markup#markups
|
|
110
|
+
# - https://github.com/lsegal/yard/pull/1388
|
|
111
|
+
#
|
|
112
|
+
# TODO: Contribute. Forward `--parse-option LIBERAL_HTML_TAG` to commonmarker.
|
|
113
|
+
#
|
|
114
|
+
# NOTE: options are specified in the `.yardopts` file.
|
|
115
|
+
#
|
|
116
|
+
docs:generate:
|
|
117
|
+
cmds:
|
|
118
|
+
- bundle exec yardoc
|
|
119
|
+
|
|
120
|
+
docs:generate:open:
|
|
121
|
+
cmds:
|
|
122
|
+
- task: docs:generate
|
|
123
|
+
- task: docs:open
|
|
124
|
+
|
|
125
|
+
docs:lint:
|
|
126
|
+
cmds:
|
|
127
|
+
- mkdir -p docs
|
|
128
|
+
- bundle exec yard-junk --text --html docs/junk-yard.html
|
|
129
|
+
|
|
130
|
+
docs:missed:
|
|
131
|
+
cmds:
|
|
132
|
+
##
|
|
133
|
+
# NOTE: Options are taken from `.inch.yml`.
|
|
134
|
+
#
|
|
135
|
+
- bundle exec inch
|
|
136
|
+
|
|
137
|
+
docs:open:
|
|
138
|
+
cmds:
|
|
139
|
+
- open docs/index.html
|
|
140
|
+
preconditions:
|
|
141
|
+
- sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]'
|
|
142
|
+
msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization)
|
|
143
|
+
|
|
144
|
+
##
|
|
145
|
+
# NOTE: A trailing "/**" matches everything inside.
|
|
146
|
+
# https://git-scm.com/docs/gitignore
|
|
147
|
+
#
|
|
148
|
+
git:staged:specs:
|
|
149
|
+
cmds:
|
|
150
|
+
- git diff --cached --name-only --diff-filter=d "spec/**"
|
|
151
|
+
|
|
152
|
+
lint:
|
|
153
|
+
cmds:
|
|
154
|
+
- task: rubocop
|
|
155
|
+
- task: docs:lint
|
|
156
|
+
|
|
157
|
+
playground:
|
|
158
|
+
cmds:
|
|
159
|
+
- bundle exec rake playground
|
|
160
|
+
interactive: true
|
|
161
|
+
|
|
162
|
+
playground:all:
|
|
163
|
+
cmds:
|
|
164
|
+
- bundle exec appraisal all rake playground
|
|
165
|
+
interactive: true
|
|
166
|
+
|
|
167
|
+
playground:dry:
|
|
168
|
+
cmds:
|
|
169
|
+
- bundle exec appraisal dry rake playground
|
|
170
|
+
interactive: true
|
|
171
|
+
|
|
172
|
+
playground:rails_5.2:
|
|
173
|
+
cmds:
|
|
174
|
+
- bundle exec appraisal rails_5.2 rake playground
|
|
175
|
+
interactive: true
|
|
176
|
+
|
|
177
|
+
playground:rails_6.0:
|
|
178
|
+
cmds:
|
|
179
|
+
- bundle exec appraisal rails_6.0 rake playground
|
|
180
|
+
interactive: true
|
|
181
|
+
|
|
182
|
+
playground:rails_6.1:
|
|
183
|
+
cmds:
|
|
184
|
+
- bundle exec appraisal rails_6.1 rake playground
|
|
185
|
+
interactive: true
|
|
186
|
+
|
|
187
|
+
playground:rails_7.0:
|
|
188
|
+
cmds:
|
|
189
|
+
- bundle exec appraisal rails_7.0 rake playground
|
|
190
|
+
interactive: true
|
|
191
|
+
|
|
192
|
+
playground:standard:
|
|
193
|
+
cmds:
|
|
194
|
+
- bundle exec rake playground
|
|
195
|
+
interactive: true
|
|
196
|
+
|
|
197
|
+
release:major:
|
|
198
|
+
cmds:
|
|
199
|
+
- gem bump convenient_service --version major
|
|
200
|
+
|
|
201
|
+
release:minor:
|
|
202
|
+
cmds:
|
|
203
|
+
- gem bump convenient_service --version minor
|
|
204
|
+
|
|
205
|
+
release:patch:
|
|
206
|
+
cmds:
|
|
207
|
+
- gem bump convenient_service --version patch
|
|
208
|
+
|
|
209
|
+
rspec:
|
|
210
|
+
cmds:
|
|
211
|
+
- task: rspec:standard
|
|
212
|
+
- task: rspec:rails_5.2
|
|
213
|
+
- task: rspec:rails_6.0
|
|
214
|
+
- task: rspec:rails_6.1
|
|
215
|
+
- task: rspec:rails_7.0
|
|
216
|
+
- task: rspec:dry
|
|
217
|
+
|
|
218
|
+
##
|
|
219
|
+
# NOTE: Run rspec only for git staged spec files.
|
|
220
|
+
# https://githowto.com/staging_and_committing
|
|
221
|
+
#
|
|
222
|
+
rspec:staged:
|
|
223
|
+
cmds:
|
|
224
|
+
- task: rspec:standard:staged
|
|
225
|
+
- task: rspec:rails_5.2:staged
|
|
226
|
+
- task: rspec:rails_6.0:staged
|
|
227
|
+
- task: rspec:rails_6.1:staged
|
|
228
|
+
- task: rspec:rails_7.0:staged
|
|
229
|
+
- task: rspec:dry:staged
|
|
230
|
+
|
|
231
|
+
rspec:dry:
|
|
232
|
+
cmds:
|
|
233
|
+
- bundle exec appraisal dry rspec --format progress --require dry_helper {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}}
|
|
234
|
+
|
|
235
|
+
rspec:dry:staged:
|
|
236
|
+
- task: rspec:dry
|
|
237
|
+
vars:
|
|
238
|
+
GIT_STAGED_SPEC_FILES:
|
|
239
|
+
##
|
|
240
|
+
# NOTE: `task: git:staged:specs` does NOT work.
|
|
241
|
+
#
|
|
242
|
+
sh: task git:staged:specs --silent
|
|
243
|
+
|
|
244
|
+
rspec:rails_5.2:
|
|
245
|
+
cmds:
|
|
246
|
+
- bundle exec appraisal rails_5.2 rspec --format progress --require rails_helper {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}}
|
|
247
|
+
|
|
248
|
+
rspec:rails_5.2:staged:
|
|
249
|
+
- task: rspec:rails_5.2
|
|
250
|
+
vars:
|
|
251
|
+
GIT_STAGED_SPEC_FILES:
|
|
252
|
+
##
|
|
253
|
+
# NOTE: `task: git:staged:specs` does NOT work.
|
|
254
|
+
#
|
|
255
|
+
sh: task git:staged:specs --silent
|
|
256
|
+
|
|
257
|
+
rspec:rails_6.0:
|
|
258
|
+
cmds:
|
|
259
|
+
- bundle exec appraisal rails_6.0 rspec --format progress --require rails_helper {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}}
|
|
260
|
+
|
|
261
|
+
rspec:rails_6.0:staged:
|
|
262
|
+
- task: rspec:rails_6.0
|
|
263
|
+
vars:
|
|
264
|
+
GIT_STAGED_SPEC_FILES:
|
|
265
|
+
##
|
|
266
|
+
# NOTE: `task: git:staged:specs` does NOT work.
|
|
267
|
+
#
|
|
268
|
+
sh: task git:staged:specs --silent
|
|
269
|
+
|
|
270
|
+
rspec:rails_6.1:
|
|
271
|
+
cmds:
|
|
272
|
+
- bundle exec appraisal rails_6.1 rspec --format progress --require rails_helper {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}}
|
|
273
|
+
|
|
274
|
+
rspec:rails_6.1:staged:
|
|
275
|
+
- task: rspec:rails_6.1
|
|
276
|
+
vars:
|
|
277
|
+
GIT_STAGED_SPEC_FILES:
|
|
278
|
+
##
|
|
279
|
+
# NOTE: `task: git:staged:specs` does NOT work.
|
|
280
|
+
#
|
|
281
|
+
sh: task git:staged:specs --silent
|
|
282
|
+
|
|
283
|
+
rspec:rails_7.0:
|
|
284
|
+
cmds:
|
|
285
|
+
- bundle exec appraisal rails_7.0 rspec --format progress --require rails_helper {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}}
|
|
286
|
+
|
|
287
|
+
rspec:rails_7.0:staged:
|
|
288
|
+
- task: rspec:rails_7.0
|
|
289
|
+
vars:
|
|
290
|
+
GIT_STAGED_SPEC_FILES:
|
|
291
|
+
##
|
|
292
|
+
# NOTE: `task: git:staged:specs` does NOT work.
|
|
293
|
+
#
|
|
294
|
+
sh: task git:staged:specs --silent
|
|
295
|
+
|
|
296
|
+
rspec:standard:
|
|
297
|
+
cmds:
|
|
298
|
+
- bundle exec rspec --format progress {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}}
|
|
299
|
+
|
|
300
|
+
rspec:standard:staged:
|
|
301
|
+
cmds:
|
|
302
|
+
- task: rspec:standard
|
|
303
|
+
vars:
|
|
304
|
+
GIT_STAGED_SPEC_FILES:
|
|
305
|
+
##
|
|
306
|
+
# NOTE: `task: git:staged:specs` does NOT work.
|
|
307
|
+
#
|
|
308
|
+
sh: task git:staged:specs --silent
|
|
309
|
+
|
|
310
|
+
rubocop:
|
|
311
|
+
cmds:
|
|
312
|
+
- bundle exec rubocop --config .rubocop.yml {{.CLI_ARGS}}
|
|
313
|
+
|
|
314
|
+
rubocop:format:
|
|
315
|
+
cmds:
|
|
316
|
+
- bundle exec rubocop --config .rubocop.yml -A {{.CLI_ARGS}}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/convenient_service/specification"
|
|
4
|
+
require_relative "lib/convenient_service/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = ConvenientService::Specification::NAME
|
|
8
|
+
spec.authors = ConvenientService::Specification::AUTHORS
|
|
9
|
+
spec.email = ConvenientService::Specification::EMAIL
|
|
10
|
+
spec.homepage = ConvenientService::Specification::HOMEPAGE
|
|
11
|
+
spec.summary = ConvenientService::Specification::SUMMARY
|
|
12
|
+
spec.description = ConvenientService::Specification::DESCRIPTION
|
|
13
|
+
|
|
14
|
+
spec.version = ConvenientService::VERSION
|
|
15
|
+
|
|
16
|
+
spec.license = "MIT"
|
|
17
|
+
|
|
18
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
|
19
|
+
|
|
20
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
21
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
22
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/CHANGELOG.md"
|
|
23
|
+
|
|
24
|
+
# Specify which files should be added to the gem when it is released.
|
|
25
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
26
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
27
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
31
|
+
|
|
32
|
+
spec.add_development_dependency "appraisal"
|
|
33
|
+
spec.add_development_dependency "awesome_print"
|
|
34
|
+
spec.add_development_dependency "byebug", "~> 10.0"
|
|
35
|
+
spec.add_development_dependency "commonmarker"
|
|
36
|
+
spec.add_development_dependency "gem-release"
|
|
37
|
+
spec.add_development_dependency "inch"
|
|
38
|
+
spec.add_development_dependency "paint"
|
|
39
|
+
spec.add_development_dependency "progressbar"
|
|
40
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
|
41
|
+
spec.add_development_dependency "rerun"
|
|
42
|
+
spec.add_development_dependency "rouge"
|
|
43
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
44
|
+
spec.add_development_dependency "rubocop"
|
|
45
|
+
spec.add_development_dependency "rubocop-rspec"
|
|
46
|
+
spec.add_development_dependency "tty-prompt"
|
|
47
|
+
spec.add_development_dependency "standard"
|
|
48
|
+
spec.add_development_dependency "simplecov"
|
|
49
|
+
spec.add_development_dependency "simplecov-lcov"
|
|
50
|
+
spec.add_development_dependency "yard"
|
|
51
|
+
spec.add_development_dependency "yard-junk"
|
|
52
|
+
end
|
data/coverage/.gitkeep
ADDED
|
File without changes
|
|
@@ -0,0 +1,73 @@
|
|
|
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/3.0/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 used in CI.
|
|
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
|
|
@@ -0,0 +1,73 @@
|
|
|
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 used in CI.
|
|
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
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
##
|
|
2
|
+
# Ruby 3.1 with Node.js 16.x.
|
|
3
|
+
#
|
|
4
|
+
# NOTE: Linted by hadolint.
|
|
5
|
+
#
|
|
6
|
+
# docker run --rm -i ghcr.io/hadolint/hadolint < docker/3.1/Dockerfile
|
|
7
|
+
#
|
|
8
|
+
# NOTE: A command to build image.
|
|
9
|
+
#
|
|
10
|
+
# cd convenient_service
|
|
11
|
+
# cp Gemfile Gemfile.3.1
|
|
12
|
+
# docker build . -f docker/3.1/Dockerfile -t convenient_service:3.1
|
|
13
|
+
# # or `task docker:build:ruby_3.1`
|
|
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.1 bash
|
|
19
|
+
# # or `task docker:bash:ruby_3.1`
|
|
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 used in CI.
|
|
25
|
+
# - https://github.com/timbru31/docker-ruby-node/tree/master/3.1/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.1-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.1
|
|
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
|