with_transactional_lock 2.0.0 → 2.2.0

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: ff21d423161756a964b2f3d66e3d5100a053b2e5022a0ca22dcc834d320a6550
4
- data.tar.gz: 15b38d52c10adb844e40e0538fcffe07f56efe0401da3fa9504e7bf3f982b8a4
3
+ metadata.gz: d8147bfe089c9fa8afbb4b8752140c15e650d002eb28cc13f57f01ad19b324a1
4
+ data.tar.gz: b7196af8ba019c67185b62a3362da2e112cccbf8fba68966117b5477f8a8d1c7
5
5
  SHA512:
6
- metadata.gz: 2714430abc86449ff69d15a99b653e519571f811902dce63e4d9a73f89d917f90cd6ef1916fe92a308c92192453b72734b7c80e6b6d82db7f86c5ec93f87bf4c
7
- data.tar.gz: 454d7a27ca333bf4a9e735afd3d21a5d7b7e1e4b1ff40ba9a72e93cd1504d69d47f076708e5943c6ea3a2a496024dd803688ba7f2c0aa2b207febf819724ef06
6
+ metadata.gz: 18e0b1d67b273851c4f31135c2531b72cc1a1ebcf4deed90d2dcae1bcb45ac1e46466932fc0aaa03cbc6d49592a0969c7980f198dd75b7b6db1075c0dd4dc48b
7
+ data.tar.gz: 13457b7faf99b4ab331d6e1fe494b935323c3793eaac5d503e102729a721b8b76b5a111b7e0c64de42e0d761e27b472381d756e7ce0e477ccd9ad5ee28871021
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # with_transactional_lock
2
2
 
