convenient_service 0.15.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) 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 +10 -1
  6. data/.ruby-version +1 -1
  7. data/.tool-versions +1 -1
  8. data/.yardopts +1 -1
  9. data/CHANGELOG.md +37 -0
  10. data/COMM-LICENSE.txt +99 -0
  11. data/LICENSE.txt +7 -19
  12. data/README.md +1 -1
  13. data/ROADMAP.md +14 -7
  14. data/convenient_service.gemspec +24 -5
  15. data/docs/.gitkeep +0 -0
  16. data/docs/api/.gitkeep +0 -0
  17. data/lib/convenient_service/common/plugins/can_have_user_provided_entity/commands/find_or_create_entity.rb +7 -2
  18. data/lib/convenient_service/common/plugins/can_have_user_provided_entity/exceptions.rb +4 -4
  19. data/lib/convenient_service/common/plugins/has_around_callbacks/exceptions.rb +2 -2
  20. data/lib/convenient_service/common/plugins/has_around_callbacks/middleware.rb +2 -2
  21. data/lib/convenient_service/common/plugins/has_instance_proxy/commands/create_instance_proxy_class.rb +83 -0
  22. data/lib/convenient_service/common/plugins/has_instance_proxy/commands.rb +3 -0
  23. data/lib/convenient_service/common/plugins/has_instance_proxy/concern.rb +22 -0
  24. data/lib/convenient_service/common/plugins/has_instance_proxy/entities/instance_proxy.rb +76 -0
  25. data/lib/convenient_service/common/plugins/has_instance_proxy/entities.rb +3 -0
  26. data/lib/convenient_service/common/plugins/has_instance_proxy/middleware.rb +20 -0
  27. data/lib/convenient_service/common/plugins/has_instance_proxy.rb +6 -0
  28. data/lib/convenient_service/common/plugins.rb +1 -0
  29. data/lib/convenient_service/core/concern/class_methods.rb +7 -2
  30. data/lib/convenient_service/core/concern/instance_methods.rb +7 -2
  31. data/lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb +1 -1
  32. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/commands/define_method_middlewares_caller.rb +2 -2
  33. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/commands/create_observable_middleware.rb +3 -0
  34. data/lib/convenient_service/core/entities/config/exceptions.rb +4 -4
  35. data/lib/convenient_service/core/entities/config.rb +1 -1
  36. data/lib/convenient_service/dependencies/extractions/active_support_backtrace_cleaner/backtrace_cleaner.rb +28 -8
  37. data/lib/convenient_service/dependencies/extractions/active_support_backtrace_cleaner.rb +3 -3
  38. data/lib/convenient_service/dependencies/extractions/b.rb +2 -0
  39. data/lib/convenient_service/dependencies/extractions/ce.rb +16 -0
  40. data/lib/convenient_service/dependencies/extractions.rb +1 -0
  41. data/lib/convenient_service/dependencies.rb +6 -1
  42. data/lib/convenient_service/examples/dry/gemfile.rb +3 -1
  43. data/lib/convenient_service/examples/dry/v1/gemfile.rb +3 -1
  44. data/lib/convenient_service/examples/rails/gemfile.rb +3 -1
  45. data/lib/convenient_service/examples/rails/v1/gemfile.rb +3 -1
  46. data/lib/convenient_service/examples/standard/cowsay.rb +3 -1
  47. data/lib/convenient_service/examples/standard/date_time.rb +3 -1
  48. data/lib/convenient_service/examples/standard/factorial.rb +3 -1
  49. data/lib/convenient_service/examples/standard/gemfile.rb +3 -1
  50. data/lib/convenient_service/examples/standard/request_params.rb +3 -2
  51. data/lib/convenient_service/examples/standard/v1/request_params.rb +0 -1
  52. data/lib/convenient_service/exception.rb +98 -10
  53. data/lib/convenient_service/feature/configs/standard.rb +8 -0
  54. data/lib/convenient_service/feature/plugins/can_have_entries/commands/define_entries.rb +49 -0
  55. data/lib/convenient_service/feature/plugins/can_have_entries/commands/define_entry.rb +29 -3
  56. data/lib/convenient_service/feature/plugins/can_have_entries/commands.rb +1 -0
  57. data/lib/convenient_service/feature/plugins/can_have_entries/concern.rb +14 -5
  58. data/lib/convenient_service/feature/plugins/can_have_entries/exceptions.rb +45 -0
  59. data/lib/convenient_service/feature/plugins/can_have_entries.rb +1 -0
  60. data/lib/convenient_service/logger.rb +4 -1
  61. data/lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb +0 -8
  62. data/lib/convenient_service/rspec/helpers/classes/wrap_method/entities/wrapped_method.rb +5 -5
  63. data/lib/convenient_service/rspec/helpers/classes/wrap_method/exceptions.rb +2 -2
  64. data/lib/convenient_service/rspec/matchers/classes/results/base/entities/validator/commands/validate_result_step.rb +1 -1
  65. data/lib/convenient_service/rspec/matchers/classes/results/base/exceptions.rb +2 -2
  66. data/lib/convenient_service/rspec/primitive_helpers/classes/ignoring_exception/exceptions.rb +2 -2
  67. data/lib/convenient_service/rspec/primitive_helpers/classes/ignoring_exception.rb +1 -1
  68. data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands/apply_stub_to_track_delegations.rb +4 -0
  69. data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings_collection/exceptions.rb +7 -7
  70. data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings_collection.rb +3 -3
  71. data/lib/convenient_service/service/plugins/can_have_fallbacks/concern.rb +2 -2
  72. data/lib/convenient_service/service/plugins/can_have_fallbacks/exceptions.rb +4 -4
  73. data/lib/convenient_service/service/plugins/can_have_fallbacks/middleware.rb +1 -1
  74. data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +3 -3
  75. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb +2 -2
  76. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb +1 -1
  77. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/alias.rb +2 -2
  78. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/proc.rb +1 -1
  79. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/raw.rb +1 -1
  80. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment.rb +2 -2
  81. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/usual.rb +2 -2
  82. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/directions/input.rb +2 -2
  83. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/directions/output.rb +1 -1
  84. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/exceptions.rb +26 -26
  85. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb +1 -1
  86. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/exceptions.rb +2 -2
  87. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed/exceptions.rb +2 -2
  88. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed/middleware.rb +1 -1
  89. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/exceptions.rb +2 -2
  90. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/middleware.rb +1 -1
  91. data/lib/convenient_service/service/plugins/has_inspect/concern.rb +0 -1
  92. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/concern/instance_methods.rb +7 -0
  93. 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
  94. 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 +1 -1
  95. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/instance_methods.rb +14 -0
  96. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/exceptions.rb +2 -2
  97. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/raises_on_not_checked_result_status/exceptions.rb +2 -2
  98. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/raises_on_not_checked_result_status/middleware.rb +1 -1
  99. data/lib/convenient_service/service/plugins/has_j_send_result/exceptions.rb +2 -2
  100. data/lib/convenient_service/service/plugins/has_j_send_result.rb +39 -0
  101. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/exceptions.rb +6 -6
  102. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/middleware.rb +3 -3
  103. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/exceptions.rb +6 -6
  104. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/middleware.rb +3 -3
  105. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/commands/refute_kwargs_contain_j_send_and_extra_keys.rb +1 -1
  106. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/exceptions.rb +2 -2
  107. data/lib/convenient_service/service/plugins/has_j_send_result_status_check_short_syntax/concern.rb +0 -8
  108. data/lib/convenient_service/service/plugins/has_result/concern.rb +1 -1
  109. data/lib/convenient_service/service/plugins/has_result/exceptions.rb +2 -2
  110. data/lib/convenient_service/service/plugins/raises_on_double_result/exceptions.rb +2 -2
  111. data/lib/convenient_service/service/plugins/raises_on_double_result/middleware.rb +1 -1
  112. data/lib/convenient_service/service/plugins/raises_on_not_result_return_value/exceptions.rb +2 -2
  113. data/lib/convenient_service/service/plugins/raises_on_not_result_return_value/middleware.rb +1 -1
  114. data/lib/convenient_service/support/abstract_method/exceptions.rb +2 -2
  115. data/lib/convenient_service/support/abstract_method.rb +1 -1
  116. data/lib/convenient_service/support/backtrace_cleaner.rb +123 -0
  117. data/lib/convenient_service/support/cache/exceptions.rb +2 -2
  118. data/lib/convenient_service/support/cache.rb +1 -1
  119. data/lib/convenient_service/support/castable/exceptions.rb +4 -4
  120. data/lib/convenient_service/support/castable.rb +1 -1
  121. data/lib/convenient_service/support/command.rb +3 -3
  122. data/lib/convenient_service/support/counter.rb +6 -6
  123. data/lib/convenient_service/support/dependency_container/commands/assert_valid_container.rb +1 -1
  124. data/lib/convenient_service/support/dependency_container/commands/assert_valid_method.rb +1 -1
  125. data/lib/convenient_service/support/dependency_container/commands/assert_valid_scope.rb +1 -1
  126. data/lib/convenient_service/support/dependency_container/exceptions.rb +8 -8
  127. data/lib/convenient_service/support/dependency_container/export.rb +1 -1
  128. data/lib/convenient_service/support/finite_loop.rb +6 -6
  129. data/lib/convenient_service/support.rb +1 -0
  130. data/lib/convenient_service/utils/array/exceptions.rb +2 -2
  131. data/lib/convenient_service/utils/array/merge.rb +1 -1
  132. data/lib/convenient_service/utils/hash/assert_valid_keys.rb +1 -1
  133. data/lib/convenient_service/version.rb +1 -1
  134. data/lib/convenient_service.rb +98 -0
  135. metadata +28 -42
  136. data/lib/convenient_service/examples/standard/v1/gemfile/services/print_shell_command.rb +0 -47
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86314358470fd8502e3b00853f6f0aed31fe7837fe879b8a6fe9b02b23a37055
4
- data.tar.gz: 8c7ddbfa504ef02c2774bbc4c616297345b684320ed0e4b4b10134f2a8851c24
3
+ metadata.gz: f24d02cddcb69e9108cf7d810c85f4ccf338201b8a31bbc7da0be1ef92bd91a9
4
+ data.tar.gz: 89c019fa64f6fe8194c9b74a676d367e390cc5cb33efef361a4fcb448cd72d17
5
5
  SHA512:
