activerecord-transactionable 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23dd2012182b1767de176fbf2f5bd9225285b7bc5549ff479430ea62b5fe2a72
4
- data.tar.gz: 794ce01d1a9d3d4b04259c316c3bfbfe3021552a6cd5721810461cfbc9129e89
3
+ metadata.gz: b7d5f0d70200bcd62ca45dd9639614241ad9922c69e26e5e60db1e8c19724ce6
4
+ data.tar.gz: de2e9d597d44673930c041d7765178e901dceb540461badcde91370b1576e22a
5
5
  SHA512:
6
- metadata.gz: 9435ef3d0c5ca100c1a4fffa1b1d0c9c284b5965bb6aaf36b85da81116a4e7d5338394e52b48c09f709924fc6370e1115e074fcca400bfeec911885d4a2dcad4
7
- data.tar.gz: 5a9b93e0897d9f5b384258d8ee8634cb10a99893db308deb61443649050a815f9dbc12db0ce0248d12545e366339d395096c96445637e14587a2b4426d707c75
6
+ metadata.gz: 29aca93fae0610d28954de9fd702d0df342445ff51b70849d4fdea3d18618e818a0cf16b87f800d67519b9719f746786492698595c1ae99fab6b9f61c3945281
7
+ data.tar.gz: efe950e407b33d34189abeac8aa1c17e527f29bb2c9c331843fac698f6a017792f8263ad65ac151e47bc718dd429de070a31dfe38115461d214d2db9a0d3151d
@@ -47,6 +47,7 @@ jobs:
47
47
  - name: Run tests
48
48
  run: bundle exec rake test
49
49
  - uses: codecov/codecov-action@v2
50
+ if: matrix.ruby == '2.6' && github.event_name != 'pull_request' && always()
50
51
  with:
51
52
  flags: unittests
52
53
  name: codecov-upload
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-11-09 16:50:27 UTC using RuboCop version 1.22.3.
3
+ # on 2021-11-10 07:27:25 UTC using RuboCop version 1.22.3.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -81,6 +81,17 @@ RSpec/ContextWording:
81
81
  Exclude:
82
82
  - 'spec/activerecord/transactionable_spec.rb'
83
83
 
84
+ # Offense count: 1
85
+ # Configuration parameters: CountAsOne.
86
+ RSpec/ExampleLength:
87
+ Max: 10
88
+
89
+ # Offense count: 1
90
+ # Configuration parameters: AssignmentOnly.
91
+ RSpec/InstanceVariable:
92
+ Exclude:
93
+ - 'spec/activerecord/transactionable_spec.rb'
94
+
84
95
  # Offense count: 5
85
96
  RSpec/LeakyConstantDeclaration:
86
97
  Exclude:
@@ -102,7 +113,7 @@ RSpec/NamedSubject:
102
113
  Exclude:
103
114
  - 'spec/activerecord/transactionable_spec.rb'
104
115
 
105
- # Offense count: 49
116
+ # Offense count: 54
106
117
  RSpec/NestedGroups:
107
118
  Max: 8
108
119
 
@@ -124,15 +135,15 @@ Style/GuardClause:
124
135
  - 'README.md'
125
136
  - 'spec/activerecord/transactionable_spec.rb'
126
137
 
127
- # Offense count: 2
138
+ # Offense count: 5
128
139
  ThreadSafety/InstanceVariableInClassMethod:
129
140
  Exclude:
130
141
  - 'spec/activerecord/transactionable_spec.rb'
131
142
 
132
- # Offense count: 68
143
+ # Offense count: 70
133
144
  # Cop supports --auto-correct.
134
145
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
135
146
  # URISchemes: http, https
136
147
  # IgnoredPatterns: (?-mix:^\#)
137
148
  Layout/LineLength:
138
- Max: 272
149
+ Max: 278
data/.simplecov CHANGED
@@ -1,5 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- SimpleCov.start do
4
- add_filter "/spec/"
3
+ ruby_version = Gem::Version.new(RUBY_VERSION)
4
+ actual_version = lambda do |major, minor|
5
+ actual = Gem::Version.new(ruby_version)
6
+ major == actual.segments[0] && minor == actual.segments[1] && RUBY_ENGINE == "ruby"
7
+ end
8
+ coverage = actual_version.call(2, 6)
9
+
10
+ if coverage
11
+ require "simplecov-cobertura"
12
+ require "simplecov_json_formatter"
13
+ require "codecov"
14
+
15
+ SimpleCov.start do
16
+ add_filter "/spec/"
17
+ add_filter "/lib/activerecord/transactionable/version.rb"
18
+
19
+ if ENV["CI"]
20
+ # Disambiguate individual test runs
21
+ command_name "#{ENV["GITHUB_WORKFLOW"]} Job #{ENV["GITHUB_RUN_ID"]}:#{ENV["GITHUB_RUN_NUMBER"]}"
22
+ formatters = []
23
+ formatters << SimpleCov::Formatter::HTMLFormatter
24
+ formatters << SimpleCov::Formatter::CoberturaFormatter
25
+ formatters << SimpleCov::Formatter::JSONFormatter # For CodeClimate
26
+ formatters << SimpleCov::Formatter::Codecov # For CodeCov
27
+ formatter SimpleCov::Formatter::MultiFormatter.new(formatters)
28
+ else
29
+ # Use default
30
+ formatter SimpleCov::Formatter::HTMLFormatter
31
+ end
32
+
33
+ track_files "**/*.rb"
34
+ end
35
+ else
36
+ puts "Not running coverage on #{RUBY_ENGINE} #{RUBY_VERSION}"
5
37
  end