3
- [![Build Status](https://travis-ci.com/Betterment/with_transactional_lock.svg?token=6b6DErRMUHX47kEoBZ3t&branch=master)](https://travis-ci.com/Betterment/with_transactional_lock)
4
-
5
3
  A simple extension to ActiveRecord for performing advisory locking on
6
4
  MySQL and PostgreSQL.
7
5
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  begin
2
4
  require 'bundler/setup'
3
5
  rescue LoadError
@@ -20,22 +22,23 @@ load 'rails/tasks/statistics.rake'
20
22
 
21
23
  Bundler::GemHelper.install_tasks
22
24
 
23
- if Rails.env.development? || Rails.env.test?
24
- if defined? Dummy
25
- require 'rspec/core'
26
- require 'rspec/core/rake_task'
27
- require 'rubocop/rake_task'
28
-
29
- RuboCop::RakeTask.new
30
- RSpec::Core::RakeTask.new(:spec)
31
-
32
- task(:default).clear
33
- if ENV['APPRAISAL_INITIALIZED'] || ENV['TRAVIS']
34
- task default: %i(rubocop spec)
35
- else
36
- require 'appraisal'
37
- Appraisal::Task.new
38
- task default: :appraisal
39
- end
25
+ if (Rails.env.development? || Rails.env.test?) && defined? Dummy
26
+ require 'rspec/core'
27
+ require 'rspec/core/rake_task'
28
+ require 'rubocop/rake_task'
29
+
30
+ RuboCop::RakeTask.new
31
+ RSpec::Core::RakeTask.new(:spec)
32
+
33
+ task(:default).clear
34
+ if ENV['APPRAISAL_INITIALIZED'] || ENV['CI']
35
+ tasks = [:spec]
36
+ tasks += [:rubocop] unless ENV['CI']
37
+
38
+ task default: tasks # rubocop:disable Rake/DuplicateTask
39
+ else
40
+ require 'appraisal'
41
+ Appraisal::Task.new
42
+ task default: :appraisal # rubocop:disable Rake/DuplicateTask
40
43
  end
41
44
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators/base'
2
4
  require 'rails/generators/active_record'
3
5
 
@@ -27,7 +29,7 @@ module WithTransactionalLock
27
29
  private
28
30
 
29
31
  def mysql?
30
- ActiveRecord::Base.connection.adapter_name.downcase =~ /mysql/
32
+ ActiveRecord::Base.connection.adapter_name.downcase.include?('mysql')
31
33
  end
32
34
  end
33
35
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTransactionalAdvisoryLocks < ActiveRecord::Migration
2
4
  def change
3
5
  create_table :transactional_advisory_locks, id: false do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # desc "Explaining what the task does"
2
4
  # task :with_transactional_lock do
3
5
  # # Task goes here
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WithTransactionalLock
2
4
  class Engine < ::Rails::Engine
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module WithTransactionalLock
@@ -6,14 +8,14 @@ module WithTransactionalLock
6
8
  delegate :with_transactional_lock, to: :class
7
9
 
8
10
  module ClassMethods
9
- def with_transactional_lock(lock_name, &block)
10
- _advisory_lock_class.new(connection, lock_name).yield_with_lock(&block)
11
+ def with_transactional_lock(lock_name, &)
12
+ _advisory_lock_class.new(connection, lock_name).yield_with_lock(&)
11
13
  end
12
14
 
13
15
  private
14
16
 
15
17
  def _advisory_lock_class
16
- @_advisory_lock_class ||= AdvisoryLockClassLocator.locate(connection) # rubocop:disable Naming/MemoizedInstanceVariableName
18
+ @_advisory_lock_class ||= AdvisoryLockClassLocator.locate(connection)
17
19
  end
18
20
  end
19
21
 
@@ -57,7 +59,8 @@ module WithTransactionalLock
57
59
  private
58
60
 
59
61
  def acquire_lock
60
- connection.execute("insert into transactional_advisory_locks values (#{connection.quote(db_lock_name)}) on duplicate key update lock_id = lock_id")
62
+ connection.execute("insert into transactional_advisory_locks values (#{connection.quote(db_lock_name)}) \
63
+ on duplicate key update lock_id = lock_id")
61
64
  end
62
65
  end
63
66
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WithTransactionalLock
2
4
  class MySqlHelper
3
5
  def self.cleanup(klass = ActiveRecord::Base)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WithTransactionalLock
2
- VERSION = "2.0.0"
4
+ VERSION = "2.2.0"
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "with_transactional_lock/engine"
2
4
 
3
5
  module WithTransactionalLock
@@ -6,6 +8,4 @@ module WithTransactionalLock
6
8
  autoload :MySqlHelper
7
9
  end
8
10
 
9
- ActiveSupport.on_load :active_record do
10
- ActiveRecord::Base.send :include, WithTransactionalLock::Mixin
11
- end
11
+ ActiveSupport.on_load(:active_record) { include WithTransactionalLock::Mixin }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: with_transactional_lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Moore
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-16 00:00:00.000000000 Z
11
+ date: 2024-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.1'
19
+ version: '7.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7'
22
+ version: '7.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '5.1'
29
+ version: '7.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7'
32
+ version: '7.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: appraisal
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: 2.2.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: betterlint
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: database_cleaner
49
63
  requirement: !ruby/object:Gem::Requirement
@@ -62,44 +76,44 @@ dependencies:
62
76
  name: mime-types
63
77
  requirement: !ruby/object:Gem::Requirement
64
78
  requirements:
65
- - - "<"
79
+ - - ">="
66
80
  - !ruby/object:Gem::Version
67
- version: '3'
81
+ version: '0'
68
82
  type: :development
69
83
  prerelease: false
70
84
  version_requirements: !ruby/object:Gem::Requirement
71
85
  requirements:
72
- - - "<"
86
+ - - ">="
73
87
  - !ruby/object:Gem::Version
74
- version: '3'
88
+ version: '0'
75
89
  - !ruby/object:Gem::Dependency
76
90
  name: mysql2
77
91
  requirement: !ruby/object:Gem::Requirement
78
92
  requirements:
79
- - - '='
93
+ - - ">="
80
94
  - !ruby/object:Gem::Version
81
- version: 0.4.5
95
+ version: '0'
82
96
  type: :development
83
97
  prerelease: false
84
98
  version_requirements: !ruby/object:Gem::Requirement
85
99
  requirements:
86
- - - '='
100
+ - - ">="
87
101
  - !ruby/object:Gem::Version
88
- version: 0.4.5
102
+ version: '0'
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: pg
91
105
  requirement: !ruby/object:Gem::Requirement
92
106
  requirements:
93
- - - "~>"
107
+ - - ">="
94
108
  - !ruby/object:Gem::Version
95
- version: '0.1'
109
+ version: '0'
96
110
  type: :development
97
111
  prerelease: false
98
112
  version_requirements: !ruby/object:Gem::Requirement
99
113
  requirements:
100
- - - "~>"
114
+ - - ">="
101
115
  - !ruby/object:Gem::Version
102
- version: '0.1'
116
+ version: '0'
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: rspec-rails
105
119
  requirement: !ruby/object:Gem::Requirement
@@ -129,33 +143,19 @@ dependencies:
129
143
  - !ruby/object:Gem::Version
130
144
  version: '0'
131
145
  - !ruby/object:Gem::Dependency
132
- name: rubocop-betterment
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - ">="
136
- - !ruby/object:Gem::Version
137
- version: '0'
138
- type: :development
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- version: '0'
145
- - !ruby/object:Gem::Dependency
146
- name: travis
146
+ name: sprockets
147
147
  requirement: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - ">="
149
+ - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '0'
151
+ version: '3.0'
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
- - - ">="
156
+ - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: '0'
158
+ version: '3.0'
159
159
  description: Advisory locking support for MySQL and Postgresql done right.
160
160
  email:
161
161
  - sam@betterment.com
@@ -178,8 +178,10 @@ files:
178
178
  homepage: https://github.com/Betterment/with_transactional_lock
179
179
  licenses:
180
180
  - MIT
181
- metadata: {}
182
- post_install_message:
181
+ metadata:
182
+ allowed_push_host: https://rubygems.org
183
+ rubygems_mfa_required: 'true'
184
+ post_install_message:
183
185
  rdoc_options: []
184
186
  require_paths:
185
187
  - lib
@@ -187,15 +189,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
187
189
  requirements:
188
190
  - - ">="
189
191
  - !ruby/object:Gem::Version
190
- version: '0'
192
+ version: '3.2'
191
193
  required_rubygems_version: !ruby/object:Gem::Requirement
192
194
  requirements:
193
195
  - - ">="
194
196
  - !ruby/object:Gem::Version
195
197
  version: '0'
196
198
  requirements: []
197
- rubygems_version: 3.0.3
198
- signing_key:
199
+ rubygems_version: 3.5.6
200
+ signing_key:
199
201
  specification_version: 4
200
202
  summary: Transactional advisory locks for ActiveRecord
201
203
  test_files: []