convenient_service 0.13.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (367) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -0
  3. data/.vscode/CacheItsValue.code-snippets +1 -1
  4. data/.yardopts +3 -0
  5. data/CHANGELOG.md +67 -0
  6. data/README.md +1 -1
  7. data/Taskfile.yml +14 -2
  8. data/lib/convenient_service/dependencies.rb +15 -12
  9. data/lib/convenient_service/examples/dry/gemfile/services/assert_file_exists.rb +1 -1
  10. data/lib/convenient_service/examples/dry/gemfile/services/assert_file_not_empty.rb +1 -1
  11. data/lib/convenient_service/examples/dry/gemfile/services/parse_content.rb +1 -1
  12. data/lib/convenient_service/examples/dry/gemfile/services/print_shell_command.rb +3 -3
  13. data/lib/convenient_service/examples/dry/gemfile/services/read_file_content.rb +1 -1
  14. data/lib/convenient_service/examples/dry/gemfile/services/run_shell_command.rb +1 -1
  15. data/lib/convenient_service/examples/dry/gemfile/services/strip_comments.rb +1 -1
  16. data/lib/convenient_service/examples/dry/gemfile.rb +1 -1
  17. data/lib/convenient_service/examples/dry/v1/gemfile/dry_service/config.rb +47 -0
  18. data/lib/convenient_service/examples/dry/v1/gemfile/dry_service.rb +3 -0
  19. data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_file_exists.rb +31 -0
  20. data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_file_not_empty.rb +31 -0
  21. data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_node_available.rb +28 -0
  22. data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_npm_package_available.rb +41 -0
  23. data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_valid_ruby_syntax.rb +43 -0
  24. data/lib/convenient_service/examples/dry/v1/gemfile/services/format.rb +39 -0
  25. data/lib/convenient_service/examples/dry/v1/gemfile/services/format_body.rb +95 -0
  26. data/lib/convenient_service/examples/dry/v1/gemfile/services/format_gems_with_envs.rb +98 -0
  27. data/lib/convenient_service/examples/dry/v1/gemfile/services/format_gems_without_envs.rb +86 -0
  28. data/lib/convenient_service/examples/dry/v1/gemfile/services/format_header.rb +76 -0
  29. data/lib/convenient_service/examples/dry/v1/gemfile/services/parse_content.rb +95 -0
  30. data/lib/convenient_service/examples/dry/v1/gemfile/services/read_file_content.rb +33 -0
  31. data/lib/convenient_service/examples/dry/v1/gemfile/services/run_shell_command.rb +43 -0
  32. data/lib/convenient_service/examples/dry/v1/gemfile/services/strip_comments.rb +111 -0
  33. data/lib/convenient_service/examples/dry/v1/gemfile/services.rb +17 -0
  34. data/lib/convenient_service/examples/dry/v1/gemfile.rb +27 -0
  35. data/lib/convenient_service/examples/rails/gemfile/services/assert_file_exists.rb +1 -1
  36. data/lib/convenient_service/examples/rails/gemfile/services/assert_file_not_empty.rb +1 -1
  37. data/lib/convenient_service/examples/rails/gemfile/services/parse_content.rb +1 -1
  38. data/lib/convenient_service/examples/rails/gemfile/services/print_shell_command.rb +3 -3
  39. data/lib/convenient_service/examples/rails/gemfile/services/read_file_content.rb +1 -1
  40. data/lib/convenient_service/examples/rails/gemfile/services/run_shell_command.rb +1 -1
  41. data/lib/convenient_service/examples/rails/gemfile/services/strip_comments.rb +1 -1
  42. data/lib/convenient_service/examples/rails/gemfile.rb +1 -1
  43. data/lib/convenient_service/examples/rails/v1/gemfile/rails_service/config.rb +58 -0
  44. data/lib/convenient_service/examples/rails/v1/gemfile/rails_service.rb +3 -0
  45. data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_file_exists.rb +27 -0
  46. data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_file_not_empty.rb +27 -0
  47. data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_node_available.rb +28 -0
  48. data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_npm_package_available.rb +37 -0
  49. data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_valid_ruby_syntax.rb +37 -0
  50. data/lib/convenient_service/examples/rails/v1/gemfile/services/format.rb +68 -0
  51. data/lib/convenient_service/examples/rails/v1/gemfile/services/format_body.rb +81 -0
  52. data/lib/convenient_service/examples/rails/v1/gemfile/services/format_gems_with_envs.rb +84 -0
  53. data/lib/convenient_service/examples/rails/v1/gemfile/services/format_gems_without_envs.rb +72 -0
  54. data/lib/convenient_service/examples/rails/v1/gemfile/services/format_header.rb +70 -0
  55. data/lib/convenient_service/examples/rails/v1/gemfile/services/merge_sections.rb +27 -0
  56. data/lib/convenient_service/examples/rails/v1/gemfile/services/parse_content.rb +91 -0
  57. data/lib/convenient_service/examples/rails/v1/gemfile/services/read_file_content.rb +29 -0
  58. data/lib/convenient_service/examples/rails/v1/gemfile/services/replace_file_content.rb +39 -0
  59. data/lib/convenient_service/examples/rails/v1/gemfile/services/run_shell_command.rb +38 -0
  60. data/lib/convenient_service/examples/rails/v1/gemfile/services/strip_comments.rb +109 -0
  61. data/lib/convenient_service/examples/rails/v1/gemfile/services.rb +20 -0
  62. data/lib/convenient_service/examples/rails/v1/gemfile.rb +27 -0
  63. data/lib/convenient_service/examples/standard/cowsay.rb +1 -1
  64. data/lib/convenient_service/examples/standard/date_time/services/safe_parse.rb +1 -1
  65. data/lib/convenient_service/examples/standard/date_time.rb +1 -1
  66. data/lib/convenient_service/examples/standard/factorial/services/calculate.rb +9 -3
  67. data/lib/convenient_service/examples/standard/factorial.rb +1 -1
  68. data/lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb +3 -3
  69. data/lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb +3 -3
  70. data/lib/convenient_service/examples/standard/gemfile/services/assert_npm_package_available.rb +2 -2
  71. data/lib/convenient_service/examples/standard/gemfile/services/format.rb +4 -4
  72. data/lib/convenient_service/examples/standard/gemfile/services/merge_sections.rb +4 -4
  73. data/lib/convenient_service/examples/standard/gemfile/services/parse_content.rb +3 -3
  74. data/lib/convenient_service/examples/standard/gemfile/services/print_shell_command.rb +4 -4
  75. data/lib/convenient_service/examples/standard/gemfile/services/read_file_content.rb +3 -3
  76. data/lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb +3 -3
  77. data/lib/convenient_service/examples/standard/gemfile/services/run_shell_command.rb +3 -3
  78. data/lib/convenient_service/examples/standard/gemfile/services/strip_comments.rb +1 -1
  79. data/lib/convenient_service/examples/standard/gemfile.rb +1 -1
  80. data/lib/convenient_service/examples/standard/request_params.rb +1 -1
  81. data/lib/convenient_service/examples/standard/v1/cowsay/services/build_cloud.rb +44 -0
  82. data/lib/convenient_service/examples/standard/v1/cowsay/services/build_cow.rb +40 -0
  83. data/lib/convenient_service/examples/standard/v1/cowsay/services/print.rb +34 -0
  84. data/lib/convenient_service/examples/standard/v1/cowsay/services.rb +5 -0
  85. data/lib/convenient_service/examples/standard/v1/cowsay.rb +26 -0
  86. data/lib/convenient_service/examples/standard/v1/date_time/services/safe_parse.rb +33 -0
  87. data/lib/convenient_service/examples/standard/v1/date_time/services.rb +3 -0
  88. data/lib/convenient_service/examples/standard/v1/date_time.rb +25 -0
  89. data/lib/convenient_service/examples/standard/v1/factorial/services/calculate.rb +51 -0
  90. data/lib/convenient_service/examples/standard/v1/factorial/services.rb +3 -0
  91. data/lib/convenient_service/examples/standard/v1/factorial/utils/timeout/with_timeout.rb +52 -0
  92. data/lib/convenient_service/examples/standard/v1/factorial/utils/timeout.rb +23 -0
  93. data/lib/convenient_service/examples/standard/v1/factorial/utils.rb +3 -0
  94. data/lib/convenient_service/examples/standard/v1/factorial.rb +26 -0
  95. data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_file_exists.rb +32 -0
  96. data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_file_not_empty.rb +32 -0
  97. data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_node_available.rb +28 -0
  98. data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_npm_package_available.rb +50 -0
  99. data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_valid_ruby_syntax.rb +41 -0
  100. data/lib/convenient_service/examples/standard/v1/gemfile/services/format.rb +82 -0
  101. data/lib/convenient_service/examples/standard/v1/gemfile/services/format_body.rb +85 -0
  102. data/lib/convenient_service/examples/standard/v1/gemfile/services/format_gems_with_envs.rb +88 -0
  103. data/lib/convenient_service/examples/standard/v1/gemfile/services/format_gems_without_envs.rb +76 -0
  104. data/lib/convenient_service/examples/standard/v1/gemfile/services/format_header.rb +68 -0
  105. data/lib/convenient_service/examples/standard/v1/gemfile/services/merge_sections.rb +54 -0
  106. data/lib/convenient_service/examples/standard/v1/gemfile/services/parse_content.rb +103 -0
  107. data/lib/convenient_service/examples/standard/v1/gemfile/services/print_shell_command.rb +47 -0
  108. data/lib/convenient_service/examples/standard/v1/gemfile/services/read_file_content.rb +41 -0
  109. data/lib/convenient_service/examples/standard/v1/gemfile/services/replace_file_content.rb +50 -0
  110. data/lib/convenient_service/examples/standard/v1/gemfile/services/run_shell_command.rb +52 -0
  111. data/lib/convenient_service/examples/standard/v1/gemfile/services/strip_comments.rb +113 -0
  112. data/lib/convenient_service/examples/standard/v1/gemfile/services.rb +20 -0
  113. data/lib/convenient_service/examples/standard/v1/gemfile.rb +26 -0
  114. data/lib/convenient_service/examples/standard/v1/request_params/constants.rb +17 -0
  115. data/lib/convenient_service/examples/standard/v1/request_params/entities/description.rb +42 -0
  116. data/lib/convenient_service/examples/standard/v1/request_params/entities/format.rb +42 -0
  117. data/lib/convenient_service/examples/standard/v1/request_params/entities/id.rb +49 -0
  118. data/lib/convenient_service/examples/standard/v1/request_params/entities/logger.rb +23 -0
  119. data/lib/convenient_service/examples/standard/v1/request_params/entities/request.rb +25 -0
  120. data/lib/convenient_service/examples/standard/v1/request_params/entities/source.rb +42 -0
  121. data/lib/convenient_service/examples/standard/v1/request_params/entities/tag.rb +42 -0
  122. data/lib/convenient_service/examples/standard/v1/request_params/entities/title.rb +42 -0
  123. data/lib/convenient_service/examples/standard/v1/request_params/entities.rb +11 -0
  124. data/lib/convenient_service/examples/standard/v1/request_params/services/apply_default_param_values.rb +28 -0
  125. data/lib/convenient_service/examples/standard/v1/request_params/services/cast_params.rb +40 -0
  126. data/lib/convenient_service/examples/standard/v1/request_params/services/extract_params_from_body.rb +72 -0
  127. data/lib/convenient_service/examples/standard/v1/request_params/services/extract_params_from_path.rb +64 -0
  128. data/lib/convenient_service/examples/standard/v1/request_params/services/filter_out_unpermitted_params.rb +28 -0
  129. data/lib/convenient_service/examples/standard/v1/request_params/services/log_request_params.rb +56 -0
  130. data/lib/convenient_service/examples/standard/v1/request_params/services/merge_params.rb +28 -0
  131. data/lib/convenient_service/examples/standard/v1/request_params/services/prepare.rb +67 -0
  132. data/lib/convenient_service/examples/standard/v1/request_params/services/validate_casted_params.rb +96 -0
  133. data/lib/convenient_service/examples/standard/v1/request_params/services/validate_uncasted_params.rb +74 -0
  134. data/lib/convenient_service/examples/standard/v1/request_params/services.rb +13 -0
  135. data/lib/convenient_service/examples/standard/v1/request_params/utils/array/wrap.rb +48 -0
  136. data/lib/convenient_service/examples/standard/v1/request_params/utils/array.rb +23 -0
  137. data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request/parse_body.rb +44 -0
  138. data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request/parse_path.rb +42 -0
  139. data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request.rb +30 -0
  140. data/lib/convenient_service/examples/standard/v1/request_params/utils/http.rb +3 -0
  141. data/lib/convenient_service/examples/standard/v1/request_params/utils/integer/safe_parse.rb +33 -0
  142. data/lib/convenient_service/examples/standard/v1/request_params/utils/integer.rb +27 -0
  143. data/lib/convenient_service/examples/standard/v1/request_params/utils/json/safe_parse.rb +42 -0
  144. data/lib/convenient_service/examples/standard/v1/request_params/utils/json.rb +23 -0
  145. data/lib/convenient_service/examples/standard/v1/request_params/utils/object/blank.rb +36 -0
  146. data/lib/convenient_service/examples/standard/v1/request_params/utils/object/present.rb +33 -0
  147. data/lib/convenient_service/examples/standard/v1/request_params/utils/object.rb +28 -0
  148. data/lib/convenient_service/examples/standard/v1/request_params/utils/url/valid.rb +49 -0
  149. data/lib/convenient_service/examples/standard/v1/request_params/utils/url.rb +23 -0
  150. data/lib/convenient_service/examples/standard/v1/request_params/utils.rb +8 -0
  151. data/lib/convenient_service/examples/standard/v1/request_params.rb +50 -0
  152. data/lib/convenient_service/feature/configs/aliases.rb +9 -0
  153. data/lib/convenient_service/feature/configs/standard.rb +22 -0
  154. data/lib/convenient_service/feature/configs.rb +5 -0
  155. data/lib/convenient_service/feature/plugins/aliases.rb +7 -0
  156. data/lib/convenient_service/feature/plugins/can_have_entries/commands/define_entry.rb +51 -0
  157. data/lib/convenient_service/feature/plugins/can_have_entries/commands.rb +3 -0
  158. data/lib/convenient_service/feature/plugins/can_have_entries/concern.rb +24 -0
  159. data/lib/convenient_service/feature/plugins/can_have_entries.rb +4 -0
  160. data/lib/convenient_service/feature/plugins.rb +5 -0
  161. data/lib/convenient_service/feature.rb +2 -9
  162. data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/constants.rb +1 -1
  163. data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/entities/result_spec.rb +8 -8
  164. data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/entities/stubbed_service.rb +6 -6
  165. data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service.rb +1 -1
  166. data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method/entities/wrapped_method.rb +6 -6
  167. data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method/exceptions.rb +1 -1
  168. data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method.rb +2 -2
  169. data/lib/convenient_service/rspec/helpers/classes.rb +4 -0
  170. data/lib/convenient_service/rspec/helpers/ignoring_exception.rb +1 -1
  171. data/lib/convenient_service/rspec/helpers/stub_service.rb +5 -5
  172. data/lib/convenient_service/rspec/helpers/wrap_method.rb +1 -1
  173. data/lib/convenient_service/rspec/helpers.rb +4 -6
  174. data/lib/convenient_service/rspec/matchers/call_chain_next.rb +1 -1
  175. data/lib/convenient_service/rspec/matchers/{custom → classes}/call_chain_next.rb +8 -8
  176. data/lib/convenient_service/rspec/matchers/{custom → classes}/export.rb +1 -1
  177. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/constants.rb +1 -1
  178. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/chain.rb +1 -1
  179. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_code_part.rb +4 -4
  180. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_data_part.rb +4 -4
  181. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_message_part.rb +4 -4
  182. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_parts.rb +3 -3
  183. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_service_part.rb +4 -4
  184. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_status_part.rb +4 -4
  185. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_expected_step_part.rb +4 -4
  186. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_got_parts.rb +3 -3
  187. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_got_service_part.rb +4 -4
  188. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands/generate_got_step_part.rb +4 -4
  189. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base.rb +4 -4
  190. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/error/commands/generate_got_jsend_attributes_part.rb +19 -10
  191. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/error.rb +1 -1
  192. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/failure/commands/generate_got_jsend_attributes_part.rb +28 -20
  193. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/failure.rb +1 -1
  194. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/null.rb +1 -1
  195. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/success/commands/generate_got_jsend_attributes_part.rb +41 -8
  196. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/success.rb +1 -1
  197. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers.rb +3 -3
  198. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result.rb +4 -4
  199. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_code.rb +5 -5
  200. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_data.rb +5 -5
  201. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_message.rb +5 -5
  202. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_service.rb +5 -5
  203. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_status.rb +5 -5
  204. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_step.rb +6 -6
  205. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands/validate_result_type.rb +5 -5
  206. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator.rb +3 -3
  207. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/exceptions.rb +1 -1
  208. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base.rb +15 -15
  209. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_error.rb +1 -1
  210. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_failure.rb +1 -1
  211. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_not_error.rb +1 -1
  212. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_not_failure.rb +1 -1
  213. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_not_success.rb +1 -1
  214. data/lib/convenient_service/rspec/matchers/{custom → classes}/results/be_success.rb +1 -1
  215. data/lib/convenient_service/rspec/matchers/classes.rb +5 -0
  216. data/lib/convenient_service/rspec/matchers/delegate_to.rb +1 -1
  217. data/lib/convenient_service/rspec/matchers/export.rb +1 -1
  218. data/lib/convenient_service/rspec/matchers/include_module.rb +1 -1
  219. data/lib/convenient_service/rspec/matchers/results/be_error.rb +1 -1
  220. data/lib/convenient_service/rspec/matchers/results/be_failure.rb +1 -1
  221. data/lib/convenient_service/rspec/matchers/results/be_not_error.rb +1 -1
  222. data/lib/convenient_service/rspec/matchers/results/be_not_failure.rb +1 -1
  223. data/lib/convenient_service/rspec/matchers/results/be_not_success.rb +1 -1
  224. data/lib/convenient_service/rspec/matchers/results/be_result.rb +31 -0
  225. data/lib/convenient_service/rspec/matchers/results/be_success.rb +1 -1
  226. data/lib/convenient_service/rspec/matchers/results.rb +4 -0
  227. data/lib/convenient_service/rspec/matchers.rb +6 -28
  228. data/lib/convenient_service/rspec/{helpers/custom → primitive_helpers/classes}/ignoring_exception/exceptions.rb +2 -2
  229. data/lib/convenient_service/rspec/{helpers/custom → primitive_helpers/classes}/ignoring_exception.rb +3 -3
  230. data/lib/convenient_service/rspec/{helpers/custom → primitive_helpers/classes}/in_threads.rb +2 -2
  231. data/lib/convenient_service/rspec/primitive_helpers/classes.rb +4 -0
  232. data/lib/convenient_service/rspec/primitive_helpers/ignoring_exception.rb +13 -0
  233. data/lib/convenient_service/rspec/{helpers → primitive_helpers}/in_threads.rb +2 -2
  234. data/lib/convenient_service/rspec/primitive_helpers.rb +19 -0
  235. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/be_descendant_of.rb +2 -2
  236. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/be_direct_descendant_of.rb +2 -2
  237. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/cache_its_value.rb +2 -2
  238. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/be_descendant_of.rb +2 -2
  239. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/be_direct_descendant_of.rb +2 -2
  240. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/cache_its_value.rb +2 -2
  241. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/commands/generate_printable_method.rb +2 -2
  242. 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
  243. 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
  244. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments.rb +2 -2
  245. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/base.rb +5 -5
  246. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/return_its_value.rb +2 -2
  247. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_any_arguments.rb +2 -2
  248. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_concrete_arguments.rb +2 -2
  249. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/without_arguments.rb +2 -2
  250. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/values/base.rb +4 -4
  251. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/values/with_calling_original.rb +2 -2
  252. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/values/without_calling_original.rb +2 -2
  253. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings_collection/exceptions.rb +2 -2
  254. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings_collection.rb +13 -13
  255. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/delegation.rb +3 -3
  256. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher.rb +13 -13
  257. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to.rb +13 -13
  258. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/extend_module.rb +2 -2
  259. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_abstract_method.rb +2 -2
  260. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_alias_method.rb +2 -2
  261. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_attr_accessor.rb +4 -4
  262. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_attr_reader.rb +2 -2
  263. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/have_attr_writer.rb +2 -2
  264. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/include_module.rb +2 -2
  265. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/prepend_module.rb +2 -2
  266. data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/singleton_prepend_module.rb +2 -2
  267. data/lib/convenient_service/rspec/primitive_matchers/classes.rb +15 -0
  268. data/lib/convenient_service/rspec/primitive_matchers/delegate_to.rb +13 -0
  269. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/extend_module.rb +2 -2
  270. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_abstract_method.rb +2 -2
  271. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_alias_method.rb +2 -2
  272. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_attr_accessor.rb +2 -2
  273. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_attr_reader.rb +2 -2
  274. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/have_attr_writer.rb +2 -2
  275. data/lib/convenient_service/rspec/primitive_matchers/include_module.rb +13 -0
  276. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/prepend_module.rb +2 -2
  277. data/lib/convenient_service/rspec/{matchers → primitive_matchers}/singleton_prepend_module.rb +2 -2
  278. data/lib/convenient_service/rspec/primitive_matchers.rb +41 -0
  279. data/lib/convenient_service/rspec.rb +3 -0
  280. data/lib/convenient_service/{configs → service/configs}/aliases.rb +1 -1
  281. data/lib/convenient_service/{configs → service/configs}/awesome_print_inspect/aliases.rb +1 -1
  282. data/lib/convenient_service/service/configs/awesome_print_inspect.rb +61 -0
  283. data/lib/convenient_service/service/configs/minimal.rb +261 -0
  284. data/lib/convenient_service/service/configs/standard/aliases.rb +9 -0
  285. data/lib/convenient_service/service/configs/standard/v1.rb +185 -0
  286. data/lib/convenient_service/service/configs/standard.rb +238 -0
  287. data/lib/convenient_service/service/plugins/{can_have_fallback → can_have_fallbacks}/concern.rb +29 -17
  288. data/lib/convenient_service/service/plugins/{can_have_fallback → can_have_fallbacks}/exceptions.rb +7 -7
  289. data/lib/convenient_service/service/plugins/can_have_fallbacks/middleware.rb +36 -0
  290. data/lib/convenient_service/service/plugins/can_have_fallbacks.rb +5 -0
  291. data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +9 -3
  292. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/concern.rb +97 -0
  293. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware.rb +74 -0
  294. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks.rb +4 -0
  295. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/exceptions.rb +32 -0
  296. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/middleware.rb +33 -0
  297. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value.rb +4 -0
  298. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb +2 -1
  299. data/lib/convenient_service/service/plugins/can_have_steps/entities/step_collection.rb +16 -0
  300. data/lib/convenient_service/service/plugins/has_j_send_result/commands.rb +0 -1
  301. data/lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb +10 -17
  302. data/lib/convenient_service/service/plugins/has_j_send_result/concern/instance_methods.rb +0 -9
  303. data/lib/convenient_service/service/plugins/has_j_send_result/constants.rb +4 -4
  304. data/lib/convenient_service/service/plugins/has_j_send_result/container.rb +8 -0
  305. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/{can_have_fallback → can_have_fallbacks}/concern.rb +16 -2
  306. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_fallbacks.rb +3 -0
  307. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_awesome_print_inspect/concern.rb +3 -0
  308. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_inspect/concern.rb +9 -1
  309. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb +7 -0
  310. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/instance_methods.rb +7 -0
  311. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins.rb +1 -1
  312. data/lib/convenient_service/service/plugins/has_j_send_result_params_validations/using_active_model_validations/middleware.rb +18 -7
  313. data/lib/convenient_service/service/plugins/has_j_send_result_params_validations/using_dry_validation/middleware.rb +26 -4
  314. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/exceptions.rb +41 -0
  315. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/middleware.rb +33 -6
  316. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error.rb +0 -1
  317. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/exceptions.rb +67 -6
  318. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/middleware.rb +36 -3
  319. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure.rb +0 -1
  320. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/commands/refute_kwargs_contain_j_send_and_extra_keys.rb +67 -0
  321. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/commands.rb +1 -1
  322. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/exceptions.rb +15 -2
  323. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/middleware.rb +8 -2
  324. data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/middleware.rb +11 -3
  325. data/lib/convenient_service/service/plugins.rb +1 -1
  326. data/lib/convenient_service/service.rb +1 -0
  327. data/lib/convenient_service/support/dependency_container/commands.rb +0 -1
  328. data/lib/convenient_service/support/dependency_container.rb +0 -1
  329. data/lib/convenient_service/version.rb +1 -1
  330. data/lib/convenient_service.rb +0 -1
  331. data/yard/yard-convenient_service_concern.rb +45 -0
  332. metadata +258 -133
  333. data/lib/convenient_service/configs/awesome_print_inspect.rb +0 -59
  334. data/lib/convenient_service/configs/minimal.rb +0 -257
  335. data/lib/convenient_service/configs/standard.rb +0 -208
  336. data/lib/convenient_service/rspec/helpers/custom.rb +0 -6
  337. data/lib/convenient_service/rspec/matchers/custom.rb +0 -18
  338. data/lib/convenient_service/service/plugins/can_have_fallback/middleware.rb +0 -30
  339. data/lib/convenient_service/service/plugins/can_have_fallback.rb +0 -5
  340. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback/concern.rb +0 -53
  341. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback/middleware.rb +0 -34
  342. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback.rb +0 -4
  343. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_fallback.rb +0 -3
  344. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/commands/assert_args_count_lower_than_three.rb +0 -25
  345. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/commands/assert_either_args_or_kwargs_are_passed.rb +0 -26
  346. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/commands.rb +0 -4
  347. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/commands/assert_kwargs_contain_only_j_send_keys.rb +0 -53
  348. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/commands.rb +0 -3
  349. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/commands/refute_kwargs_contain_data_and_extra_keys.rb +0 -29
  350. data/lib/convenient_service/support/dependency_container/commands/define_entry.rb +0 -49
  351. data/lib/convenient_service/support/dependency_container/entry.rb +0 -22
  352. /data/lib/convenient_service/rspec/helpers/{custom → classes}/stub_service/entities.rb +0 -0
  353. /data/lib/convenient_service/rspec/helpers/{custom → classes}/wrap_method/entities.rb +0 -0
  354. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/base/commands.rb +0 -0
  355. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/error/commands.rb +0 -0
  356. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/failure/commands.rb +0 -0
  357. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/printers/success/commands.rb +0 -0
  358. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities/validator/commands.rb +0 -0
  359. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results/base/entities.rb +0 -0
  360. /data/lib/convenient_service/rspec/matchers/{custom → classes}/results.rb +0 -0
  361. /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/commands.rb +0 -0
  362. /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands.rb +0 -0
  363. /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities/chainings.rb +0 -0
  364. /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities/matcher/entities.rb +0 -0
  365. /data/lib/convenient_service/rspec/{matchers/custom → primitive_matchers/classes}/delegate_to/entities.rb +0 -0
  366. /data/lib/convenient_service/{configs.rb → service/configs.rb} +0 -0
  367. /data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/{can_have_fallback → can_have_fallbacks}/result.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4686692f187c6eed32b5bab389f30e138aa547050234676d4cd25271c451287b
