operations 0.0.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +33 -0
  3. data/.gitignore +4 -0
  4. data/.rspec +0 -2
  5. data/.rubocop.yml +21 -0
  6. data/.rubocop_todo.yml +36 -0
  7. data/Appraisals +8 -0
  8. data/CHANGELOG.md +11 -0
  9. data/Gemfile +8 -2
  10. data/README.md +910 -5
  11. data/Rakefile +3 -1
  12. data/gemfiles/rails.5.2.gemfile +14 -0
  13. data/gemfiles/rails.6.0.gemfile +14 -0
  14. data/gemfiles/rails.6.1.gemfile +14 -0
  15. data/gemfiles/rails.7.0.gemfile +14 -0
  16. data/gemfiles/rails.7.1.gemfile +14 -0
  17. data/lib/operations/command.rb +412 -0
  18. data/lib/operations/components/base.rb +79 -0
  19. data/lib/operations/components/callback.rb +55 -0
  20. data/lib/operations/components/contract.rb +20 -0
  21. data/lib/operations/components/idempotency.rb +70 -0
  22. data/lib/operations/components/on_failure.rb +16 -0
  23. data/lib/operations/components/on_success.rb +35 -0
  24. data/lib/operations/components/operation.rb +37 -0
  25. data/lib/operations/components/policies.rb +42 -0
  26. data/lib/operations/components/prechecks.rb +38 -0
  27. data/lib/operations/components/preconditions.rb +45 -0
  28. data/lib/operations/components.rb +5 -0
  29. data/lib/operations/configuration.rb +15 -0
  30. data/lib/operations/contract/messages_resolver.rb +11 -0
  31. data/lib/operations/contract.rb +39 -0
  32. data/lib/operations/convenience.rb +102 -0
  33. data/lib/operations/form/attribute.rb +42 -0
  34. data/lib/operations/form/builder.rb +85 -0
  35. data/lib/operations/form.rb +194 -0
  36. data/lib/operations/result.rb +122 -0
  37. data/lib/operations/test_helpers.rb +71 -0
  38. data/lib/operations/types.rb +6 -0
  39. data/lib/operations/version.rb +3 -1
  40. data/lib/operations.rb +42 -2
  41. data/operations.gemspec +20 -4
  42. metadata +164 -9
  43. data/.travis.yml +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf740be1742fc1666c6f267de424b06a9425cb78fe089253a1d2a78925543df0
4
- data.tar.gz: d4c62d797221d7faa212546c65531b52ca4a870341e221b7f9d6dc8620416fa3
3
+ metadata.gz: cc575adbf6fc2bf4be98c515a6339190ed29243ccccf2655a8927b0a8f95ac5a
4
+ data.tar.gz: 486800ebcbd4bc7cffff7aa9e272dba34500a568911a23bb5c7ce60accbb7cea
5
5
  SHA512:
6
- metadata.gz: 204c0d86f57cab8870587d1b4609ce8a6fd2ee751137ccfb3b3f82f0351ec712fb31b1639e772d54e8f950e6a8c581462ba77ab0c0cf66a3b538dadb95c3f76d
7
- data.tar.gz: 11e6be8e4f42e2d6b8cbf43e1a4e6a316297d22002852ec0914f776222d42bb3372e8e0042a4fcd1d7f5ff46a94f2f09492335bcc9c33951bdbf853c3f61e6fa
6
+ metadata.gz: 1998a83aa5e434c3431d43bf7036f674a2f5f1fd0859f0ea08fc24fe28c419c4a3ee42b07948d8d3faecb2b0b118d006119aa0818e03edd948292ff2e102222c
7
+ data.tar.gz: b8fab83bfa1f14e139ec3b946f01496e22ec4a57243e74bcee354389e7818847b7df7bd9cd4cf66178e2bf247db1bccd9bd9d6bca12db6fb33b15bbcfb42f572
@@ -0,0 +1,33 @@
1
+ name: CI
2
+ on: [push]
3
+ jobs:
4
+ rspec:
5
+ strategy:
6
+ fail-fast: false
7
+ matrix:
8
+ include:
9
+ - { ruby: '2.7', rails: '5.2' }
10
+ - { ruby: '2.7', rails: '6.0' }
11
+ - { ruby: '3.0', rails: '6.1' }
12
+ - { ruby: '3.1', rails: '7.0' }
13
+ - { ruby: '3.2', rails: '7.1' }
14
+ runs-on: ubuntu-latest
15
+ env:
16
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails.${{ matrix.rails }}.gemfile
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ bundler-cache: true
23
+ - run: bundle exec rspec
24
+
25
+ rubocop:
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v2
29
+ - uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: 2.7
32
+ bundler-cache: true
33
+ - run: bundle exec rubocop
data/.gitignore CHANGED
@@ -9,3 +9,7 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ .ruby-version
14
+ .ruby-gemset
15
+ Gemfile.lock
data/.rspec CHANGED
@@ -1,3 +1 @@
1
- --format documentation
2
- --color
3
1
  --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,21 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rails
