u-case 4.1.1 → 4.2.0

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: feb30aaeb689640c0e2690c14e9f951896ced470bb3a9d31262c6441a37e3e57
4
- data.tar.gz: 7fceb73bac6e4f6bc82558636679ad646c7c454e8ff516bb920632fb2e1c29a6
3
+ metadata.gz: 4b6e79d90ba9b66b09c320bcd68465f9db2289086b4530123ccf01db2376f752
4
+ data.tar.gz: 4b6138b6384302eeb45bf17bd653d4918e0076d2c22c4fbdbcc54588d069c2d2
5
5
  SHA512:
6
- metadata.gz: 27d50ac0ce1cb8129f752d181a5707bfe3ac8c2e2228448945d5d80b4b4cb7d6481b4b9a860bb9c686e34306c6aed0acb2a65fb507a807882f2de128bee7cfbd
7
- data.tar.gz: 0fca08fe550b5519f3a754b529e2e636b04a9433be093219526fab694596d431950f308c5a4f322b0a7810ec63a448ce8feec230dab60d405465c57c19e5c8ea
6
+ metadata.gz: f5c4ea89afe401408e10484875588a63242319a87d0a1e4e95299dc87f08fa02787e571218be57fb581c8b09288cf34925738ad7fc534ef741ea52b2720be091
7
+ data.tar.gz: c7eefe6ecc11d20f46495a52052c31a6ab2884bd79dd79a068d5babc26a3bd3c0800cb4ff6337a3f5c8e6739b9111a59de07c5811b2fe804975e9f598824e926
data/.travis.sh CHANGED
@@ -2,20 +2,35 @@
2
2
 
3
3
  ruby_v=$(ruby -v)
4
4
 
5
- ACTIVEMODEL_VERSION='3.2' bundle update
6
- ACTIVEMODEL_VERSION='3.2' ENABLE_TRANSITIONS='false' bundle exec rake test
7
- ACTIVEMODEL_VERSION='3.2' ENABLE_TRANSITIONS='true' bundle exec rake test
5
+ ACTIVERECORD_VERSION='3.2' bundle update
6
+ ACTIVERECORD_VERSION='3.2' ENABLE_TRANSITIONS='false' bundle exec rake test
7
+ ACTIVERECORD_VERSION='3.2' ENABLE_TRANSITIONS='true' bundle exec rake test
8
+
9
+ ACTIVERECORD_VERSION='4.0' bundle update
10
+ ACTIVERECORD_VERSION='4.0' bundle exec rake test
11
+
12
+ ACTIVERECORD_VERSION='4.1' bundle update
13
+ ACTIVERECORD_VERSION='4.1' bundle exec rake test
14
+
15
+ ACTIVERECORD_VERSION='4.2' bundle update
16
+ ACTIVERECORD_VERSION='4.2' bundle exec rake test
17
+
18
+ ACTIVERECORD_VERSION='5.0' bundle update
19
+ ACTIVERECORD_VERSION='5.0' bundle exec rake test
20
+
21
+ ACTIVERECORD_VERSION='5.1' bundle update
22
+ ACTIVERECORD_VERSION='5.1' bundle exec rake test
8
23
 
9
24
  if [[ ! $ruby_v =~ '2.2.0' ]]; then
10
- ACTIVEMODEL_VERSION='5.2' bundle update
11
- ACTIVEMODEL_VERSION='5.2' ENABLE_TRANSITIONS='false' bundle exec rake test
12
- ACTIVEMODEL_VERSION='5.2' ENABLE_TRANSITIONS='true' bundle exec rake test
25
+ ACTIVERECORD_VERSION='5.2' bundle update
26
+ ACTIVERECORD_VERSION='5.2' ENABLE_TRANSITIONS='false' bundle exec rake test
27
+ ACTIVERECORD_VERSION='5.2' ENABLE_TRANSITIONS='true' bundle exec rake test
13
28
  fi
14
29
 
15
30
  if [[ $ruby_v =~ '2.5.' ]] || [[ $ruby_v =~ '2.6.' ]] || [[ $ruby_v =~ '2.7.' ]]; then
16
- ACTIVEMODEL_VERSION='6.0' bundle update
17
- ACTIVEMODEL_VERSION='6.0' ENABLE_TRANSITIONS='false' bundle exec rake test
18
- ACTIVEMODEL_VERSION='6.0' ENABLE_TRANSITIONS='true' bundle exec rake test
31
+ ACTIVERECORD_VERSION='6.0' bundle update
32
+ ACTIVERECORD_VERSION='6.0' ENABLE_TRANSITIONS='false' bundle exec rake test
33
+ ACTIVERECORD_VERSION='6.0' ENABLE_TRANSITIONS='true' bundle exec rake test
19
34
  fi
20
35
 
21
36
  bundle update
data/Gemfile CHANGED
@@ -2,19 +2,19 @@ source "https://rubygems.org"
2
2
 
3
3
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
- activemodel_version = ENV.fetch('ACTIVEMODEL_VERSION', '6.1.0')
5
+ activerecord_version = ENV.fetch('ACTIVERECORD_VERSION', '6.1')
6
6
 
7
- activemodel = case activemodel_version
7
+ activerecord = case activerecord_version
8
8
  when '3.2' then '3.2.22'
9
+ when '4.0' then '4.0.13'
10
+ when '4.1' then '4.1.16'
11
+ when '4.2' then '4.2.11'
12
+ when '5.0' then '5.0.7'
13
+ when '5.1' then '5.1.7'
9
14
  when '5.2' then '5.2.3'