6
- metadata.gz: 59dc4c6936c9764718dd105ef24255e89a21397b56770460850fa38365c37d0a4ba7d97bba924c72906f2ba27fc6b66b3981e9f1682a43c22f245e6daa811627
7
- data.tar.gz: bc6942d0091fe8805164bfb01b00ed09c2be71ae0ea2838d2958331844053984309600f15151cb33fe261bc76913eed1f5299898b2e95df696020ab5a92e4d9d
6
+ metadata.gz: a53a4a7fee700e8128eeea830ac57cee73e6a6034d36e61dd224584e06f08ef4d944cdc513bfbac17187866b09969a4f63f31e316745546de032a24965bad6dd
7
+ data.tar.gz: 47a180d8079468f98eadcfbddc2654323fabeae0d7f8b47febc7c13f80d43d30a30583d7104d60d486b02f6e024155487fe3ce5c20bd1eea39f214ee326dc9ff
@@ -0,0 +1,15 @@
1
+ # Contributing
2
+
3
+ ## Legal
4
+
5
+ By submitting a Pull Request, you disavow any rights or claims to any changes
6
+ submitted to the Convenient Service project and assign the copyright of
7
+ those changes to Convenient Service Organization.
8
+
9
+ If you cannot or do not want to reassign those rights (your employment
10
+ contract for your employer may not allow this), you should not submit a PR.
11
+ Open an issue and someone else can do the work.
12
+
13
+ This is a legal way of saying "If you submit a PR to us, that code becomes ours".
14
+ 99.9% of the time that's what you intend anyways; we hope it doesn't scare you
15
+ away from contributing.
@@ -30,7 +30,7 @@ jobs:
30
30
  - name: Set up Ruby
31
31
  uses: ruby/setup-ruby@v1
32
32
  with:
33
- ruby-version: 3.1
33
+ ruby-version: 3.2
34
34
  ##
35
35
  # NOTE: Installs the latest compatible Bundler version, runs `bundle install` and caches installed gems.
36
36
  # - https://github.com/ruby/setup-ruby#usage
@@ -39,8 +39,8 @@ jobs:
39
39
  bundler-cache: true
40
40
  ##
41
41
  # NOTE: Installs Task (task runner).
42
- # https://taskfile.dev/installation/#github-actions
43
- # https://github.com/go-task/task
42
+ # - https://taskfile.dev/installation/#github-actions
43
+ # - https://github.com/go-task/task
44
44
  #
