opera 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b922627852454757caa71f7e68809b9917497f85f2d030b2b34d2482ed47a2df
4
- data.tar.gz: 8fad54614ba1f135b2a2b3f5aac75d2c52552fd3ba2dd8f9b378476efe52fc6a
3
+ metadata.gz: 1289d8fac87c7236cf48c043f9901589bbc04965946fac600d5b056d850c006e
4
+ data.tar.gz: 8aa8a43aeb813b0f388a2f49e814b924426685ac7a00d5b0b224df29f740aea6
5
5
  SHA512:
6
- metadata.gz: ea6e336bd01af71651d07a2d7987ae5549a95868f6d003a94bb193bc028126a7df86158c36da9050bb7aed000b1265f536bde3156b41abb670d08132bb9269e2
7
- data.tar.gz: b1a3ed4f3c40f05def6b75caaf1d98d64629d9f423a4c0bf8137ac1fa18972c55269501cefec9f52d147bcf79c344979c778c257ecd1420ce2612a886ca077e3
6
+ metadata.gz: e759a1bde5f394fb1baa50c7f268f2c094b2321c57536a3a10ba6a909800736fc31a98b8fdec1bf786626693e4a7e65e7f0a1806665d5d962b5a257f10af8aea
7
+ data.tar.gz: 4cc58219c20a9f11a2bfad9e9963a0254951609e93ef698b6d89a37a10a55adc5aa1684472b15efbdb82909aa8eadcbbdd0b7c21d85be6573cc8a67da6de29c5
@@ -5,7 +5,7 @@
5
5
  # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
6
  # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
7
 
8
- name: Ruby
8
+ name: Specs
9
9
 
10
10
  on:
11
11
  push:
@@ -0,0 +1,22 @@
1
+ # This is a basic workflow to help you get started with Actions
2
+
3
+ name: Tag
4
+
5
+ # Controls when the workflow will run
6
+ on:
7
+ # Triggers the workflow on push or pull request events but only for the master branch
8
+ push:
9
+ branches: [ master ]
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+
18
+ - name: Tag automatically
19
+ run: git tag v`cat lib/opera/version.rb | grep 'VERSION' | awk '{ print $3 $4 }' | sed "s/'//g"`
20
+
21
+ - name: Push tags
22
+ run: git push origin --tags
data/CHANGELOG.md CHANGED
@@ -4,3 +4,6 @@
4
4
 
5
5
  - Initial release
6
6
 
7
+ ## 0.2.1 - July 7, 2021
8
+
9
+ - Support for transaction options
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM ruby:2.7.1
1
+ FROM ruby:3
2
2
 
3
3
  MAINTAINER ProFinda Developers <dev@profinda.com>
4
4
 
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Opera
2
2
 
3
+ ![Master](https://github.com/Profinda/opera/actions/workflows/ruby.yml/badge.svg?branch=master)
4
+
5
+
3
6
  Simple DSL for services/interactions classes.
4
7
 
5
8
  Opera was born to mimic some of the philosophy of the dry gems but keeping the DSL simple.
@@ -31,6 +34,7 @@ Simply initialise the configuration and chose what method you want to use to rep
31
34
  Opera::Operation::Config.configure do |config|
32
35
  config.transaction_class = ActiveRecord::Base
33
36
  config.transaction_method = :transaction
37
+ config.transaction_options = { requires_new: true }
34
38
  config.reporter = defined?(Rollbar) ? Rollbar : Rails.logger
35
39
  end
36
40
  ```
@@ -3,11 +3,12 @@
3
3
  module Opera
4
4
  module Operation
5
5
  class Config
6
- attr_accessor :transaction_class, :transaction_method, :reporter
6
+ attr_accessor :transaction_class, :transaction_method, :transaction_options, :reporter
7
7
 
8
8
  def initialize
9
9
  @transaction_class = self.class.transaction_class
10
10
  @transaction_method = self.class.transaction_method || :transaction
11
+ @transaction_options = self.class.transaction_options
11
12
  @reporter = custom_reporter || self.class.reporter
12
13
  end
13
14
 
@@ -20,7 +21,7 @@ module Opera
20
21
  end
21
22
 
22
23
  class << self
23
- attr_accessor :transaction_class, :transaction_method, :reporter
24
+ attr_accessor :transaction_class, :transaction_method, :transaction_options, :reporter
24
25
 
25
26
  def configure
26
27
  yield self
@@ -8,7 +8,8 @@ module Opera
8
8
  class RollbackTransactionError < Opera::Error; end
9
9
 
10
10
  def call(instruction)
11
- transaction_class.send(transaction_method) do
11
+ arguments = transaction_options ? [transaction_method, transaction_options] : [transaction_method]
12
+ transaction_class.send(*arguments) do
12
13
  super
13
14
 
14
15
  return if !operation.finished? && result.success?
@@ -26,6 +27,10 @@ module Opera
26
27
  def transaction_method
27
28
  config.transaction_method
28
29
  end
30
+
31
+ def transaction_options
32
+ config.transaction_options
33
+ end
29
34
  end
30
35
  end
31
36
  end
data/lib/opera/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Opera
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opera
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ProFinda Development Team
@@ -60,7 +60,8 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - ".github/workflows/gem-push.yml"
63
- - ".github/workflows/ruby.yml"
63
+ - ".github/workflows/specs.yml"
64
+ - ".github/workflows/tag.yml"
64
65
  - ".gitignore"
65
66
  - ".rspec"
66
67
  - ".travis.yml"