10
- when '6.0' then '6.0.2'
15
+ when '6.0' then '6.0.3'
11
16
  end
12
17
 
13
- if activemodel_version < '6.1.0'
14
- gem 'activemodel', activemodel, require: false
15
- gem 'activesupport', activemodel, require: false
16
- end
17
-
18
18
  simplecov_version =
19
19
  case RUBY_VERSION
20
20
  when /\A2.[23]/ then '~> 0.17.1'
@@ -23,9 +23,20 @@ simplecov_version =
23
23
  end
24
24
 
25
25
  group :test do
26
- gem 'minitest', activemodel_version < '4.1' ? '~> 4.2' : '~> 5.0'
26
+ gem 'minitest', activerecord_version < '4.1' ? '~> 4.2' : '~> 5.0'
27
27
 
28
28
  gem 'simplecov', simplecov_version, require: false
29
+
30
+ if activerecord
31
+ sqlite3 =
32
+ case activerecord
33
+ when /\A6\.0/, nil then '~> 1.4.0'
34
+ else '~> 1.3.0'
35
+ end
36
+
37
+ gem 'sqlite3', sqlite3
38
+ gem 'activerecord', activerecord, require: 'active_record'
39
+ end
29
40
  end
30
41
 
31
42
  pry_byebug_version =
data/README.md CHANGED
@@ -39,12 +39,12 @@ The main project goals are:
39
39
  Version | Documentation
40
40
  --------- | -------------
41
41
  unreleased| https://github.com/serradura/u-case/blob/main/README.md
42
- 4.1.1 | https://github.com/serradura/u-case/blob/v4.x/README.md
42
+ 4.2.0 | https://github.com/serradura/u-case/blob/v4.x/README.md
43
43
  3.1.0 | https://github.com/serradura/u-case/blob/v3.x/README.md
44
44
  2.6.0 | https://github.com/serradura/u-case/blob/v2.x/README.md
45
45
  1.1.0 | https://github.com/serradura/u-case/blob/v1.x/README.md
46
46
 
47
- > **Note:** Você entende português? 🇧🇷🇵🇹 Verifique o [README traduzido em pt-BR](https://github.com/serradura/u-case/blob/main/README.pt-BR.md).
47
+ > **Note:** Você entende português? 🇧🇷&nbsp;🇵🇹 Verifique o [README traduzido em pt-BR](https://github.com/serradura/u-case/blob/main/README.pt-BR.md).
48
48
 
49
49
  ## Table of Contents <!-- omit in toc -->
50
50
  - [Compatibility](#compatibility)
@@ -102,7 +102,7 @@ unreleased| https://github.com/serradura/u-case/blob/main/README.md
102
102
  | u-case | branch | ruby | activemodel | u-attributes |
103
103
  | -------------- | ------- | -------- | ------------- | ------------ |
104
104
  | unreleased | main | >= 2.2.0 | >= 3.2, < 6.1 | ~> 2.0 |
105
- | 4.1.1 | v4.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 2.0 |
105
+ | 4.2.0 | v4.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 2.0 |
106
106
  | 3.1.0 | v3.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
107
107
  | 2.6.0 | v2.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
108
108
  | 1.1.0 | v1.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
@@ -39,7 +39,7 @@ Principais objetivos deste projeto:
39
39
  Versão | Documentação
40
40
  --------- | -------------
41
41
  unreleased| https://github.com/serradura/u-case/blob/main/README.md
42
- 4.1.1 | https://github.com/serradura/u-case/blob/v4.x/README.md
42
+ 4.2.0 | https://github.com/serradura/u-case/blob/v4.x/README.md
43
43
  3.1.0 | https://github.com/serradura/u-case/blob/v3.x/README.md
44
44
  2.6.0 | https://github.com/serradura/u-case/blob/v2.x/README.md
45
45
  1.1.0 | https://github.com/serradura/u-case/blob/v1.x/README.md
@@ -100,7 +100,7 @@ unreleased| https://github.com/serradura/u-case/blob/main/README.md
100
100
 
101
101
  | u-case | branch | ruby | activemodel | u-attributes |
102
102
  | -------------- | ------- | -------- | ------------- | ------------ |
103
- | 4.1.1 | main | >= 2.2.0 | >= 3.2, < 6.1 | ~> 2.0 |
103
+ | 4.2.0 | main | >= 2.2.0 | >= 3.2, < 6.1 | ~> 2.0 |
104
104
  | 3.1.0 | v3.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
105
105
  | 2.6.0 | v2.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
106
106
  | 1.1.0 | v1.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
@@ -243,6 +243,20 @@ module Micro
243
243
  @__result.__set__(is_success, value, type, self)
244
244
  end
245
245
 
246
+ def transaction(adapter = :activerecord)
247
+ raise NotImplementedError unless adapter == :activerecord
248
+
249
+ result = nil
250
+
251
+ ActiveRecord::Base.transaction do
252
+ result = yield
253
+
254
+ raise ActiveRecord::Rollback if result.failure?
255
+ end
256
+
257
+ result
258
+ end
259
+
246
260
  private_constant :MapFailureType, :INVALID_INVOCATION_OF_THE_THEN_METHOD
247
261
  end
248
262
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Micro
4
4
  class Case
5
- VERSION = '4.1.1'.freeze
5
+ VERSION = '4.2.0'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: u-case
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Serradura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-15 00:00:00.000000000 Z
11
+ date: 2020-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kind