45
45
  - name: Install Task (task runner)
46
46
  uses: arduino/setup-task@v1
@@ -51,7 +51,8 @@ jobs:
51
51
  uses: peaceiris/actions-gh-pages@v3
52
52
  with:
53
53
  github_token: ${{ secrets.GITHUB_TOKEN }}
54
- publish_dir: ./docs
54
+ publish_dir: ./docs/api
55
+ cname: apidocs.convenientservice.org
55
56
 
56
57
  create_github_release:
57
58
  runs-on: ubuntu-20.04
@@ -139,8 +139,8 @@ jobs:
139
139
  bundler-cache: true
140
140
  ##
141
141
  # NOTE: Installs Task (task runner).
142
- # https://taskfile.dev/installation/#github-actions
143
- # https://github.com/go-task/task
142
+ # - https://taskfile.dev/installation/#github-actions
143
+ # - https://github.com/go-task/task
144
144
  #
145
145
  - name: Install Task (task runner)
146
146
  uses: arduino/setup-task@v1
@@ -169,10 +169,10 @@ jobs:
169
169
  node-version: 16.x
170
170
  ##
171
171
  # NOTE: `lcov-result-merger` docs.
172
- # https://github.com/mweibel/lcov-result-merger
172
+ # - https://github.com/mweibel/lcov-result-merger
173
173
  #
174
174
  # NOTE: `npx --yes` option.
175
- # https://stackoverflow.com/questions/70742968/automatically-accept-installing-npx-package
175
+ # - https://stackoverflow.com/questions/70742968/automatically-accept-installing-npx-package
176
176
  #
177
177
  # NOTE: `lcov-result-merger` uses `vinyl-fs` for globs which in turn uses `node-glob`.
178
178
  # - https://github.com/mweibel/lcov-result-merger/blob/v3.3.0/bin/lcov-result-merger.js#L38
@@ -200,7 +200,7 @@ jobs:
200
200
  # NOTE: If there are no memory, performance, or cost constraints, prefer to use as standard Linux distribution as it is possible.
201
201
  # In a general case, you simply won't have enough time to resolve all the "quirks" of more specific distributions if you are an application developer.
202
202
  # That is why the well-known Ubuntu is used.
203
- # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners
203
+ # - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners
204
204
  #
205
205
  runs-on: ubuntu-20.04
206
206
  name: Gather coverage
data/.gitignore CHANGED
@@ -42,8 +42,17 @@
42
42
  #
43
43
  .DS_Store
44
44
 
45
- # Ignore docs
45
+ ##
46
+ # NOTE: Ignores `docs` content, but NOT the folder.
47
+ #
46
48
  /docs/*
49
+ !/docs/.gitkeep
50
+
51
+ ##
52
+ # NOTE: Ignores `docs/api` content, but NOT the folder.
53
+ #
54
+ /docs/api/*
55
+ !/docs/api/.gitkeep
47
56
 
48
57
  ##
49
58
  # NOTE: Ignores `flowchart.html`, that can be generated by `Service.mermaid_flowchart.save`.
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.0
1
+ 3.2.0
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.1.0
1
+ ruby 3.2.0
data/.yardopts CHANGED
@@ -9,7 +9,7 @@
9
9
  #
10
10
  --markup markdown
11
11
  --markup-provider commonmarker
12
- --output-dir docs
12
+ --output-dir docs/api
13
13
  --tag internal --hide-tag internal
14
14
  --plugin convenient_service_concern
15
15
  'lib/**/*.rb' -