4
- data.tar.gz: c3c7ac1895761d5abb36b6783a4fcaa1167117efc6c42813a201f0e4c64defa1
3
+ metadata.gz: 86314358470fd8502e3b00853f6f0aed31fe7837fe879b8a6fe9b02b23a37055
4
+ data.tar.gz: 8c7ddbfa504ef02c2774bbc4c616297345b684320ed0e4b4b10134f2a8851c24
5
5
  SHA512:
6
- metadata.gz: 336c3065ee969a78debe0824585deb22940b96257a3109c663a4348469da28740478bded21dffae4750b1e9889cb839ea2558591c14d81109f873d7929f57a8d
7
- data.tar.gz: bb8a77dacf096fdb7451d70b5d484d1ecdb074bce0fbbe3faace722e52c6ba39a48b17ef52dfc2fc3252f93b9623182e6b5157e93b444509eb559dd947cbd6af
6
+ metadata.gz: 59dc4c6936c9764718dd105ef24255e89a21397b56770460850fa38365c37d0a4ba7d97bba924c72906f2ba27fc6b66b3981e9f1682a43c22f245e6daa811627
7
+ data.tar.gz: bc6942d0091fe8805164bfb01b00ed09c2be71ae0ea2838d2958331844053984309600f15151cb33fe261bc76913eed1f5299898b2e95df696020ab5a92e4d9d
data/.gitignore CHANGED
@@ -50,3 +50,8 @@
50
50
  # Check `HasMermaidFlowchart` for details.