4
+ - rubocop-rspec
5
+
6
+ inherit_gem:
7
+ bookingsync-rubocop:
8
+ - config/base.yml
9
+ - config/rails.yml
10
+ - config/rspec.yml
11
+
12
+ inherit_from: .rubocop_todo.yml
13
+
14
+ inherit_mode:
15
+ merge:
16
+ - Exclude
17
+
18
+ AllCops:
19
+ TargetRubyVersion: 2.7
20
+ Exclude:
21
+ - gemfiles/*
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,36 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2023-03-25 07:19:50 UTC using RuboCop version 1.44.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ # Configuration parameters: EnforcedStyle, AllowedGems, Include.
11
+ # SupportedStyles: Gemfile, gems.rb, gemspec
12
+ # AllowedGems: bundler
13
+ # Include: **/*.gemspec, **/Gemfile, **/gems.rb
14
+ Gemspec/DevelopmentDependencies:
15
+ Exclude:
16
+ - 'operations.gemspec'
17
+
18
+ # Offense count: 5
19
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
20
+ Metrics/AbcSize:
21
+ Max: 28
22
+
23
+ # Offense count: 2
24
+ # Configuration parameters: CountComments, CountAsOne.
25
+ Metrics/ClassLength:
26
+ Max: 160
27
+
28
+ # Offense count: 7
29
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
30
+ Metrics/MethodLength:
31
+ Max: 17
32
+
33
+ # Offense count: 1
34
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
35
+ Metrics/ParameterLists:
36
+ Max: 7
data/Appraisals ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ %w[5.2 6.0 6.1 7.0 7.1].each do |version|
4
+ appraise "rails.#{version}" do
5
+ gem "activerecord", "~> #{version}.0"
6
+ gem "activesupport", "~> #{version}.0"
7
+ end
8
+ end
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ ## [0.6.2](https://github.com/BookingSync/operations/tree/main)
4
+
5
+ ### Added
6
+
7
+ - Support Rails 7.1 [\#40](https://github.com/BookingSync/operations/pull/40) ([ston1x](https://github.com/pyromaniac))
8
+ - Include `Dry::Monads[:result]` in Policies, Preconditions and Callbacks [\#39](https://github.com/BookingSync/operations/pull/39) ([ston1x](https://github.com/ston1x))
9
+ - Add `callback` method to `Operations::Convenience` [\#37](https://github.com/BookingSync/operations/pull/37) ([pyromaniac](https://github.com/pyromaniac))
10
+ - Ability to access operation result in callbacks [\#36](https://github.com/BookingSync/operations/pull/36) ([pyromaniac](https://github.com/pyromaniac))
11
+ - Introduce Command#merge [\#34](https://github.com/BookingSync/operations/pull/34) ([pyromaniac](https://github.com/pyromaniac))
data/Gemfile CHANGED
@@ -1,7 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in operations.gemspec
4
6
  gemspec
5
7
 
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
8
+ gem "bookingsync-rubocop", require: false, github: "BookingSync/bookingsync-rubocop", branch: "main"
9
+ gem "rspec"
10
+ gem "rubocop", require: false
11
+ gem "rubocop-performance", require: false
12
+ gem "rubocop-rails", require: false
13
+ gem "rubocop-rspec", require: false