data/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.17.0](https://github.com/marian13/convenient_service/compare/v0.16.0...v0.17.0) (2024-01-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * **backtrace_cleaner:** introduce add_convenient_service_silencer ([07ce10f](https://github.com/marian13/convenient_service/commit/07ce10fbd96c7e6b3074922d0ca8af6547416725))
9
+ * **backtrace_cleaner:** upgrade to Rails 7.1.2 Backtrace Cleaner ([6416691](https://github.com/marian13/convenient_service/commit/6416691d99d3b22544b78ea81aed5a3a4aa513fe))
10
+ * **core:** clean backtrace in method_missing ([0642198](https://github.com/marian13/convenient_service/commit/06421981ccf39d2d0b07f2bce30284c604bba950))
11
+ * **core:** clean backtrace in method_missing ([81d0531](https://github.com/marian13/convenient_service/commit/81d05317d842d9afa2ef7034b34b850034a8f1dd))
12
+ * **core:** clean backtrace in method_missing ([f07c354](https://github.com/marian13/convenient_service/commit/f07c354e8fc14f1062df68f938b9d4b9fa8484c5))
13
+ * **entry:** allow to define multiple entries at once ([a9bca88](https://github.com/marian13/convenient_service/commit/a9bca880da4849866f6afc30b3f099be88834f64))
14
+ * **exception:** allow to pass message or kwargs or no arguments ([a92a040](https://github.com/marian13/convenient_service/commit/a92a04002687c878618479804d0176e69b3d4fa4))
15
+ * **exceptions:** use backtrace_cleaner ([7bc566e](https://github.com/marian13/convenient_service/commit/7bc566e78cfa3fcc28b6b2318ca955ff4d797ce8))
16
+ * **exceptions:** use backtrace_cleaner ([b8d87a5](https://github.com/marian13/convenient_service/commit/b8d87a56cb4afda043ba0de6c1ba3cd967d2aa7c))
17
+ * **feature:** allow to use middlewares for all entries at once ([a2025dc](https://github.com/marian13/convenient_service/commit/a2025dccbf660cdc313f9db7df155ccd7a4cd3b8))
18
+ * **has_instance_proxy:** delegate to target missing proxy methods ([6be8d3b](https://github.com/marian13/convenient_service/commit/6be8d3b6bf556bc2af9ff29a7b0782b352a8effb))
19
+ * **has_instance_proxy:** introduce #inspect ([078d219](https://github.com/marian13/convenient_service/commit/078d21927b1b523b266e85d945f87aa3030de0f4))
20
+ * **has_j_send_result:** expose result? ([f4d5f7f](https://github.com/marian13/convenient_service/commit/f4d5f7fb9afde955295602db022d12f084f60d9e))
21
+ * **has_j_send_status_and_attributes:** introduce #to_bool ([ec5ee1e](https://github.com/marian13/convenient_service/commit/ec5ee1ec0f4a540a109f80e3ffafa1b937d1af60))
22
+ * **root:** introduce ConvenientService.raise and ConvenientService.reraise ([65f0148](https://github.com/marian13/convenient_service/commit/65f0148d052c31c3e305470b2b9daee5c746794e))
23
+ * **root:** introduce ConvenientService.root ([dc5af36](https://github.com/marian13/convenient_service/commit/dc5af365374a76d615fa09613b59bb9cd080bc1b))
24
+ * **support:** add initial backtrace cleaner ([14733f3](https://github.com/marian13/convenient_service/commit/14733f3d5b622c08aec1fe0b80a2b7c5699b4d4f))
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **backtrace_cleaner:** resolve JRuby incompatibilites ([3ff9055](https://github.com/marian13/convenient_service/commit/3ff90555a0f78f1ba51fa7c538cc84c7c4e69bdb))
30
+ * **rescues_result_unhandled_exceptions:** fix false-positive test ([e792c01](https://github.com/marian13/convenient_service/commit/e792c01613a74da529f2f7833248527c40f1ac7b))
31
+ * **specs:** remove did_you_mean flakiness ([709faf6](https://github.com/marian13/convenient_service/commit/709faf6c8ac9eb28451f3ea734d5588159481648))
32
+
33
+ ## [0.16.0](https://github.com/marian13/convenient_service/compare/v0.15.0...v0.16.0) (2023-12-05)
34
+
35
+
36
+ ### Features
37
+
38
+ * **entry:** allow to use instance method, just like field in graphql-ruby ([ad445fa](https://github.com/marian13/convenient_service/commit/ad445fae5ace9671745b2cacd2f6fae7b5a0e26e))
39
+
3
40
  ## [0.15.0](https://github.com/marian13/convenient_service/compare/v0.14.0...v0.15.0) (2023-11-10)
4
41
 
5
42
 
data/COMM-LICENSE.txt ADDED
@@ -0,0 +1,99 @@
1
+ END-USER LICENSE AGREEMENT
2
+
3
+ ------------------------------------------------------------------------------
4
+
5
+ IMPORTANT: THIS SOFTWARE END-USER LICENSE AGREEMENT ("EULA") IS A LEGAL AGREEMENT (“Agreement”) BETWEEN YOU (THE CUSTOMER, EITHER AS AN INDIVIDUAL OR, IF PURCHASED OR OTHERWISE ACQUIRED BY OR FOR AN ENTITY, AS AN ENTITY) AND CONVENIENT SERVICE ORGANIZATION. READ IT CAREFULLY BEFORE COMPLETING THE INSTALLATION PROCESS AND USING CONVENIENT SERVICE PRO AND RELATED SOFTWARE COMPONENTS (“SOFTWARE”). IT PROVIDES A LICENSE TO USE THE SOFTWARE AND CONTAINS WARRANTY INFORMATION AND LIABILITY DISCLAIMERS. BY INSTALLING AND USING THE SOFTWARE, YOU ARE CONFIRMING YOUR ACCEPTANCE OF THE SOFTWARE AND AGREEING TO BECOME BOUND BY THE TERMS OF THIS AGREEMENT.
6
+
7
+ ------------------------------------------------------------------------------
8
+
9
+ In order to use the Software under this Agreement, you must receive a “Source URL” at the time of purchase, in accordance with the scope of use and other terms specified for each type of Software and as set forth in this Section 1 of this Agreement.
10
+
11
+
12
+ 1. License Grant.
13
+
14
+ 1.1 General Use. This Agreement grants you a non-exclusive, non-transferable, limited license to the use rights for the Software, without the right to grant sublicenses, subject to the terms and conditions in this Agreement. The Software is licensed, not sold.
15
+
16
+ 1.2 Unlimited Organization License. If you purchased an Organization License (included with the Convenient Service Pro Software), you may install the Software on an unlimited number of Hosts. “Host” means any physical or virtual machine which is controlled by you. You may concurrently run the software on an unlimited number of Hosts.
17
+
18
+ 1.3 Archive Copies. You are entitled to make a reasonable amount of copies of the Software for archival purposes. Each copy must reproduce all copyright and other proprietary rights notices on or in the Software Product.
19
+
20
+ 1.4 Electronic Delivery. All Software and license documentation shall be delivered by electronic means unless otherwise specified on the applicable invoice or at the time of purchase. Software shall be deemed delivered when it is made available for download by you (“Delivery”).
21
+
22
+
23
+ 2. Modifications. Convenient Service Organization shall provide you with source code so that you can create Modifications of the original software. “Modification” means: (a) any addition to or deletion from the contents of a file included in the original Software or previous Modifications created by You, or (b) any new file that contains any part of the original Software or previous Modifications. While you retain all rights to any original work authored by you as part of the Modifications, We continue to own all copyright and other intellectual property rights in the Software.
24
+
25
+
26
+ 3. Restricted Uses.
27
+
28
+ 3.1 You shall not (and shall not allow any third party to): (a) decompile, disassemble, or otherwise reverse engineer the Software or attempt to reconstruct or discover any source code, underlying ideas, algorithms, file formats or programming interfaces of the Software by any means whatsoever (except and only to the extent that applicable law prohibits or restricts reverse engineering restrictions); (b) distribute, sell, sublicense, rent, lease or use the Software for time sharing, hosting, service provider or like purposes, except as expressly permitted under this Agreement; (c) redistribute the Software or Modifications other than by including the Software or a portion thereof within your own product, which must have substantially different functionality than the Software or Modifications and must not allow any third party to use the Software or Modifications, or any portions thereof, for software development or application development purposes; (d) redistribute the Software as part of a product, "appliance" or "virtual server"; (e) redistribute the Software on any server which is not directly under your control; (f) remove any product identification, proprietary, copyright or other notices contained in the Software; (g) modify any part of the Software, create a derivative work of any part of the Software (except as permitted in Section 4), or incorporate the Software, except to the extent expressly authorized in writing by Convenient Service Organization; (h) publicly disseminate performance information or analysis (including, without limitation, benchmarks) from any source relating to the Software; (i) utilize any equipment, device, software, or other means designed to circumvent or remove any form of Source URL or copy protection used by Convenient Service Organization in connection with the Software, or use the Software together with any authorization code, Source URL, serial number, or other copy protection device not supplied by Convenient Service Organization; (j) use the Software to develop a product which is competitive with any Convenient Service Organization product offerings; or (k) use unauthorized Source URLS or keycode(s) or distribute or publish Source URLs or keycode(s), except as may be expressly permitted by Convenient Service Organization in writing. If your unique Source URL is ever published, Convenient Service Organization reserves the right to terminate your access without notice.
29
+
30
+ 3.2 UNDER NO CIRCUMSTANCES MAY YOU USE THE SOFTWARE AS PART OF A PRODUCT OR SERVICE THAT PROVIDES SIMILAR FUNCTIONALITY TO THE SOFTWARE ITSELF.
31
+
32
+ The Open Source version of the Software (“LGPL Version”) is licensed
33
+ under the terms of the GNU Lesser General Public License version 3.0
34
+ (“LGPL”) and not under this EULA.
35
+
36
+
37
+ 4. Ownership. Notwithstanding anything to the contrary contained herein, except for the limited license rights expressly provided herein, Convenient Service Organization and its suppliers have and will retain all rights, title and interest (including, without limitation, all patent, copyright, trademark, trade secret and other intellectual property rights) in and to the Software and all copies, modifications and derivative works thereof (including any changes which incorporate any of your ideas, feedback or suggestions). You acknowledge that you are obtaining only a limited license right to the Software, and that irrespective of any use of the words “purchase”, “sale” or like terms hereunder no ownership rights are being conveyed to you under this Agreement or otherwise.
38
+
39
+
40
+ 5. Fees and Payment. The Software license fees will be due and payable in full as set forth in the applicable invoice or at the time of purchase. If the Software does not function properly within two weeks of purchase, please contact us within those two weeks for a refund. You shall be responsible for all taxes, withholdings, duties and levies arising from the order (excluding taxes based on the net income of Convenient Service Organization).
41
+
42
+
43
+ 6. Support, Maintenance and Services. Subject to the terms and conditions of this Agreement, as set forth in your invoice, and as set forth on the Convenient Service Pro support page, support and maintenance services may be included with the purchase of your license subscription.
44
+
45
+
46
+ 7. Term of Agreement.
47
+
48
+ 7.1 Term. This Agreement is effective as of the Delivery of the Software and expires at such time as all license and service subscriptions hereunder have expired in accordance with their own terms (the “Term”). For clarification, the term of your license under this Agreement may be perpetual, limited for Evaluation Version, or designated as a fixed-term license in the Invoice, and shall be specified at your time of purchase. Either party may terminate this Agreement (including all related Invoices) if the other party: (a) fails to cure any material breach of this Agreement within thirty (30) days after written notice of such breach, provided that Convenient Service Organization may terminate this Agreement immediately upon any breach of Section 3 or if you exceed any other restrictions contained in Section 1, unless otherwise specified in this agreement; (b) ceases operation without a successor; or (c) seeks protection under any bankruptcy, receivership, trust deed, creditors arrangement, composition or comparable proceeding, or if any such proceeding is instituted against such party (and not dismissed within sixty (60) days). Termination is not an exclusive remedy and the exercise by either party of any remedy under this Agreement will be without prejudice to any other remedies it may have under this Agreement, by law, or otherwise.
49
+
50
+ 7.2 Termination. Upon any termination of this Agreement, you shall cease any and all use of any Software and destroy all copies thereof.
51
+
52
+ 7.3 Expiration of License. Upon the expiration of any term under this Agreement, (a) all Software updates and services pursuant to the license shall cease, (b) you may only continue to run existing installations of the Software, (c) you may not install the Software on any additional Hosts, and (d) any new installation of the Software shall require the purchase of a new license subscription from Convenient Service Organization.
53
+
54
+
55
+ 8. Disclaimer of Warranties. The Software is provided "as is," with all faults, defects and errors, and without warranty of any kind. Convenient Service Organization does not warrant that the Software will be free of bugs, errors, viruses or other defects, and Convenient Service Organization shall have no liability of any kind for the use of or inability to use the Software, the Software content or any associated service, and you acknowledge that it is not technically practicable for Convenient Service Organization to do so.
56
+ To the maximum extent permitted by applicable law, Convenient Service Organization disclaims all warranties, express, implied, arising by law or otherwise, regarding the Software, the Software content and their respective performance or suitability for your intended use, including without limitation any implied warranty of merchantability, fitness for a particular purpose.
57
+
58
+
59
+ 9. Limitation of Liability.
60
+
61
+ In no event will Convenient Service Organization be liable for any direct, indirect, consequential, incidental, special, exemplary, or punitive damages or liabilities whatsoever arising from or relating to the Software, the Software content or this Agreement, whether based on contract, tort (including negligence), strict liability or other theory, even if Convenient Service Organization has been advised of the possibility of such damages.
62
+
63
+ In no event will Convenient Service Organization' liability exceed the Software license price as indicated in the invoice. The existence of more than one claim will not enlarge or extend this limit.
64
+
65
+
66
+ 10. Remedies. Your exclusive remedy and Convenient Service Organization' entire liability for breach of this Agreement shall be limited, at Convenient Service Organization' sole and exclusive discretion, to (a) replacement of any defective software or documentation; or (b) refund of the license fee paid to Convenient Service Organization, payable in accordance with Convenient Service Organization' refund policy.
67
+
68
+
69
+ 11. Acknowledgements.
70
+
71
+ 11.1 Consent to the Use of Data. You agree that Convenient Service Organization and its affiliates may collect and use technical information gathered as part of the product support services. Convenient Service Organization may use this information solely to improve products and services and will not disclose this information in a form that personally identifies you.
72
+
73
+ 11.2 Verification. We or a certified auditor acting on our behalf, may, upon its reasonable request and at its expense, audit you with respect to the use of the Software. Such audit may be conducted by mail, electronic means or through an in-person visit to your place of business. Any such in-person audit shall be conducted during regular business hours at your facilities and shall not unreasonably interfere with your business activities. We shall not remove, copy, or redistribute any electronic material during the course of an audit. If an audit reveals that you are using the Software in a way that is in material violation of the terms of the EULA, then you shall pay our reasonable costs of conducting the audit. In the case of a material violation, you agree to pay Us any amounts owing that are attributable to the unauthorized use. In the alternative, We reserve the right, at our sole option, to terminate the licenses for the Software.
74
+
75
+
76
+ 12. Third Party Software. Examples included in Software may provide links to third party libraries or code (collectively “Third Party Software”) to implement various functions. Third Party Software does not comprise part of the Software. In some cases, access to Third Party Software may be included along with the Software delivery as a convenience for demonstration purposes. Such source code and libraries may be included in the “…/examples” source tree delivered with the Software and do not comprise the Software. Licensee acknowledges (1) that some part of Third Party Software may require additional licensing of copyright and patents from the owners of such, and (2) that distribution of any of the Software referencing or including any portion of a Third Party Software may require appropriate licensing from such third parties.
77
+
78
+
79
+ 13. Miscellaneous
80
+
81
+ 13.1 Entire Agreement. This Agreement sets forth our entire agreement with respect to the Software and the subject matter hereof and supersedes all prior and contemporaneous understandings and agreements whether written or oral.
82
+
83
+ 13.2 Amendment. Convenient Service Organization reserves the right, in its sole discretion, to amend this Agreement from time. Amendments to this Agreement can be located at: https://github.com/marian13/convenient_service/blob/main/COMM-LICENSE.txt.
84
+
85
+ 13.3 Assignment. You may not assign this Agreement or any of its rights under this Agreement without the prior written consent of Convenient Service Organization and any attempted assignment without such consent shall be void.
86
+
87
+ 13.4 Export Compliance. You agree to comply with all applicable laws and regulations, including laws, regulations, orders or other restrictions on export, re-export or redistribution of software.
88
+
89
+ 13.5 Indemnification. You agree to defend, indemnify, and hold harmless Convenient Service Organization from and against any lawsuits, claims, losses, damages, fines and expenses (including attorneys' fees and costs) arising out of your use of the Software or breach of this Agreement.
90
+
91
+ 13.6 Attorneys' Fees and Costs. The prevailing party in any action to enforce this Agreement will be entitled to recover its attorneys' fees and costs in connection with such action.
92
+
93
+ 13.7 Severability. If any provision of this Agreement is held by a court of competent jurisdiction to be invalid, illegal, or unenforceable, the remainder of this Agreement will remain in full force and effect.
94
+
95
+ 13.8 Waiver. Failure or neglect by either party to enforce at any time any of the provisions of this licence Agreement shall not be construed or deemed to be a waiver of that party's rights under this Agreement.
96
+
97
+ 13.9 Headings. The headings of sections and paragraphs of this Agreement are for convenience of reference only and are not intended to restrict, affect or be of any weight in the interpretation or construction of the provisions of such sections or paragraphs.
98
+
99
+ 14. Contact Information. If you have any questions about this EULA, or if you want to contact Convenient Service Organization for any reason, please direct correspondence to info@convenientservice.org.
data/LICENSE.txt CHANGED
@@ -1,21 +1,9 @@
1
- The MIT License (MIT)
1
+ Copyright (c) Convenient Service Organization
2
2
 
3
- Copyright (c) 2022-2023 Marian Kostyk
3
+ Convenient Service is an Open Source project licensed under the terms of
4
+ the LGPLv3 license. Please see <http://www.gnu.org/licenses/lgpl-3.0.html>
5
+ for license text.
4
6
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
7
+ Convenient Service Pro has a commercial-friendly license.
8
+ You can find the commercial license in COMM-LICENSE.txt.
9
+ Please see https://convenientservice.org for purchasing options.
data/README.md CHANGED
@@ -49,7 +49,7 @@ This library is under heavy development. Public API may be subject to change. Th
49
49
 
50
50
  - Visit the [All-in-One Presentation](https://marian13.github.io/static_content/convenient_service/presentations/all_in_one) to get a quick overview.
51
51
 
52
- - Check out [Convenient Service Official User Docs](https://marian13.github.io/convenient_service_docs) for installation, requirements, and usage guides.
52
+ - Check out [Convenient Service Official User Docs](https://userdocs.convenientservice.org/) for installation, requirements, and usage guides.
53
53
 
54
54
  - Read [the API docs](https://marian13.github.io/convenient_service) to get familiar with the newest functionality that is not documented yet.
55
55
 
data/ROADMAP.md CHANGED
@@ -10,13 +10,13 @@
10
10
  | Medium | 🚧 | [Rails Current Attributes integration](https://api.rubyonrails.org/classes/ActiveSupport/CurrentAttributes.html) to cache repeated results | |
11
11
  | Low | 🚧 | [Capybara](https://github.com/teamcapybara/capybara) examples | |
12
12
  | Medium | 🚧 | Inline step sequence | |
13
- | High | 🚧 | Move callbacks to internals | |
13
+ | High | 🚧 | Move callbacks to internals | In order to NOT pollute the public interface of users services |
14
14
  | Low | 🚧 | Create an example of `id_or_record` [attribute](https://api.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html) |
15
15
  | Low | 🚧 | GitHub Wiki/Gists for Support | |
16
16
  | Low | 🚧 | Contribute to Shoulda Matchers | |
17
17
  | High | ✅ | `respond_to_missing?` | [ConvenientService::Core::ClassMethods#respond_to_missing?](https://github.com/marian13/convenient_service/blob/main/lib/convenient_service/core/class_methods.rb#L105), [ConvenientService::Core::InstanceMethods#respond_to_missing?](https://github.com/marian13/convenient_service/blob/main/lib/convenient_service/core/instance_methods.rb#L30) |
18
18
  | High | ⏳ | Custom matcher to track `ConvenientService::Logger` messages | |
19
- | Medium | 🚧 | Remove `respond_to?` from `Copyable` | Investigate before making any decision |
19
+ | Medium | | Remove `respond_to?` from `Copyable` | [7d2a676c171d201301f1c35d498c3b1caf8579b1](https://github.com/marian13/convenient_service/commit/7d2a676c171d201301f1c35d498c3b1caf8579b1) |
20
20
  | High | 🚧 | Unified `inspect` | Remove `internals` from inspect, ivars wrapperd by double underscore |
21
21
  | High | ✅ | Remove race condition for `method_missing` | https://github.com/marian13/convenient_service/pull/5 |
22
22
  | High | ✅ | Remove incompatiility of [Module#include](https://gist.github.com/marian13/9c25041f835564e945d978839097d419) | https://github.com/marian13/convenient_service/pull/3 |
@@ -27,12 +27,12 @@
27
27
  | Medium | ✅ | A way to check if block has one required positional argument | [#proc_has_one_positional_argument?](https://github.com/marian13/convenient_service/blob/main/lib/convenient_service/utils/proc/exec_config.rb#L96) |
28
28
  | Low | 🚧 | Define method middleware caller with visibility | |
29
29
  | Low | 🚧 | Dependency containers to remove high coupling | |
30
- | Low | 🚧 | Measure performance | |
31
- | Low | 🚧 | Rewrite middleware backend to count [convenient_service](https://github.com/marian13/convenient_service) specifics | |
30
+ | Low | 🚧 | Measure performance | See [benchmark](https://github.com/marian13/convenient_service/tree/main/benchmark) |
31
+ | Low | 🚧 | Write [Convenient Service](https://github.com/marian13/convenient_service) specific middleware backend | |
32
32
  | High | 🚧 | Optimize `stack.dup` in `MethodMiddlewares#call` | Core v3 |
33
33
  | Medium | 🚧 | Make a decision of what to do with `printable_block` in custom RSpec matchers | |
34
34
  | Medium | 🚧 | User-friendly exception messages | |
35
- | High | 🚧 | Factory for POROs in specs ❗❗❗ | Start with `result_class`, `class self::Result`, `service_class`, `step_class`, `organizer_class` |
35
+ | High | | Factory for POROs in specs ❗❗❗ | Proxy config antipattern |
36
36
  | High | 🚧 | Resolve warning during specs | |
37
37
  | Medium | 🚧 | Consider to change/rewrite `delegate` backend to minify its interface | |
38
38
  | Medium | 🚧 | Same order of attr macros, delegators, initialize, class methods, attr methods, queries, actions, `to_*`, comparison, inspect | |
@@ -78,8 +78,15 @@
78
78
  | High | 🚧 | Add specs for `WrappedMethod#call` | |
79
79
  | High | 🚧 | Check whether ignoring the error was used properly | |
80
80
  | High | 🚧 | Steps are great for `and` logic, but what to do with `or` logic? | Create the third service | |
81
- | High | 🚧 | Steps are great for `and` logic, but what to do with `case when` logic? | Create the third service | |
81
+ | High | 🚧 | Steps are great for `and` logic, but what to do with `case when` logic? | Create the third service | |
82
82
  | High | 🚧 | Cacing of services | It is relatively simple to add caching for steps, but not for all services, since steps are managed by framework | |
83
83
  | High | 🚧 | Fallback should return result with already checked status | |
84
+ | Medium | 🚧 | Licence: Commercial Support docs | See [Sidekiq Commercial Support](https://github.com/sidekiq/sidekiq/wiki/Commercial-Support) |
85
+ | Meduim | 🚧 | Licence: Acknowledgements - Government End Users | See [GraphQL Ruby Commercial Licence](https://graphql.pro/COMM-LICENSE.html) |
86
+ | Medium | 🚧 | Licence: Applicable Law and Jurisdiction (Miscellaneous - Governing Law) | See [Kiba Applicable Law and Jurisdiction](https://github.com/thbar/kiba/blob/master/COMM-LICENSE.md) |
87
+ | Medium | 🚧 | Licence: Contact email `info@convenientservice.org` | |
88
+ | Medium | 🚧 | Contributing Guide | See [Sidekiq Contributing](https://github.com/sidekiq/sidekiq/blob/main/.github/contributing.md) |
89
+ | High | 🚧 | `comparing_by` for `delegate_to` | |
90
+ | High | 🚧 | Remove extra files from bundled gem version | |
84
91
 
85
- Search for `TODO`s in the codebase for more tasks.
92
+ Search for `TODO`s in the codebase or check [discussions](https://github.com/marian13/convenient_service/discussions) for more tasks.
@@ -72,10 +72,15 @@ Gem::Specification.new do |spec|
72
72
  spec.add_development_dependency "byebug", "~> 10.0" unless ConvenientService::Support::Ruby.jruby?
73
73
 
74
74
  ##
75
+ # Used for parsing Markdown in YARD docs.
76
+ # - https://github.com/gjtorikian/commonmarker
77
+ #
75
78
  # NOTE: `commonmarker` has C extensions, that is why it is NOT supported in JRuby.
76
79
  # - https://github.com/gjtorikian/commonmarker/tree/main/ext/commonmarker
77
80
  #
78
- spec.add_development_dependency "commonmarker" unless ConvenientService::Support::Ruby.jruby?
81
+ # TODO: `commonmarker` v1 does NOT work with `yard-junk`.
82
+ #
83
+ spec.add_development_dependency "commonmarker", "~> 0.23.10" unless ConvenientService::Support::Ruby.jruby?
79
84
 
80
85
  ##
81
86
  # Used for debugging CRuby code.
@@ -122,8 +127,13 @@ Gem::Specification.new do |spec|
122
127
  # - https://github.com/mbj/mutant/blob/main/docs/mutant-rspec.md
123
128
  # - https://github.com/mbj/mutant/blob/main/docs/incremental.md
124
129
  #
125
- spec.add_development_dependency "mutant", "~> 0.11.21"
126
- spec.add_development_dependency "mutant-rspec", "~> 0.11.21"
130
+ # NOTE: How to get a licence key?
131
+ # - https://github.com/mbj/mutant/issues/1396
132
+ #
133
+ if ::ENV["CONVENIENT_SERVICE_MUTANT_LICENCE_KEY"]
134
+ spec.add_development_dependency "mutant", "~> 0.11.21"
135
+ spec.add_development_dependency "mutant-rspec", "~> 0.11.21"
136
+ end
127
137
 
128
138
  ##
129
139
  # Used for coloring logs.
@@ -190,9 +200,18 @@ Gem::Specification.new do |spec|
190
200
 
191
201
  spec.add_development_dependency "webrick"
192
202
 
193
- spec.add_development_dependency "yard", "~> 0.9.28"
203
+ ##
204
+ # Used for generation of API docs for Ruby code.
205
+ # - https://github.com/lsegal/yard
206
+ # - https://yardoc.org
207
+ #
208
+ spec.add_development_dependency "yard", "~> 0.9.34"
194
209
 
195
- spec.add_development_dependency "yard-junk"
210
+ ##
211
+ # Used for linting YARD docs.
212
+ # - https://github.com/zverok/yard-junk
213
+ #
214
+ spec.add_development_dependency "yard-junk", "~> 0.0.9"
196
215
 
197
216
  ##
198
217
  # The following gems are Convenient Service alternatives.
data/docs/.gitkeep ADDED
File without changes
data/docs/api/.gitkeep ADDED
File without changes
@@ -32,8 +32,8 @@ module ConvenientService
32
32
  # @return [void]
33
33
  #
34
34
  def call
35
- raise Exceptions::ProtoEntityHasNoName.new(proto_entity: proto_entity) unless proto_entity_name
36
- raise Exceptions::ProtoEntityHasNoConcern.new(proto_entity: proto_entity) unless proto_entity_concern
35
+ ::ConvenientService.raise Exceptions::ProtoEntityHasNoName.new(proto_entity: proto_entity) unless proto_entity_name
36
+ ::ConvenientService.raise Exceptions::ProtoEntityHasNoConcern.new(proto_entity: proto_entity) unless proto_entity_concern
37
37
 
38
38
  entity.include Core
39
39
 
@@ -71,6 +71,11 @@ module ConvenientService
71
71
  #
72
72
  entity.class_exec(proto_entity) do |proto_entity|
73
73
  define_singleton_method(:proto_entity) { proto_entity }
74
+
75
+ ##
76
+ # @internal
77
+ # TODO: Try `self.proto_entity == other.proto_entity if self < proto_entity_concern`.
78
+ #
74
79
  define_singleton_method(:==) { |other| self.proto_entity == other.proto_entity if other.respond_to?(:proto_entity) }
75
80
 
76
81
  ##
@@ -6,7 +6,7 @@ module ConvenientService
6
6
  module CanHaveUserProvidedEntity
7
7
  module Exceptions
8
8
  class ProtoEntityHasNoName < ::ConvenientService::Exception
9
- def initialize(proto_entity:)
9
+ def initialize_with_kwargs(proto_entity:)
10
10
  message = <<~TEXT
11
11
  Proto entity `#{proto_entity}` has no name.
12
12
 
@@ -18,12 +18,12 @@ module ConvenientService
18
18
  NOTE: Anonymous classes do NOT have names. Are you passing an anonymous class?
19
19
  TEXT
20
20
 
21
- super(message)
21
+ initialize(message)
22
22
  end
23
23
  end
24
24
 
25
25
  class ProtoEntityHasNoConcern < ::ConvenientService::Exception
26
- def initialize(proto_entity:)
26
+ def initialize_with_kwargs(proto_entity:)
27
27
  message = <<~TEXT
28
28
  Proto entity `#{proto_entity}` has no concern.
29
29
 
@@ -32,7 +32,7 @@ module ConvenientService
32
32
  It is an example of a valid proto entity.
33
33
  TEXT
34
34
 
35
- super(message)
35
+ initialize(message)
36
36
  end
37
37
  end
38
38
  end
@@ -6,7 +6,7 @@ module ConvenientService
6
6
  module HasAroundCallbacks
7
7
  module Exceptions
8
8
  class AroundCallbackChainIsNotContinued < ::ConvenientService::Exception
9
- def initialize(callback:)
9
+ def initialize_with_kwargs(callback:)
10
10
  message = <<~TEXT
11
11
  Around callback chain is NOT continued from `#{callback.block.source_location}`.
12
12
 
@@ -19,7 +19,7 @@ module ConvenientService
19
19
  end
20
20
  TEXT
21
21
 
22
- super(message)
22
+ initialize(message)
23
23
  end
24
24
  end
25
25
  end
@@ -123,12 +123,12 @@ module ConvenientService
123
123
  ##
124
124
  #
125
125
  #
126
- raise Exceptions::AroundCallbackChainIsNotContinued.new(callback: Utils::Array.find_last(around_callbacks, &:called?)) if around_callbacks.any?(&:not_called?)
126
+ ::ConvenientService.raise Exceptions::AroundCallbackChainIsNotContinued.new(callback: Utils::Array.find_last(around_callbacks, &:called?)) if around_callbacks.any?(&:not_called?)
127
127
 
128
128
  ##
129
129
  #
130
130
  #
131
- raise Exceptions::AroundCallbackChainIsNotContinued.new(callback: around_callbacks.last) if initial_around_callback.not_called?
131
+ ::ConvenientService.raise Exceptions::AroundCallbackChainIsNotContinued.new(callback: around_callbacks.last) if initial_around_callback.not_called?
132
132
 
133
133
  original_value
134
134
  end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConvenientService
4
+ module Common
5
+ module Plugins
6
+ module HasInstanceProxy
7
+ module Commands
8
+ class CreateInstanceProxyClass < Support::Command
9
+ ##
10
+ # @!attribute [r] target_class
11
+ # @return [Class]
12
+ #
13
+ attr_reader :target_class
14
+
15
+ ##
16
+ # @param target_class [Class]
17
+ # @return [void]
18
+ #
19
+ def initialize(target_class:)
20
+ @target_class = target_class
21
+ end
22
+
23
+ ##
24
+ # @return [void]
25
+ #
26
+ def call
27
+ klass = ::Class.new(Entities::InstanceProxy)
28
+
29
+ ##
30
+ # @example Result for feature.
31
+ #
32
+ # klass = ConvenientService::Common::Plugins::HasInstanceProxy::Commands::CreateInstanceProxyClass.call(
33
+ # target_class: SomeFeature
34
+ # )
35
+ #
36
+ # ##
37
+ # # `klass` is something like:
38
+ # #
39
+ # # class InstanceProxy < ConvenientService::Service::Plugins::HasInstanceProxy::Entities::InstanceProxy
40
+ # # class << self
41
+ # # def target_class
42
+ # # ##
43
+ # # # NOTE: Returns `target_class` passed to `CreateInstanceProxyClass`.
44
+ # # #
45
+ # # target_class
46
+ # # end
47
+ # #
48
+ # # def ==(other)
49
+ # # return unless other.respond_to?(:target_class)
50
+ # #
51
+ # # self.target_class == other.target_class
52
+ # # end
53
+ # # end
54
+ # # end
55
+ #
56
+ klass.class_exec(target_class) do |target_class|
57
+ ##
58
+ # @return [Class]
59
+ #
60
+ define_singleton_method(:target_class) { target_class }
61
+
62
+ ##
63
+ # @return [Boolean, nil]
64
+ #
65
+ # @internal
66
+ # TODO: Try `self.target_class == other.target_class if self < ::ConvenientService::Common::Plugins::HasInstanceProxy::Entities::InstanceProxy`.
67
+ #
68
+ define_singleton_method(:==) { |other| self.target_class == other.target_class if other.respond_to?(:target_class) }
69
+
70
+ ##
71
+ # @return [String]
72
+ #
73
+ define_singleton_method(:inspect) { "#{target_class}::InstanceProxy" }
74
+ end
75
+
76
+ klass
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "commands/create_instance_proxy_class"