convenient_service 0.14.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/.github/contributing.md +15 -0
  3. data/.github/workflows/cd.yml +5 -4
  4. data/.github/workflows/ci.yml +5 -5
  5. data/.gitignore +15 -1
  6. data/.ruby-version +1 -1
  7. data/.tool-versions +1 -1
  8. data/.vscode/CacheItsValue.code-snippets +1 -1
  9. data/.yardopts +4 -1
  10. data/CHANGELOG.md +29 -0
  11. data/COMM-LICENSE.txt +99 -0
  12. data/LICENSE.txt +7 -19
  13. data/README.md +1 -1
  14. data/ROADMAP.md +14 -7
  15. data/Taskfile.yml +14 -2
  16. data/docs/.gitkeep +0 -0
  17. data/docs/api/.gitkeep +0 -0
  18. data/lib/convenient_service/dependencies.rb +2 -2
  19. data/lib/convenient_service/examples/dry/gemfile.rb +4 -2
  20. data/lib/convenient_service/examples/dry/v1/gemfile.rb +4 -2
  21. data/lib/convenient_service/examples/rails/gemfile.rb +4 -2
  22. data/lib/convenient_service/examples/rails/v1/gemfile.rb +4 -2
  23. data/lib/convenient_service/examples/standard/cowsay.rb +4 -2
  24. data/lib/convenient_service/examples/standard/date_time.rb +4 -2
  25. data/lib/convenient_service/examples/standard/factorial.rb +4 -2
  26. data/lib/convenient_service/examples/standard/gemfile.rb +4 -2
  27. data/lib/convenient_service/examples/standard/request_params.rb +4 -2
  28. data/lib/convenient_service/examples/standard/v1/cowsay.rb +1 -1
  29. data/lib/convenient_service/examples/standard/v1/date_time.rb +1 -1
  30. data/lib/convenient_service/examples/standard/v1/factorial.rb +1 -1
  31. data/lib/convenient_service/examples/standard/v1/gemfile.rb +1 -1
  32. data/lib/convenient_service/examples/standard/v1/request_params.rb +1 -1
  33. data/lib/convenient_service/feature/configs/aliases.rb +9 -0
  34. data/lib/convenient_service/feature/configs/standard.rb +22 -0
  35. data/lib/convenient_service/feature/configs.rb +5 -0
  36. data/lib/convenient_service/feature/plugins/aliases.rb +7 -0
  37. data/lib/convenient_service/feature/plugins/can_have_entries/commands/define_entry.rb +63 -0
  38. data/lib/convenient_service/feature/plugins/can_have_entries/commands.rb +3 -0
  39. data/lib/convenient_service/feature/plugins/can_have_entries/concern.rb +24 -0
  40. data/lib/convenient_service/feature/plugins/can_have_entries/exceptions.rb +35 -0
  41. data/lib/convenient_service/feature/plugins/can_have_entries.rb +5 -0
  42. data/lib/convenient_service/feature/plugins.rb +5 -0
  43. data/lib/convenient_service/feature.rb +2 -9
  44. data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/constants.rb +1 -1
  45. data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/entities/result_spec.rb +8 -8
  46. data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/entities/stubbed_service.rb +6 -6
  47. data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service.rb +1 -1
  48. data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method/entities/wrapped_method.rb +6 -6
  49. data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method/exceptions.rb +1 -1
  50. data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method.rb +2 -2
  51. data/lib/convenient_service/rspec/helpers/classes.rb +4 -0
  52. data/lib/convenient_service/rspec/helpers/ignoring_exception.rb +1 -1
  53. data/lib/convenient_service/rspec/helpers/stub_service.rb +5 -5
  54. data/lib/convenient_service/rspec/helpers/wrap_method.rb +1 -1
  55. data/lib/convenient_service/rspec/helpers.rb +4 -6
  56. data/lib/convenient_service/rspec/matchers/call_chain_next.rb +1 -1
  57. data/lib/convenient_service/rspec/matchers/{custom → classes}/call_chain_next.rb +8 -8
  58. data/lib/convenient_service/rspec/matchers/{custom → classes}/export.rb +1 -1
  59. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/constants.rb +1 -1
  60. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/chain.rb +1 -1
  61. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_code_part.rb +4 -4
  62. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_data_part.rb +4 -4
  63. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_message_part.rb +4 -4
  64. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_parts.rb +3 -3
  65. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_service_part.rb +4 -4
  66. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_status_part.rb +4 -4
  67. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_step_part.rb +4 -4
  68. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_got_parts.rb +3 -3
  69. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_got_service_part.rb +4 -4
  70. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_got_step_part.rb +4 -4
  71. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base.rb +4 -4
  72. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/error/commands/generate_got_jsend_attributes_part.rb +4 -4
  73. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/error.rb +1 -1
  74. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/failure/commands/generate_got_jsend_attributes_part.rb +4 -4
  75. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/failure.rb +1 -1
  76. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/null.rb +1 -1
  77. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/success/commands/generate_got_jsend_attributes_part.rb +4 -4
  78. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/success.rb +1 -1
  79. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers.rb +3 -3
  80. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result.rb +4 -4
  81. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_code.rb +5 -5
  82. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_data.rb +5 -5
  83. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_message.rb +5 -5
  84. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_service.rb +5 -5
  85. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_status.rb +5 -5
  86. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_step.rb +6 -6
  87. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_type.rb +5 -5
  88. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator.rb +3 -3
  89. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/exceptions.rb +1 -1
  90. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base.rb +15 -15
  91. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_error.rb +1 -1
  92. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_failure.rb +1 -1
  93. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_not_error.rb +1 -1
  94. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_not_failure.rb +1 -1
  95. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_not_success.rb +1 -1
  96. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_success.rb +1 -1
  97. data/lib/convenient_service/rspec/matchers/classes.rb +5 -0
  98. data/lib/convenient_service/rspec/matchers/delegate_to.rb +1 -1
  99. data/lib/convenient_service/rspec/matchers/export.rb +1 -1
  100. data/lib/convenient_service/rspec/matchers/include_module.rb +1 -1
  101. data/lib/convenient_service/rspec/matchers/results/be_error.rb +1 -1
  102. data/lib/convenient_service/rspec/matchers/results/be_failure.rb +1 -1
  103. data/lib/convenient_service/rspec/matchers/results/be_not_error.rb +1 -1
  104. data/lib/convenient_service/rspec/matchers/results/be_not_failure.rb +1 -1
  105. data/lib/convenient_service/rspec/matchers/results/be_not_success.rb +1 -1
  106. data/lib/convenient_service/rspec/matchers/results/be_result.rb +6 -6
  107. data/lib/convenient_service/rspec/matchers/results/be_success.rb +1 -1
  108. data/lib/convenient_service/rspec/matchers.rb +6 -28
  109. data/lib/convenient_service/rspec/{helpers/custom → primitive_helpers/classes}/ignoring_exception/exceptions.rb +2 -2
  110. data/lib/convenient_service/rspec/{helpers/custom → primitive_helpers/classes}/ignoring_exception.rb +3 -3
  111. data/lib/convenient_service/rspec/{helpers/custom → primitive_helpers/classes}/in_threads.rb +2 -2
  112. data/lib/convenient_service/rspec/primitive_helpers/classes.rb +4 -0
  113. data/lib/convenient_service/rspec/primitive_helpers/ignoring_exception.rb +13 -0
  114. data/lib/convenient_service/rspec/{helpers → primitive_helpers}/in_threads.rb +2 -2
  115. data/lib/convenient_service/rspec/primitive_helpers.rb +19 -0
  116. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/be_descendant_of.rb +2 -2
  117. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/be_direct_descendant_of.rb +2 -2
  118. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/cache_its_value.rb +2 -2
  119. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/be_descendant_of.rb +2 -2
  120. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/be_direct_descendant_of.rb +2 -2
  121. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/cache_its_value.rb +2 -2
  122. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/commands/generate_printable_method.rb +2 -2
  123. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands/apply_stub_to_track_delegations.rb +4 -4
  124. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands/generate_printable_arguments.rb +4 -4
  125. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments.rb +2 -2
  126. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/base.rb +5 -5
  127. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/return_its_value.rb +2 -2
  128. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_any_arguments.rb +2 -2
  129. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_concrete_arguments.rb +2 -2
  130. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/without_arguments.rb +2 -2
  131. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/values/base.rb +4 -4
  132. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/values/with_calling_original.rb +2 -2
  133. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/values/without_calling_original.rb +2 -2
  134. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings_collection/exceptions.rb +2 -2
  135. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings_collection.rb +13 -13
  136. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/delegation.rb +3 -3
  137. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher.rb +13 -13
  138. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to.rb +13 -13
  139. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/extend_module.rb +2 -2
  140. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_abstract_method.rb +2 -2
  141. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_alias_method.rb +2 -2
  142. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_attr_accessor.rb +4 -4
  143. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_attr_reader.rb +2 -2
  144. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_attr_writer.rb +2 -2
  145. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/include_module.rb +2 -2
  146. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/prepend_module.rb +2 -2
  147. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/singleton_prepend_module.rb +2 -2
  148. data/lib/convenient_service/rspec/primitive_matchers/classes.rb +15 -0
  149. data/lib/convenient_service/rspec/primitive_matchers/delegate_to.rb +13 -0
  150. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/extend_module.rb +2 -2
  151. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_abstract_method.rb +2 -2
  152. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_alias_method.rb +2 -2
  153. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_attr_accessor.rb +2 -2
  154. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_attr_reader.rb +2 -2
  155. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_attr_writer.rb +2 -2
  156. data/lib/convenient_service/rspec/primitive_matchers/include_module.rb +13 -0
  157. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/prepend_module.rb +2 -2
  158. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/singleton_prepend_module.rb +2 -2
  159. data/lib/convenient_service/rspec/primitive_matchers.rb +41 -0
  160. data/lib/convenient_service/rspec.rb +3 -0
  161. data/lib/convenient_service/{configs → service/configs}/aliases.rb +1 -1
  162. data/lib/convenient_service/{configs → service/configs}/awesome_print_inspect/aliases.rb +1 -1
  163. data/lib/convenient_service/service/configs/awesome_print_inspect.rb +61 -0
  164. data/lib/convenient_service/service/configs/minimal.rb +261 -0
  165. data/lib/convenient_service/{configs → service/configs}/standard/aliases.rb +1 -1
  166. data/lib/convenient_service/service/configs/standard/v1.rb +185 -0
  167. data/lib/convenient_service/service/configs/standard.rb +238 -0
  168. data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +9 -3
  169. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/exceptions.rb +32 -0
  170. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/middleware.rb +33 -0
  171. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value.rb +4 -0
  172. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb +1 -0
  173. data/lib/convenient_service/service/plugins/can_have_steps/entities/step_collection.rb +16 -0
  174. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/instance_methods.rb +24 -0
  175. data/lib/convenient_service/service.rb +1 -0
  176. data/lib/convenient_service/support/dependency_container/commands.rb +0 -1
  177. data/lib/convenient_service/support/dependency_container.rb +0 -1
  178. data/lib/convenient_service/version.rb +1 -1
  179. data/lib/convenient_service.rb +0 -1
  180. data/yard/yard-convenient_service_concern.rb +45 -0
  181. metadata +143 -120
  182. data/lib/convenient_service/configs/awesome_print_inspect.rb +0 -59
  183. data/lib/convenient_service/configs/minimal.rb +0 -257
  184. data/lib/convenient_service/configs/standard/v1.rb +0 -183
  185. data/lib/convenient_service/configs/standard.rb +0 -234
  186. data/lib/convenient_service/rspec/helpers/custom.rb +0 -6
  187. data/lib/convenient_service/rspec/matchers/custom.rb +0 -18
  188. data/lib/convenient_service/support/dependency_container/commands/define_entry.rb +0 -49
  189. data/lib/convenient_service/support/dependency_container/entry.rb +0 -22
  190. /data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/entities.rb +0 -0
  191. /data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method/entities.rb +0 -0
  192. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands.rb +0 -0
  193. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/error/commands.rb +0 -0
  194. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/failure/commands.rb +0 -0
  195. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/success/commands.rb +0 -0
  196. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands.rb +0 -0
  197. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities.rb +0 -0
  198. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results.rb +0 -0
  199. /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/commands.rb +0 -0
  200. /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands.rb +0 -0
  201. /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings.rb +0 -0
  202. /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities.rb +0 -0
  203. /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities.rb +0 -0
  204. /data/lib/convenient_service/{configs.rb → service/configs.rb} +0 -0