@@ -23,8 +23,13 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  ruby_version = Gem::Version.new(RUBY_VERSION)
25
25
  minimum_version = ->(version) { ruby_version >= Gem::Version.new(version) && RUBY_ENGINE == "ruby" }
26
+ actual_version = lambda do |major, minor|
27
+ actual = Gem::Version.new(ruby_version)
28
+ major == actual.segments[0] && minor == actual.segments[1] && RUBY_ENGINE == "ruby"
29
+ end
30
+ coverage = actual_version.call(2, 6)
26
31
  linting = minimum_version.call("2.6")
27
- coverage = minimum_version.call("2.6")
32
+ stream = minimum_version.call("2.3")
28
33
 
29
34
  spec.add_dependency "activemodel", ">= 4.0.0"
30
35
  spec.add_dependency "activerecord", ">= 4.0.0"
@@ -36,6 +41,7 @@ Gem::Specification.new do |spec|
36
41
  spec.add_development_dependency "rspec-benchmark", "~> 0.6"
37
42
  spec.add_development_dependency "rspec-block_is_expected", "~> 1.0"
38
43
  spec.add_development_dependency "rspec-pending_for", "~> 0.1"
44
+ spec.add_development_dependency "silent_stream", "~> 1.0" if stream
39
45
  if linting
40
46
  spec.add_development_dependency("rubocop", "~> 1.22")
41
47
  spec.add_development_dependency("rubocop-md", "~> 1.0")
@@ -47,6 +53,7 @@ Gem::Specification.new do |spec|
47
53
  spec.add_development_dependency("rubocop-thread_safety", "~> 0.4")
48
54
  end
49
55
  if coverage
56
+ spec.add_development_dependency("codecov", "~> 0.6")
50
57
  spec.add_development_dependency("simplecov", "~> 0.21")
51
58
  spec.add_development_dependency("simplecov-cobertura", "~> 1.4")
52
59
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Activerecord
4
4
  module Transactionable
5
- VERSION = "3.0.0"
5
+ VERSION = "3.0.1"
6
6
  end
7
7
  end
@@ -63,6 +63,7 @@ module Activerecord
63
63
  lock = args.delete(:lock)
64
64
  inside_args = extract_args(args, INSIDE_TRANSACTION_ERROR_HANDLERS)
65
65
  outside_args = extract_args(args, OUTSIDE_TRANSACTION_ERROR_HANDLERS)
66
+ transaction_args = extract_args(args, TRANSACTION_METHOD_ARG_NAMES)
66
67
  transaction_open = ActiveRecord::Base.connection.transaction_open?
67
68
  unless args.keys.empty?
68
69
  raise ArgumentError,
@@ -75,13 +76,12 @@ module Activerecord
75
76
  "#{self} should not rescue #{ERRORS_TO_DISALLOW_INSIDE_TRANSACTION.inspect} inside a transaction: #{inside_args.keys.inspect}"
76
77
  end
77
78
 
78
- transaction_args = extract_args(args, TRANSACTION_METHOD_ARG_NAMES)
79
79
  if transaction_open
80
80
  if transaction_args[REQUIRES_NEW]
81
81
  logger.debug("[#{self}.transaction_wrapper] Will start a nested transaction.")
82
82
  else
83
83
  transaction_args[REQUIRES_NEW] = true
84
- logger.warn("[#{self}.transaction_wrapper] Opening a nested transaction. Setting require_new: true")
84
+ logger.warn("[#{self}.transaction_wrapper] Opening a nested transaction. Setting #{REQUIRES_NEW}: true")
85
85
  end
86
86
  end
87
87
  error_handler_outside_transaction(object: object, transaction_open: transaction_open,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-transactionable
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-09 00:00:00.000000000 Z
11
+ date: 2021-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.1'
139
+ - !ruby/object:Gem::Dependency
140
+ name: silent_stream
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '1.0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '1.0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rubocop
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -248,34 +262,6 @@ dependencies:
248
262
  - - "~>"
249
263
  - !ruby/object:Gem::Version
250
264
  version: '0.4'
251
- - !ruby/object:Gem::Dependency
252
- name: simplecov
253
- requirement: !ruby/object:Gem::Requirement
254
- requirements:
255
- - - "~>"
256
- - !ruby/object:Gem::Version
257
- version: '0.21'
258
- type: :development
259
- prerelease: false
260
- version_requirements: !ruby/object:Gem::Requirement
261
- requirements:
262
- - - "~>"
263
- - !ruby/object:Gem::Version
264
- version: '0.21'
265
- - !ruby/object:Gem::Dependency
266
- name: simplecov-cobertura
267
- requirement: !ruby/object:Gem::Requirement
268
- requirements:
269
- - - "~>"
270
- - !ruby/object:Gem::Version
271
- version: '1.4'
272
- type: :development
273
- prerelease: false
274
- version_requirements: !ruby/object:Gem::Requirement
275
- requirements:
276
- - - "~>"
277
- - !ruby/object:Gem::Version
278
- version: '1.4'
279
265
  - !ruby/object:Gem::Dependency
280
266
  name: sqlite3
281
267
  requirement: !ruby/object:Gem::Requirement
@@ -353,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
353
339
  - !ruby/object:Gem::Version
354
340
  version: '0'
355
341
  requirements: []
356
- rubygems_version: 3.0.3.1
342
+ rubygems_version: 3.2.22
357
343
  signing_key:
358
344
  specification_version: 4
359
345
  summary: Do ActiveRecord transactions the right way.