opera 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/{ruby.yml → specs.yml} +1 -1
- data/.github/workflows/tag.yml +22 -0
- data/CHANGELOG.md +3 -0
- data/Dockerfile +1 -1
- data/README.md +4 -0
- data/lib/opera/operation/config.rb +3 -2
- data/lib/opera/operation/instructions/executors/transaction.rb +6 -1
- data/lib/opera/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1289d8fac87c7236cf48c043f9901589bbc04965946fac600d5b056d850c006e
|
4
|
+
data.tar.gz: 8aa8a43aeb813b0f388a2f49e814b924426685ac7a00d5b0b224df29f740aea6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e759a1bde5f394fb1baa50c7f268f2c094b2321c57536a3a10ba6a909800736fc31a98b8fdec1bf786626693e4a7e65e7f0a1806665d5d962b5a257f10af8aea
|
7
|
+
data.tar.gz: 4cc58219c20a9f11a2bfad9e9963a0254951609e93ef698b6d89a37a10a55adc5aa1684472b15efbdb82909aa8eadcbbdd0b7c21d85be6573cc8a67da6de29c5
|
@@ -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
data/Dockerfile
CHANGED
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
|
-
|
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
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.
|
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/
|
63
|
+
- ".github/workflows/specs.yml"
|
64
|
+
- ".github/workflows/tag.yml"
|
64
65
|
- ".gitignore"
|
65
66
|
- ".rspec"
|
66
67
|
- ".travis.yml"
|