@@ -1,257 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ConvenientService
4
- module Configs
5
- ##
6
- # Defines minimal configuration that adds a constructor, JSend-inspired result, steps, basic inspects, and internals to services.
7
- #
8
- # @note This config is NOT intented for the end-user usage. Use `Standard` instead.
9
- #
10
- # @note
11
- # `use Plugins::Common::NormalizesEnv::Middleware` should be used in a config that has the first `concern` that introduces a method.
12
- # For example, `:result` is added by `use Plugins::Service::HasJSendResult::Concern` in `Minimal`.
13
- # That is why the following code is written in the `Minimal` config.
14
- #
15
- # middlewares :result do
16
- # use Plugins::Common::NormalizesEnv::Middleware
17
- #
18
- # # ...
19
- # end
20
- #
21
- # In turn, `:fallback_result` is added by `use Plugins::Service::CanHaveFallbacks::Concern` in `Standard`.
22
- # That is why it is the responsibility of the `Standard` config, to define:
23
- #
24
- # middlewares :fallback_result do
25
- # use Plugins::Common::NormalizesEnv::Middleware
26
- #
27
- # # ...
28
- # end
29
- #
30
- # @internal
31
- # NOTE: Heavily used in specs to test concerns and middlewares in isolation.
32
- #
33
- module Minimal
34
- include Support::Concern
35
-
36
- ##
37
- # @internal
38
- # IMPORTANT: Order of plugins matters.
39
- #
40
- # NOTE: `class_exec` (that is used under the hood by `included`) defines `class Result` in the global namespace.
41
- # That is why `class self::Result` is used.
42
- # - https://stackoverflow.com/a/51965126/12201472
43
- #
44
- # rubocop:disable Lint/ConstantDefinitionInBlock
45
- included do
46
- include Core
47
-
48
- concerns do
49
- use Plugins::Common::HasInternals::Concern
50
-
51
- use Plugins::Service::HasInspect::Concern
52
-
53
- use Plugins::Common::HasConstructor::Concern
54
- use Plugins::Common::HasConstructorWithoutInitialize::Concern
55
-
56
- use Plugins::Service::HasResult::Concern
57
- use Plugins::Service::HasJSendResult::Concern
58
- use Plugins::Service::CanHaveSteps::Concern
59
- end
60
-
61
- middlewares :initialize do
62
- use Plugins::Common::NormalizesEnv::Middleware
63
- end
64
-
65
- middlewares :result do
66
- use Plugins::Common::NormalizesEnv::Middleware
67
- use Plugins::Common::CachesReturnValue::Middleware
68
-
69
- use Plugins::Service::RaisesOnNotResultReturnValue::Middleware
70
-
71
- use Plugins::Service::CanHaveSteps::Middleware
72
- end
73
-
74
- middlewares :step do
75
- use Plugins::Common::NormalizesEnv::Middleware
76
- end
77
-
78
- middlewares :success do
79
- use Plugins::Common::NormalizesEnv::Middleware
80
- end
81
-
82
- middlewares :failure do
83
- use Plugins::Common::NormalizesEnv::Middleware
84
- end
85
-
86
- middlewares :error do
87
- use Plugins::Common::NormalizesEnv::Middleware
88
- end
89
-
90
- middlewares :result, scope: :class do
91
- use Plugins::Common::NormalizesEnv::Middleware
92
- end
93
-
94
- middlewares :step, scope: :class do
95
- use Plugins::Common::NormalizesEnv::Middleware
96
-
97
- use Plugins::Service::CanHaveMethodSteps::Middleware
98
- end
99
-
100
- class self::Internals
101
- include Core
102
-
103
- concerns do
104
- use Plugins::Internals::HasCache::Concern
105
- end
106
- end
107
-
108
- class self::Result
109
- include Core
110
-
111
- concerns do
112
- use Plugins::Common::HasInternals::Concern
113
-
114
- use Plugins::Result::HasInspect::Concern
115
-
116
- use Plugins::Common::HasConstructor::Concern
117
- use Plugins::Common::HasConstructorWithoutInitialize::Concern
118
-
119
- use Plugins::Result::HasJSendStatusAndAttributes::Concern
120
- end
121
-
122
- middlewares :initialize do
123
- use Plugins::Common::NormalizesEnv::Middleware
124
-
125
- use Plugins::Result::HasJSendStatusAndAttributes::Middleware
126
- end
127
-
128
- middlewares :success? do
129
- use Plugins::Common::NormalizesEnv::Middleware
130
- end
131
-
132
- middlewares :failure? do
133
- use Plugins::Common::NormalizesEnv::Middleware
134
- end
135
-
136
- middlewares :error? do
137
- use Plugins::Common::NormalizesEnv::Middleware
138
- end
139
-
140
- middlewares :not_success? do
141
- use Plugins::Common::NormalizesEnv::Middleware
142
- end
143
-
144
- middlewares :not_failure? do
145
- use Plugins::Common::NormalizesEnv::Middleware
146
- end
147
-
148
- middlewares :not_error? do
149
- use Plugins::Common::NormalizesEnv::Middleware
150
- end
151
-
152
- middlewares :data do
153
- use Plugins::Common::NormalizesEnv::Middleware
154
- end
155
-
156
- middlewares :message do
157
- use Plugins::Common::NormalizesEnv::Middleware
158
- end
159
-
160
- middlewares :code do
161
- use Plugins::Common::NormalizesEnv::Middleware
162
- end
163
-
164
- middlewares :to_kwargs do
165
- use Plugins::Common::NormalizesEnv::Middleware
166
- end
167
-
168
- class self::Data
169
- include Core
170
-
171
- concerns do
172
- use Plugins::Data::HasInspect::Concern
173
- end
174
- end
175
-
176
- class self::Message
177
- include Core
178
-
179
- concerns do
180
- use Plugins::Message::HasInspect::Concern
181
- end
182
- end
183
-
184
- class self::Code
185
- include Core
186
-
187
- concerns do
188
- use Plugins::Code::HasInspect::Concern
189
- end
190
- end
191
-
192
- class self::Status
193
- include Core
194
-
195
- concerns do
196
- use Plugins::Status::HasInspect::Concern
197
- end
198
- end
199
-
200
- class self::Internals
201
- include Core
202
-
203
- concerns do
204
- use Plugins::Internals::HasCache::Concern
205
- end
206
- end
207
- end
208
-
209
- class self::Step
210
- include Core
211
-
212
- concerns do
213
- use Plugins::Common::HasInternals::Concern
214
-
215
- use Plugins::Step::CanBeCompleted::Concern
216
-
217
- use Plugins::Step::CanBeMethodStep::Concern
218
- use Plugins::Step::CanBeResultStep::Concern
219
-
220
- use Plugins::Step::HasInspect::Concern
221
- end
222
-
223
- middlewares :service_result do
224
- use Plugins::Common::NormalizesEnv::Middleware
225
- use Plugins::Common::CachesReturnValue::Middleware
226
-
227
- use Plugins::Step::CanBeResultStep::CanBeExecuted::Middleware
228
- use Plugins::Step::CanBeMethodStep::CanBeExecuted::Middleware
229
- end
230
-
231
- middlewares :result do
232
- use Plugins::Common::NormalizesEnv::Middleware
233
- use Plugins::Common::CachesReturnValue::Middleware
234
- end
235
-
236
- ##
237
- # TODO: Rename.
238
- #
239
- middlewares :printable_service do
240
- use Plugins::Common::NormalizesEnv::Middleware
241
-
242
- use Plugins::Step::CanBeMethodStep::CanBePrinted::Middleware
243
- end
244
-
245
- class self::Internals
246
- include Core
247
-
248
- concerns do
249
- use Plugins::Internals::HasCache::Concern
250
- end
251
- end
252
- end
253
- end
254
- # rubocop:enable Lint/ConstantDefinitionInBlock
255
- end
256
- end
257
- end
@@ -1,183 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ConvenientService
4
- module Configs
5
- ##
6
- # Default configuration for the user-defined services.
7
- #
8
- module Standard
9
- module V1
10
- include Support::Concern
11
-
12
- ##
13
- # @internal
14
- # IMPORTANT: Order of plugins matters.
15
- #
16
- # NOTE: `class_exec` (that is used under the hood by `included`) defines `class Result` in the global namespace.
17
- # That is why `class self::Result` is used.
18
- # - https://stackoverflow.com/a/51965126/12201472
19
- #
20
- # rubocop:disable Lint/ConstantDefinitionInBlock
21
- included do
22
- include Configs::Minimal
23
-
24
- concerns do
25
- use Plugins::Common::CachesConstructorArguments::Concern
26
- use Plugins::Common::CanBeCopied::Concern
27
- use Plugins::Service::CanRecalculateResult::Concern
28
- use Plugins::Service::HasJSendResultShortSyntax::Concern
29
- use Plugins::Service::HasJSendResultStatusCheckShortSyntax::Concern
30
-
31
- use Plugins::Common::HasCallbacks::Concern
32
- use Plugins::Common::HasAroundCallbacks::Concern
33
-
34
- use Plugins::Service::HasMermaidFlowchart::Concern
35
- end
36
-
37
- middlewares :initialize do
38
- use Plugins::Service::CollectsServicesInException::Middleware
39
- use Plugins::Common::CachesConstructorArguments::Middleware
40
- end
41
-
42
- middlewares :result do
43
- insert_after \
44
- Plugins::Common::NormalizesEnv::Middleware,
45
- Plugins::Service::CollectsServicesInException::Middleware
46
-
47
- insert_before \
48
- Plugins::Service::RaisesOnNotResultReturnValue::Middleware,
49
- Plugins::Common::HasCallbacks::Middleware
50
-
51
- insert_after \
52
- Plugins::Common::HasCallbacks::Middleware,
53
- Plugins::Common::HasAroundCallbacks::Middleware
54
-
55
- ##
56
- # TODO: Rewrite. This plugin does NOT do what it states. Probably I was NOT with a clear mind while writing it (facepalm).
57
- #
58
- # use Plugins::Service::RaisesOnDoubleResult::Middleware
59
-
60
- insert_before \
61
- Plugins::Service::RaisesOnNotResultReturnValue::Middleware,
62
- Plugins::Service::SetsParentToForeignResult::Middleware
63
- end
64
-
65
- middlewares :step do
66
- use Plugins::Common::HasCallbacks::Middleware
67
- use Plugins::Common::HasAroundCallbacks::Middleware
68
- end
69
-
70
- middlewares :success do
71
- use Plugins::Service::HasJSendResultShortSyntax::Success::Middleware
72
- end
73
-
74
- middlewares :failure do
75
- use Plugins::Service::HasJSendResultShortSyntax::Failure::Middleware
76
- end
77
-
78
- middlewares :error do
79
- use Plugins::Service::HasJSendResultShortSyntax::Error::Middleware
80
- end
81
-
82
- class self::Result
83
- concerns do
84
- use Plugins::Common::HasJSendResultDuckShortSyntax::Concern
85
- use Plugins::Result::CanRecalculateResult::Concern
86
-
87
- use Plugins::Result::CanHaveStep::Concern
88
- use Plugins::Result::CanBeOwnResult::Concern
89
- use Plugins::Result::CanHaveParentResult::Concern
90
- use Plugins::Result::CanHaveCheckedStatus::Concern
91
- end
92
-
93
- middlewares :success? do
94
- use Plugins::Result::CanHaveCheckedStatus::Middleware
95
- end
96
-
97
- middlewares :failure? do
98
- use Plugins::Result::CanHaveCheckedStatus::Middleware
99
- end
100
-
101
- middlewares :error? do
102
- use Plugins::Result::CanHaveCheckedStatus::Middleware
103
- end
104
-
105
- middlewares :not_success? do
106
- use Plugins::Result::CanHaveCheckedStatus::Middleware
107
- end
108
-
109
- middlewares :not_failure? do
110
- use Plugins::Result::CanHaveCheckedStatus::Middleware
111
- end
112
-
113
- middlewares :not_error? do
114
- use Plugins::Result::CanHaveCheckedStatus::Middleware
115
- end
116
-
117
- middlewares :data do
118
- use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
119
- end
120
-
121
- middlewares :message do
122
- use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
123
- end
124
-
125
- middlewares :code do
126
- use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
127
- end
128
- end
129
-
130
- class self::Step
131
- concerns do
132
- use Plugins::Common::HasJSendResultDuckShortSyntax::Concern
133
- end
134
-
135
- middlewares :result do
136
- use Plugins::Step::CanHaveParentResult::Middleware
137
- end
138
- end
139
-
140
- if Dependencies.rspec.loaded?
141
- concerns do
142
- insert_before 0, Plugins::Service::CanHaveStubbedResults::Concern
143
- end
144
-
145
- middlewares :result do
146
- insert_after \
147
- Plugins::Common::NormalizesEnv::Middleware,
148
- Plugins::Service::CanHaveStubbedResults::Middleware
149
-
150
- insert_before \
151
- Plugins::Service::CanHaveStubbedResults::Middleware,
152
- Plugins::Service::CountsStubbedResultsInvocations::Middleware
153
- end
154
-
155
- middlewares :result, scope: :class do
156
- insert_after \
157
- Plugins::Common::NormalizesEnv::Middleware,
158
- Plugins::Service::CanHaveStubbedResults::Middleware
159
-
160
- insert_before \
161
- Plugins::Service::CanHaveStubbedResults::Middleware,
162
- Plugins::Service::CountsStubbedResultsInvocations::Middleware
163
- end
164
-
165
- class self::Result
166
- concerns do
167
- use Plugins::Result::CanBeStubbedResult::Concern
168
- use Plugins::Result::HasStubbedResultInvocationsCounter::Concern
169
- end
170
-
171
- middlewares :initialize do
172
- insert_before \
173
- Plugins::Result::HasJSendStatusAndAttributes::Middleware,
174
- Plugins::Result::HasStubbedResultInvocationsCounter::Middleware
175
- end
176
- end
177
- end
178
- end
179
- # rubocop:enable Lint/ConstantDefinitionInBlock
180
- end
181
- end
182
- end
183
- end
@@ -1,234 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "standard/v1"
4
- require_relative "standard/aliases"
5
-
6
- module ConvenientService
7
- module Configs
8
- ##
9
- # Default configuration for the user-defined services.
10
- #
11
- module Standard
12
- include Support::Concern
13
-
14
- ##
15
- # @internal
16
- # IMPORTANT: Order of plugins matters.
17
- #
18
- # NOTE: `class_exec` (that is used under the hood by `included`) defines `class Result` in the global namespace.
19
- # That is why `class self::Result` is used.
20
- # - https://stackoverflow.com/a/51965126/12201472
21
- #
22
- # rubocop:disable Lint/ConstantDefinitionInBlock
23
- included do
24
- include Configs::Minimal
25
-
26
- concerns do
27
- use Plugins::Common::CachesConstructorArguments::Concern
28
- use Plugins::Common::CanBeCopied::Concern
29
- use Plugins::Service::CanRecalculateResult::Concern
30
- use Plugins::Service::HasJSendResultShortSyntax::Concern
31
- use Plugins::Service::HasJSendResultStatusCheckShortSyntax::Concern
32
-
33
- use Plugins::Common::HasCallbacks::Concern
34
- use Plugins::Common::HasAroundCallbacks::Concern
35
-
36
- use Plugins::Service::CanHaveFallbacks::Concern
37
- use Plugins::Service::HasMermaidFlowchart::Concern
38
- end
39
-
40
- middlewares :initialize do
41
- use Plugins::Service::CollectsServicesInException::Middleware
42
- use Plugins::Common::CachesConstructorArguments::Middleware
43
- end
44
-
45
- middlewares :result do
46
- insert_after \
47
- Plugins::Common::NormalizesEnv::Middleware,
48
- Plugins::Service::CollectsServicesInException::Middleware
49
-
50
- insert_before \
51
- Plugins::Service::RaisesOnNotResultReturnValue::Middleware,
52
- Plugins::Common::HasCallbacks::Middleware
53
-
54
- insert_after \
55
- Plugins::Common::HasCallbacks::Middleware,
56
- Plugins::Common::HasAroundCallbacks::Middleware
57
-
58
- ##
59
- # TODO: Rewrite. This plugin does NOT do what it states. Probably I was NOT with a clear mind while writing it (facepalm).
60
- #
61
- # use Plugins::Service::RaisesOnDoubleResult::Middleware
62
-
63
- insert_before \
64
- Plugins::Service::RaisesOnNotResultReturnValue::Middleware,
65
- Plugins::Service::SetsParentToForeignResult::Middleware
66
- end
67
-
68
- ##
69
- # @internal
70
- # NOTE: Check `Minimal` docs to understand why `use Plugins::Common::NormalizesEnv::Middleware` for `:fallback_failure_result` is used in `Standard`, not in `Minimal` config.
71
- #
72
- middlewares :fallback_failure_result do
73
- use Plugins::Common::NormalizesEnv::Middleware
74
- use Plugins::Service::CollectsServicesInException::Middleware
75
- use Plugins::Common::CachesReturnValue::Middleware
76
-
77
- use Plugins::Service::RaisesOnNotResultReturnValue::Middleware
78
- use Plugins::Service::CanHaveFallbacks::Middleware.with(status: :failure)
79
- end
80
-
81
- ##
82
- # @internal
83
- # NOTE: Check `Minimal` docs to understand why `use Plugins::Common::NormalizesEnv::Middleware` for `:fallback_error_result` is used in `Standard`, not in `Minimal` config.
84
- #
85
- middlewares :fallback_error_result do
86
- use Plugins::Common::NormalizesEnv::Middleware
87
- use Plugins::Service::CollectsServicesInException::Middleware
88
- use Plugins::Common::CachesReturnValue::Middleware
89
-
90
- use Plugins::Service::RaisesOnNotResultReturnValue::Middleware
91
- use Plugins::Service::CanHaveFallbacks::Middleware.with(status: :error)
92
- end
93
-
94
- middlewares :step do
95
- use Plugins::Common::HasCallbacks::Middleware
96
- use Plugins::Common::HasAroundCallbacks::Middleware
97
- end
98
-
99
- middlewares :success do
100
- use Plugins::Service::HasJSendResultShortSyntax::Success::Middleware
101
- end
102
-
103
- middlewares :failure do
104
- use Plugins::Service::HasJSendResultShortSyntax::Failure::Middleware
105
- end
106
-
107
- middlewares :error do
108
- use Plugins::Service::HasJSendResultShortSyntax::Error::Middleware
109
- end
110
-
111
- class self::Result
112
- concerns do
113
- use Plugins::Common::HasJSendResultDuckShortSyntax::Concern
114
- use Plugins::Result::CanRecalculateResult::Concern
115
-
116
- use Plugins::Result::CanHaveStep::Concern
117
- use Plugins::Result::CanBeOwnResult::Concern
118
- use Plugins::Result::CanHaveFallbacks::Concern
119
- use Plugins::Result::CanHaveParentResult::Concern
120
- use Plugins::Result::CanHaveCheckedStatus::Concern
121
- end
122
-
123
- middlewares :success? do
124
- use Plugins::Result::CanHaveCheckedStatus::Middleware
125
- end
126
-
127
- middlewares :failure? do
128
- use Plugins::Result::CanHaveCheckedStatus::Middleware
129
- end
130
-
131
- middlewares :error? do
132
- use Plugins::Result::CanHaveCheckedStatus::Middleware
133
- end
134
-
135
- middlewares :not_success? do
136
- use Plugins::Result::CanHaveCheckedStatus::Middleware
137
- end
138
-
139
- middlewares :not_failure? do
140
- use Plugins::Result::CanHaveCheckedStatus::Middleware
141
- end
142
-
143
- middlewares :not_error? do
144
- use Plugins::Result::CanHaveCheckedStatus::Middleware
145
- end
146
-
147
- middlewares :data do
148
- use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
149
- end
150
-
151
- middlewares :message do
152
- use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
153
- end
154
-
155
- middlewares :code do
156
- use Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
157
- end
158
- end
159
-
160
- class self::Step
161
- concerns do
162
- use Plugins::Common::HasJSendResultDuckShortSyntax::Concern
163
- use Plugins::Step::CanHaveFallbacks::Concern
164
- end
165
-
166
- middlewares :result do
167
- use Plugins::Step::CanHaveFallbacks::Middleware.with(fallback_true_status: :failure)
168
- use Plugins::Step::CanHaveParentResult::Middleware
169
- end
170
-
171
- middlewares :service_fallback_failure_result do
172
- use Plugins::Common::NormalizesEnv::Middleware
173
- use Plugins::Common::CachesReturnValue::Middleware
174
- end
175
-
176
- middlewares :fallback_failure_result do
177
- use Plugins::Common::NormalizesEnv::Middleware
178
- use Plugins::Common::CachesReturnValue::Middleware
179
- end
180
-
181
- middlewares :service_fallback_error_result do
182
- use Plugins::Common::NormalizesEnv::Middleware
183
- use Plugins::Common::CachesReturnValue::Middleware
184
- end
185
-
186
- middlewares :fallback_error_result do
187
- use Plugins::Common::NormalizesEnv::Middleware
188
- use Plugins::Common::CachesReturnValue::Middleware
189
- end
190
- end
191
-
192
- if Dependencies.rspec.loaded?
193
- concerns do
194
- insert_before 0, Plugins::Service::CanHaveStubbedResults::Concern
195
- end
196
-
197
- middlewares :result do
198
- insert_after \
199
- Plugins::Common::NormalizesEnv::Middleware,
200
- Plugins::Service::CanHaveStubbedResults::Middleware
201
-
202
- insert_before \
203
- Plugins::Service::CanHaveStubbedResults::Middleware,
204
- Plugins::Service::CountsStubbedResultsInvocations::Middleware
205
- end
206
-
207
- middlewares :result, scope: :class do
208
- insert_after \
209
- Plugins::Common::NormalizesEnv::Middleware,
210
- Plugins::Service::CanHaveStubbedResults::Middleware
211
-
212
- insert_before \
213
- Plugins::Service::CanHaveStubbedResults::Middleware,
214
- Plugins::Service::CountsStubbedResultsInvocations::Middleware
215
- end
216
-
217
- class self::Result
218
- concerns do
219
- use Plugins::Result::CanBeStubbedResult::Concern
220
- use Plugins::Result::HasStubbedResultInvocationsCounter::Concern
221
- end
222
-
223
- middlewares :initialize do
224
- insert_before \
225
- Plugins::Result::HasJSendStatusAndAttributes::Middleware,
226
- Plugins::Result::HasStubbedResultInvocationsCounter::Middleware
227
- end
228
- end
229
- end
230
- end
231
- # rubocop:enable Lint/ConstantDefinitionInBlock
232
- end
233
- end
234
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "custom/ignoring_exception"
4
- require_relative "custom/in_threads"
5
- require_relative "custom/stub_service"
6
- require_relative "custom/wrap_method"
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "custom/be_descendant_of"
4
- require_relative "custom/be_direct_descendant_of"
5
- require_relative "custom/cache_its_value"
6
- require_relative "custom/call_chain_next"
7
- require_relative "custom/delegate_to"
8
- require_relative "custom/export"
9
- require_relative "custom/extend_module"
10
- require_relative "custom/have_abstract_method"
11
- require_relative "custom/have_alias_method"
12
- require_relative "custom/have_attr_accessor"
13
- require_relative "custom/have_attr_reader"
14
- require_relative "custom/have_attr_writer"
15
- require_relative "custom/include_module"
16
- require_relative "custom/prepend_module"
17
- require_relative "custom/results"
18
- require_relative "custom/singleton_prepend_module"