51
51
  #
52
52
  flowchart.html
53
+
54
+ ##
55
+ # NOTE: Ignores `TODO.md`. Usually, this file is used for notes that are NOT ready to be shared with the outside world.
56
+ #
57
+ TODO.md
@@ -8,7 +8,7 @@
8
8
  "scope": "ruby",
9
9
  "prefix": "CacheItsValue",
10
10
  "body": [
11
- "include ConvenientService::RSpec::Matchers::CacheItsValue",
11
+ "include ConvenientService::RSpec::PrimitiveMatchers::CacheItsValue",
12
12
  ],
13
13
  "description": "`CacheItsValue` - a module that allows to use custom RSpec matcher `cache_its_value` to verify caching"
14
14
  }
data/.yardopts CHANGED
@@ -1,4 +1,6 @@
1
1
  ##
2
+ # NOTE: This config is used by `task docs:generate`.
3
+ #
2
4
  # NOTE: `.yardopts` docs.
3
5
  # https://rubydoc.info/gems/yard/YARD/CLI/Yardoc
4
6
  #
@@ -9,5 +11,6 @@
9
11
  --markup-provider commonmarker
10
12
  --output-dir docs
11
13
  --tag internal --hide-tag internal
14
+ --plugin convenient_service_concern
12
15
  'lib/**/*.rb' -
13
16
  README.md
data/CHANGELOG.md CHANGED
@@ -1,5 +1,72 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.15.0](https://github.com/marian13/convenient_service/compare/v0.14.0...v0.15.0) (2023-11-10)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **feature:** allow to use plugins for features
9
+
10
+ ### Features
11
+
12
+ * **can_have_steps:** do not allow to modify steps from callbacks ([b90b7f7](https://github.com/marian13/convenient_service/commit/b90b7f7b5ba7b9cb12151d02495d1ad1c230504e))
13
+ * **feature:** allow to use plugins for features ([17645f8](https://github.com/marian13/convenient_service/commit/17645f888849b5cb42c2ae45aa8430cb96e28eff))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **can_have_steps:** introduce raises_on_not_result_return_value for steps ([bb27527](https://github.com/marian13/convenient_service/commit/bb27527b708747df356980cf831c660757fb4093))
19
+
20
+
21
+ ### Miscellaneous Chores
22
+
23
+ * release 0.15.0 ([7f6a6a7](https://github.com/marian13/convenient_service/commit/7f6a6a74b722eaf26ae7195351a9078c944032dd))
24
+
25
+ ## [0.14.0](https://github.com/marian13/convenient_service/compare/v0.13.0...v0.14.0) (2023-09-20)
26
+
27
+
28
+ ### ⚠ BREAKING CHANGES
29
+
30
+ * **has_j_send_result_params_validations:** return errors on validation issues
31
+ * **has_j_send_result_params_validations:** return errors on validation issues
32
+ * **can_have_fallbacks:** fallback only failures by default
33
+ * **be_result:** update got part
34
+ * **has_j_send_result_short:** update constants
35
+ * **fallbacks:** create separate fallbacks failures and errors, run only error fallback when true
36
+
37
+ ### Features
38
+
39
+ * **be_result:** introduce be_result ([f8fc85b](https://github.com/marian13/convenient_service/commit/f8fc85bb9141851c130a040731e4bb99114050d2))
40
+ * **can_have_fallbacks:** allow to pass fallback_true_status ([584dabe](https://github.com/marian13/convenient_service/commit/584dabe83f87c2d794ea779a3e5c7f0b0ea97f65))
41
+ * **can_have_fallbacks:** fallback only failures by default ([58650a7](https://github.com/marian13/convenient_service/commit/58650a736be0a4daaf283c6eef9e0867a34d44d4))
42
+ * **configs:** create copy of v1 ([bb039c8](https://github.com/marian13/convenient_service/commit/bb039c83f53607c4cf59f634c662fc604f13ff7b))
43
+ * **examples:** create copy of v1 ([70bd3fe](https://github.com/marian13/convenient_service/commit/70bd3febc4a88ebe7e7c3d33c7dd2e1c03331ccb))
44
+ * **has_awesome_print_inspect:** add message and data keys ([14e0a3f](https://github.com/marian13/convenient_service/commit/14e0a3f088edf8ea8565ba7ff06ca0212c4116e9))
45
+ * **has_inspect:** add message and data keys ([8f30b7a](https://github.com/marian13/convenient_service/commit/8f30b7a905b8a953d514061ed381a404b65c81af))
46
+ * **has_j_send_result_params_validations:** return errors on validation issues ([e25e1a4](https://github.com/marian13/convenient_service/commit/e25e1a4f94cc309035533220dbcfbfccbb94cc94))
47
+ * **has_j_send_result_params_validations:** return errors on validation issues ([09a9b94](https://github.com/marian13/convenient_service/commit/09a9b948070f3132818d1da9ef009d1d15655ab9))
48
+ * **has_j_send_result_short_syntax:** allow to pass data, message, code to all results ([aabf2f9](https://github.com/marian13/convenient_service/commit/aabf2f98d32407616159cbcd2bcc6349a9a3b98f))
49
+ * **has_j_send_result_short_syntax:** allow to pass message and code to short form of error ([1af3153](https://github.com/marian13/convenient_service/commit/1af3153aa1bf385eadcf73f30e13a3cc5126d793))
50
+ * **has_j_send_result_short_syntax:** allow to pass message and code to short form of failure ([7390630](https://github.com/marian13/convenient_service/commit/73906300f94ec6488f312d4a611f433d8c850691))
51
+ * **has_j_send_result_short_syntax:** allow to pass message and code to short form of success ([fdf2ab2](https://github.com/marian13/convenient_service/commit/fdf2ab23ade8941ed2c6dd10d17769eaebecc855))
52
+ * **has_j_send_status_and_attributes:** introduce Data#keys ([27f43e1](https://github.com/marian13/convenient_service/commit/27f43e1594988cc523e9bb3608e90a40e4c2b442))
53
+ * **has_j_send_status_and_attributes:** introduce Message#empty? ([6c1452d](https://github.com/marian13/convenient_service/commit/6c1452d99d71be45bb6cb95159a2fd32ffca668e))
54
+ * **rescues_result_unhandled_exceptions:** allow to pass status ([2ef85f2](https://github.com/marian13/convenient_service/commit/2ef85f2970dd56802bd22f467529da6242faf967))
55
+ * **using_active_model_validations:** allow to pass status to middleware ([bc5bb70](https://github.com/marian13/convenient_service/commit/bc5bb7027fe94724a8d28a3770b68c731b37ff10))
56
+ * **using_dry_validation:** allow to pass status to middleware ([3a5ef12](https://github.com/marian13/convenient_service/commit/3a5ef120219a8a94b1d15bb7226f265db967ce9e))
57
+
58
+
59
+ ### Miscellaneous Chores
60
+
61
+ * release 0.14.0 ([c7cef07](https://github.com/marian13/convenient_service/commit/c7cef0721d8360329c19b8ad4d636bcec83805c6))
62
+
63
+
64
+ ### Code Refactoring
65
+
66
+ * **be_result:** update got part ([428280a](https://github.com/marian13/convenient_service/commit/428280a8eb2aed09f49bd949f84b7e10ef933708))
67
+ * **fallbacks:** create separate fallbacks failures and errors, run only error fallback when true ([bbab564](https://github.com/marian13/convenient_service/commit/bbab5647d09ecdba9c9727bef3e2dc6b8138710b))
68
+ * **has_j_send_result_short:** update constants ([2074acd](https://github.com/marian13/convenient_service/commit/2074acd001115dd4c60d432e71a4fef58794c881))
69
+
3
70
  ## 0.13.0 (2023-08-27)
4
71
 
5
72
 
data/README.md CHANGED
@@ -38,7 +38,7 @@ Yet another approach to revisit the service object pattern, but this time focusi
38
38
  <!-- general_description:end -->
39
39
 
40
40
  <!-- warning:start -->
41
- ## WARNING ❗❗❗
41
+ ## ❗❗❗ WARNING ❗❗❗
42
42
 
43
43
  This library is under heavy development. Public API may be subject to change. The first major release is still to come. Use the current version at your own risk. Ruby 2.7+, JRuby 9.4+ (TruffleRuby support is planned as well). Thanks.
44
44
  <!-- features:end -->
data/Taskfile.yml CHANGED
@@ -339,7 +339,13 @@ tasks:
339
339
  #
340
340
  docs:generate:
341
341
  cmds:
342
- - bundle exec yardoc
342
+ ##
343
+ # NOTE: yard supports plugins as gems only.
344
+ # - https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#plugin-support
345
+ #
346
+ # NOTE: `RUBYLIB` is used to extend Ruby's `$LOAD_PATH`. This way yard treats `./yard` folder as a directory with custom gems.
347
+ #
348
+ - RUBYLIB=./yard bundle exec yardoc
343
349
 
344
350
  docs:generate:open:
345
351
  cmds:
@@ -664,4 +670,10 @@ tasks:
664
670
  yard_junk:
665
671
  cmds:
666
672
  - mkdir -p docs
667
- - bundle exec yard-junk --text --html docs/junk-yard.html
673
+ ##
674
+ # NOTE: yard supports plugins as gems only.
675
+ # - https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#plugin-support
676
+ #
677
+ # NOTE: `RUBYLIB` is used to extend Ruby's `$LOAD_PATH`. This way yard treats `./yard` folder as a directory with custom gems.
678
+ #
679
+ - RUBYLIB=./yard bundle exec yard-junk --text --html docs/junk-yard.html
@@ -125,8 +125,8 @@ module ConvenientService
125
125
  require_relative "service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_awesome_print_inspect"
126
126
  require_relative "service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_awesome_print_inspect"
127
127
  require_relative "service/plugins/can_have_steps/entities/step/plugins/has_awesome_print_inspect"
128
- require_relative "configs/awesome_print_inspect"
129
- require_relative "configs/awesome_print_inspect/aliases"
128
+ require_relative "service/configs/awesome_print_inspect"
129
+ require_relative "service/configs/awesome_print_inspect/aliases"
130
130
  end
131
131
 
132
132
  ##
@@ -292,9 +292,10 @@ module ConvenientService
292
292
  #
293
293
  # Loads standard config examples.
294
294
  #
295
+ # @param version [String]
295
296
  # @return [Boolean]
296
297
  #
297
- def require_standard_examples
298
+ def require_standard_examples(version: "")
298
299
  ##
299
300
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/date/rdoc/Date.html
300
301
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/date/rdoc/DateTime.html
@@ -325,11 +326,11 @@ module ConvenientService
325
326
  #
326
327
  require "uri"
327
328
 
328
- require_relative "examples/standard/cowsay"
329
- require_relative "examples/standard/date_time"
330
- require_relative "examples/standard/factorial"
331
- require_relative "examples/standard/gemfile"
332
- require_relative "examples/standard/request_params"
329
+ require_relative ::File.join("examples", "standard", version, "cowsay")
330
+ require_relative ::File.join("examples", "standard", version, "date_time")
331
+ require_relative ::File.join("examples", "standard", version, "factorial")
332
+ require_relative ::File.join("examples", "standard", version, "gemfile")
333
+ require_relative ::File.join("examples", "standard", version, "request_params")
333
334
  end
334
335
 
335
336
  ##
@@ -337,9 +338,10 @@ module ConvenientService
337
338
  #
338
339
  # Loads rails config examples.
339
340
  #
341
+ # @param version [String]
340
342
  # @return [Boolean]
341
343
  #
342
- def require_rails_examples
344
+ def require_rails_examples(version: "")
343
345
  ##
344
346
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html
345
347
  # - https://github.com/flori/json
@@ -357,7 +359,7 @@ module ConvenientService
357
359
  #
358
360
  require "webrick"
359
361
 
360
- require_relative "examples/rails/gemfile"
362
+ require_relative ::File.join("examples", "rails", version, "gemfile")
361
363
  end
362
364
 
363
365
  ##
@@ -365,9 +367,10 @@ module ConvenientService
365
367
  #
366
368
  # Loads dry config examples.
367
369
  #
370
+ # @param version [String]
368
371
  # @return [Boolean]
369
372
  #
370
- def require_dry_examples
373
+ def require_dry_examples(version: "")
371
374
  ##
372
375
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html
373
376
  # - https://github.com/flori/json
@@ -385,7 +388,7 @@ module ConvenientService
385
388
  #
386
389
  require "webrick"
387
390
 
388
- require_relative "examples/dry/gemfile"
391
+ require_relative ::File.join("examples", "dry", version, "gemfile")
389
392
  end
390
393
 
391
394
  ##
@@ -17,7 +17,7 @@ module ConvenientService
17
17
  end
18
18
 
19
19
  def result
20
- return error("File with path `#{path}` does NOT exist") unless ::File.exist?(path)
20
+ return failure("File with path `#{path}` does NOT exist") unless ::File.exist?(path)
21
21
 
22
22
  success
23
23
  end
@@ -17,7 +17,7 @@ module ConvenientService
17
17
  end
18
18
 
19
19
  def result
20
- return error(message: "File with path `#{path}` is empty") if ::File.zero?(path)
20
+ return failure("File with path `#{path}` is empty") if ::File.zero?(path)
21
21
 
22
22
  success
23
23
  end
@@ -52,7 +52,7 @@ module ConvenientService
52
52
  step :result, in: :content, out: :parsed_content
53
53
 
54
54
  def result
55
- success(data: {parsed_content: parse_content})
55
+ success(parsed_content: parse_content)
56
56
  end
57
57
 
58
58
  def parse_content
@@ -3,7 +3,7 @@
3
3
  ##
4
4
  # Usage example:
5
5
  #
6
- # ConvenientService::Examples::Dry::Gemfile::Services::PrintShellCommand.result(text: "ls -a")
6
+ # ConvenientService::Examples::Dry::Gemfile::Services::PrintShellCommand.result(command: "ls -a")
7
7
  #
8
8
  module ConvenientService
9
9
  module Examples
@@ -24,7 +24,7 @@ module ConvenientService
24
24
  end
25
25
 
26
26
  def result
27
- return error("Printing of shell command `#{command}` is skipped") if skip
27
+ return failure("Printing of shell command `#{command}` is skipped") if skip
28
28
 
29
29
  out.puts
30
30
 
@@ -33,7 +33,7 @@ module ConvenientService
33
33
  success
34
34
  end
35
35
 
36
- def fallback_result
36
+ def fallback_failure_result
37
37
  success
38
38
  end
39
39
  end
@@ -21,7 +21,7 @@ module ConvenientService
21
21
  step :result, in: :path, out: :content
22
22
 
23
23
  def result
24
- success(data: {content: ::File.read(path)})
24
+ success(content: ::File.read(path))
25
25
  end
26
26
  end
27
27
  end
@@ -34,7 +34,7 @@ module ConvenientService
34
34
  if system(command)
35
35
  success
36
36
  else
37
- error(message: "#{command} returned non-zero exit code")
37
+ error("#{command} returned non-zero exit code")
38
38
  end
39
39
  end
40
40
  end
@@ -28,7 +28,7 @@ module ConvenientService
28
28
  step :result, in: :file_without_comments, out: :content_without_comments
29
29
 
30
30
  def result
31
- success(data: {content_without_comments: file_without_comments.read})
31
+ success(content_without_comments: file_without_comments.read)
32
32
  end
33
33
 
34
34
  private
@@ -14,7 +14,7 @@ module ConvenientService
14
14
  module Examples
15
15
  module Dry
16
16
  class Gemfile
17
- include ConvenientService::Feature
17
+ include ConvenientService::Feature::Standard::Config
18
18
 
19
19
  entry :format do |path|
20
20
  Services::Format[path: path]
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # Usage example:
5
+ #
6
+ # result = ConvenientService::Examples::Dry::V1::Gemfile.format(path: "Gemfile")
7
+ # result = ConvenientService::Examples::Dry::V1::Gemfile.format(path: "spec/cli/gemfile/format/fixtures/Gemfile")
8
+ #
9
+ module ConvenientService
10
+ module Examples
11
+ module Dry
12
+ module V1
13
+ class Gemfile
14
+ class DryService
15
+ module Config
16
+ include Support::Concern
17
+
18
+ included do
19
+ include ConvenientService::Standard::V1::Config
20
+
21
+ ##
22
+ # NOTE: `AssignsAttributesInConstructor::UsingDryInitializer` plugin.
23
+ #
24
+ concerns do
25
+ use ConvenientService::Plugins::Common::AssignsAttributesInConstructor::UsingDryInitializer::Concern
26
+ end
27
+
28
+ ##
29
+ # NOTE: `HasJSendResultParamsValidations::UsingDryValidation` plugin.
30
+ #
31
+ concerns do
32
+ use ConvenientService::Plugins::Service::HasJSendResultParamsValidations::UsingDryValidation::Concern
33
+ end
34
+
35
+ middlewares :result do
36
+ insert_before \
37
+ ConvenientService::Plugins::Service::RaisesOnNotResultReturnValue::Middleware,
38
+ ConvenientService::Plugins::Service::HasJSendResultParamsValidations::UsingDryValidation::Middleware.with(status: :failure)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "dry_service/config"
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConvenientService
4
+ module Examples
5
+ module Dry
6
+ module V1
7
+ class Gemfile
8
+ module Services
9
+ class AssertFileExists
10
+ include DryService::Config
11
+
12
+ option :path
13
+
14
+ contract do
15
+ schema do
16
+ required(:path).filled(:string)
17
+ end
18
+ end
19
+
20
+ def result
21
+ return error("File with path `#{path}` does NOT exist") unless ::File.exist?(path)
22
+
23
+ success
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConvenientService
4
+ module Examples
5
+ module Dry
6
+ module V1
7
+ class Gemfile
8
+ module Services
9
+ class AssertFileNotEmpty
10
+ include DryService::Config
11
+
12
+ option :path
13
+
14
+ contract do
15
+ schema do
16
+ required(:path).filled(:string)
17
+ end
18
+ end
19
+
20
+ def result
21
+ return error(message: "File with path `#{path}` is empty") if ::File.zero?(path)
22
+
23
+ success
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # Usage example:
5
+ #
6
+ # ConvenientService::Examples::Dry::V1::Gemfile::Services::AssertNodeAvailable.result
7
+ #
8
+ module ConvenientService
9
+ module Examples
10
+ module Dry
11
+ module V1
12
+ class Gemfile
13
+ module Services
14
+ class AssertNodeAvailable
15
+ include DryService::Config
16
+
17
+ ##
18
+ # NOTE: `> /dev/null 2>&1` is used to hide output.
19
+ # https://unix.stackexchange.com/a/119650/394253
20
+ #
21
+ step Services::RunShellCommand, in: {command: -> { "which node > /dev/null 2>&1" }}
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # Usage example:
5
+ #
6
+ # ConvenientService::Examples::Dry::V1::Gemfile::Services::AssertNpmPackageAvailable.result(name: "lodash")
7
+ #
8
+ module ConvenientService
9
+ module Examples
10
+ module Dry
11
+ module V1
12
+ class Gemfile
13
+ module Services
14
+ class AssertNpmPackageAvailable
15
+ include DryService::Config
16
+
17
+ option :name
18
+
19
+ contract do
20
+ schema do
21
+ required(:name).filled(:string)
22
+ end
23
+ end
24
+
25
+ step Services::AssertNodeAvailable
26
+
27
+ ##
28
+ # NOTE: `> /dev/null 2>&1` is used to hide output.
29
+ # https://unix.stackexchange.com/a/119650/394253
30
+ #
31
+ # NOTE: For `npm list` and its options docs, see
32
+ # https://docs.npmjs.com/cli/v7/commands/npm-ls
33
+ #
34
+ step Services::RunShellCommand, in: {command: -> { "npm list #{name} --depth=0 > /dev/null 2>&1" }}
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConvenientService
4
+ module Examples
5
+ module Dry
6
+ module V1
7
+ class Gemfile
8
+ module Services
9
+ class AssertValidRubySyntax
10
+ include DryService::Config
11
+
12
+ option :content
13
+
14
+ contract do
15
+ schema do
16
+ required(:content).value(:string)
17
+ end
18
+ end
19
+
20
+ def result
21
+ ##
22
+ # NOTE: `> /dev/null 2>&1` is used to hide output.
23
+ # https://unix.stackexchange.com/a/119650/394253
24
+ #
25
+ check_ruby_syntax_result = Services::RunShellCommand.result(command: "ruby -c #{file.path} > /dev/null 2>&1")
26
+
27
+ return error("`#{content}` contains invalid Ruby syntax") unless check_ruby_syntax_result.success?
28
+
29
+ success
30
+ end
31
+
32
+ private
33
+
34
+ def file
35
+ @file ||= ::Tempfile.new.tap { |tempfile| tempfile.write(content) }.tap(&:close)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # Usage example:
5
+ #
6
+ # result = ConvenientService::Examples::Dry::V1::Gemfile::Services::Format.result(path: "Gemfile")
7
+ # result = ConvenientService::Examples::Dry::V1::Gemfile::Services::Format.result(path: "spec/cli/gemfile/format/fixtures/Gemfile")
8
+ #
9
+ module ConvenientService
10
+ module Examples
11
+ module Dry
12
+ module V1
13
+ class Gemfile
14
+ module Services
15
+ class Format
16
+ include DryService::Config
17
+
18
+ option :path
19
+
20
+ step Services::ReadFileContent, in: :path, out: :content
21
+ step Services::StripComments, in: :content, out: :content_without_comments
22
+ step Services::ParseContent, in: {content: :content_without_comments}, out: :parsed_content
23
+ step Services::FormatHeader, in: :parsed_content, out: {formatted_content: :formatted_header_content}
24
+ step Services::FormatBody, in: :parsed_content, out: {formatted_content: :formatted_body_content}
25
+
26
+ before :result do
27
+ @progressbar = ::ProgressBar.create(title: "Formatting", total: steps.count)
28
+ end
29
+
30
+ after :step do |step_result|
31
+ @progressbar.increment
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end