with_advisory_lock 4.6.0 → 5.1.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +80 -0
  3. data/.github/workflows/release.yml +20 -0
  4. data/.gitignore +2 -0
  5. data/.release-please-manifest.json +1 -0
  6. data/.tool-versions +1 -1
  7. data/Appraisals +34 -18
  8. data/CHANGELOG.md +31 -0
  9. data/Gemfile +0 -12
  10. data/README.md +17 -6
  11. data/gemfiles/{activerecord_6.0.gemfile → activerecord_6.1.gemfile} +4 -2
  12. data/gemfiles/{activerecord_5.2.gemfile → activerecord_7.0.gemfile} +4 -2
  13. data/gemfiles/activerecord_7.1.gemfile +14 -0
  14. data/lib/with_advisory_lock/base.rb +17 -3
  15. data/lib/with_advisory_lock/concern.rb +13 -17
  16. data/lib/with_advisory_lock/database_adapter_support.rb +4 -41
  17. data/lib/with_advisory_lock/failed_to_acquire_lock.rb +9 -0
  18. data/lib/with_advisory_lock/flock.rb +4 -3
  19. data/lib/with_advisory_lock/mysql.rb +5 -5
  20. data/lib/with_advisory_lock/postgresql.rb +9 -7
  21. data/lib/with_advisory_lock/version.rb +3 -1
  22. data/lib/with_advisory_lock.rb +8 -10
  23. data/release-please-config.json +9 -0
  24. data/test/concern_test.rb +23 -10
  25. data/test/lock_test.rb +61 -28
  26. data/test/nesting_test.rb +14 -79
  27. data/test/options_test.rb +35 -33
  28. data/test/parallelism_test.rb +35 -37
  29. data/test/shared_test.rb +93 -90
  30. data/test/test_helper.rb +52 -0
  31. data/test/test_models.rb +9 -7
  32. data/test/thread_test.rb +23 -22
  33. data/test/transaction_test.rb +34 -36
  34. data/with_advisory_lock.gemspec +29 -23
  35. metadata +32 -28
  36. data/.travis.yml +0 -38
  37. data/gemfiles/activerecord_4.2.gemfile +0 -19
  38. data/gemfiles/activerecord_5.0.gemfile +0 -19
  39. data/gemfiles/activerecord_5.1.gemfile +0 -19
  40. data/lib/with_advisory_lock/mysql_no_nesting.rb +0 -20
  41. data/lib/with_advisory_lock/nested_advisory_lock_error.rb +0 -14
  42. data/test/database.yml +0 -17
  43. data/test/minitest_helper.rb +0 -40
  44. data/tests.sh +0 -11
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: with_advisory_lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew McEachen
8
+ - Abdelkader Boudih
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2019-09-20 00:00:00.000000000 Z
12
+ date: 2024-01-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activerecord
@@ -16,30 +17,30 @@ dependencies:
16
17
  requirements:
17
18
  - - ">="
18
19
  - !ruby/object:Gem::Version
19
- version: '4.2'
20
+ version: '6.1'
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - ">="
25
26
  - !ruby/object:Gem::Version
26
- version: '4.2'
27
+ version: '6.1'
27
28
  - !ruby/object:Gem::Dependency
28
- name: yard
29
+ name: zeitwerk
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
32
  - - ">="
32
33
  - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
34
+ version: '2.6'
35
+ type: :runtime
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
39
  - - ">="
39
40
  - !ruby/object:Gem::Version
40
- version: '0'
41
+ version: '2.6'
41
42
  - !ruby/object:Gem::Dependency
42
- name: minitest
43
+ name: appraisal
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
46
  - - ">="
@@ -53,7 +54,7 @@ dependencies:
53
54
  - !ruby/object:Gem::Version
54
55
  version: '0'
55
56
  - !ruby/object:Gem::Dependency
56
- name: minitest-great_expectations
57
+ name: maxitest
57
58
  requirement: !ruby/object:Gem::Requirement
58
59
  requirements:
59
60
  - - ">="
@@ -95,7 +96,7 @@ dependencies:
95
96
  - !ruby/object:Gem::Version
96
97
  version: '0'
97
98
  - !ruby/object:Gem::Dependency
98
- name: appraisal
99
+ name: yard
99
100
  requirement: !ruby/object:Gem::Requirement
100
101
  requirements:
101
102
  - - ">="
@@ -111,51 +112,55 @@ dependencies:
111
112
  description: Advisory locking for ActiveRecord
112
113
  email:
113
114
  - matthew+github@mceachen.org
115
+ - terminale@gmail.com
114
116
  executables: []
115
117
  extensions: []
116
118
  extra_rdoc_files: []
117
119
  files:
120
+ - ".github/workflows/ci.yml"
121
+ - ".github/workflows/release.yml"
118
122
  - ".gitignore"
123
+ - ".release-please-manifest.json"
119
124
  - ".tool-versions"
120
- - ".travis.yml"
121
125
  - Appraisals
122
126
  - CHANGELOG.md
123
127
  - Gemfile
124
128
  - LICENSE.txt
125
129
  - README.md
126
130
  - Rakefile
127
- - gemfiles/activerecord_4.2.gemfile
128
- - gemfiles/activerecord_5.0.gemfile
129
- - gemfiles/activerecord_5.1.gemfile
130
- - gemfiles/activerecord_5.2.gemfile
131
- - gemfiles/activerecord_6.0.gemfile
131
+ - gemfiles/activerecord_6.1.gemfile
132
+ - gemfiles/activerecord_7.0.gemfile
133
+ - gemfiles/activerecord_7.1.gemfile
132
134
  - lib/with_advisory_lock.rb
133
135
  - lib/with_advisory_lock/base.rb
134
136
  - lib/with_advisory_lock/concern.rb
135
137
  - lib/with_advisory_lock/database_adapter_support.rb
138
+ - lib/with_advisory_lock/failed_to_acquire_lock.rb
136
139
  - lib/with_advisory_lock/flock.rb
137
140
  - lib/with_advisory_lock/mysql.rb
138
- - lib/with_advisory_lock/mysql_no_nesting.rb
139
- - lib/with_advisory_lock/nested_advisory_lock_error.rb
140
141
  - lib/with_advisory_lock/postgresql.rb
141
142
  - lib/with_advisory_lock/version.rb
143
+ - release-please-config.json
142
144
  - test/concern_test.rb
143
- - test/database.yml
144
145
  - test/lock_test.rb
145
- - test/minitest_helper.rb
146
146
  - test/nesting_test.rb
147
147
  - test/options_test.rb
148
148
  - test/parallelism_test.rb
149
149
  - test/shared_test.rb
150
+ - test/test_helper.rb
150
151
  - test/test_models.rb
151
152
  - test/thread_test.rb
152
153
  - test/transaction_test.rb
153
- - tests.sh
154
154
  - with_advisory_lock.gemspec
155
- homepage: https://github.com/mceachen/with_advisory_lock
155
+ homepage: https://github.com/ClosureTree/with_advisory_lock
156
156
  licenses:
157
157
  - MIT
158
- metadata: {}
158
+ metadata:
159
+ rubyspecs_mfa_required: 'true'
160
+ yard.run: yri
161
+ homepage_uri: https://github.com/ClosureTree/with_advisory_lock
162
+ source_code_uri: https://github.com/ClosureTree/with_advisory_lock
163
+ changelog_uri: https://github.com/ClosureTree/with_advisory_lock/blob/master/CHANGELOG.md
159
164
  post_install_message:
160
165
  rdoc_options: []
161
166
  require_paths:
@@ -164,26 +169,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
169
  requirements:
165
170
  - - ">="
166
171
  - !ruby/object:Gem::Version
167
- version: 2.2.10
172
+ version: 2.7.0
168
173
  required_rubygems_version: !ruby/object:Gem::Requirement
169
174
  requirements:
170
175
  - - ">="
171
176
  - !ruby/object:Gem::Version
172
177
  version: '0'
173
178
  requirements: []
174
- rubygems_version: 3.0.3
179
+ rubygems_version: 3.4.10
175
180
  signing_key:
176
181
  specification_version: 4
177
182
  summary: Advisory locking for ActiveRecord
178
183
  test_files:
179
184
  - test/concern_test.rb
180
- - test/database.yml
181
185
  - test/lock_test.rb
182
- - test/minitest_helper.rb
183
186
  - test/nesting_test.rb
184
187
  - test/options_test.rb
185
188
  - test/parallelism_test.rb
186
189
  - test/shared_test.rb
190
+ - test/test_helper.rb
187
191
  - test/test_models.rb
188
192
  - test/thread_test.rb
189
193
  - test/transaction_test.rb
data/.travis.yml DELETED
@@ -1,38 +0,0 @@
1
- language: ruby
2
-
3
- services:
4
- - postgresql
5
- - mysql
6
-
7
- addons:
8
- postgresql: "10"
9
-
10
- rvm:
11
- - 2.6.4
12
- - 2.5.6
13
- - 2.4.7
14
-
15
- gemfile:
16
- - gemfiles/activerecord_6.0.gemfile
17
- - gemfiles/activerecord_5.2.gemfile
18
- - gemfiles/activerecord_5.1.gemfile
19
- - gemfiles/activerecord_5.0.gemfile
20
- - gemfiles/activerecord_4.2.gemfile
21
-
22
- env:
23
- global:
24
- - WITH_ADVISORY_LOCK_PREFIX=$TRAVIS_JOB_ID
25
- matrix:
26
- - DB=postgresql
27
- - DB=mysql MYSQL_VERSION=5.7
28
- - DB=sqlite
29
- matrix:
30
- exclude:
31
- - rvm: 2.4.7
32
- gemfile: gemfiles/activerecord_6.0.gemfile
33
-
34
- before_install:
35
- - mysql -e 'create database with_advisory_lock_test'
36
- - psql -c 'create database with_advisory_lock_test' -U postgres
37
-
38
- script: bundle exec rake --trace
@@ -1,19 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 4.2.0"
6
-
7
- platforms :ruby do
8
- gem "mysql2", "< 0.5"
9
- gem "pg", "~> 0.21"
10
- gem "sqlite3", "~> 1.3.6"
11
- end
12
-
13
- platforms :jruby do
14
- gem "activerecord-jdbcmysql-adapter"
15
- gem "activerecord-jdbcpostgresql-adapter"
16
- gem "activerecord-jdbcsqlite3-adapter"
17
- end
18
-
19
- gemspec path: "../"
@@ -1,19 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 5.0.0"
6
-
7
- platforms :ruby do
8
- gem "mysql2"
9
- gem "pg"
10
- gem "sqlite3", "~> 1.3.6"
11
- end
12
-
13
- platforms :jruby do
14
- gem "activerecord-jdbcmysql-adapter"
15
- gem "activerecord-jdbcpostgresql-adapter"
16
- gem "activerecord-jdbcsqlite3-adapter"
17
- end
18
-
19
- gemspec path: "../"
@@ -1,19 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 5.1.0"
6
-
7
- platforms :ruby do
8
- gem "mysql2"
9
- gem "pg"
10
- gem "sqlite3", "~> 1.3.6"
11
- end
12
-
13
- platforms :jruby do
14
- gem "activerecord-jdbcmysql-adapter"
15
- gem "activerecord-jdbcpostgresql-adapter"
16
- gem "activerecord-jdbcsqlite3-adapter"
17
- end
18
-
19
- gemspec path: "../"
@@ -1,20 +0,0 @@
1
- module WithAdvisoryLock
2
- # For MySQL < 5.7.5 that does not support nested locks
3
- class MySQLNoNesting < MySQL
4
- # See http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_get-lock
5
- def try_lock
6
- unless lock_stack.empty?
7
- raise NestedAdvisoryLockError.new(
8
- "MySQL < 5.7.5 doesn't support nested Advisory Locks",
9
- lock_stack.dup
10
- )
11
- end
12
- super
13
- end
14
-
15
- # MySQL doesn't support nested locks:
16
- def already_locked?
17
- lock_stack.last == lock_stack_item
18
- end
19
- end
20
- end
@@ -1,14 +0,0 @@
1
- module WithAdvisoryLock
2
- class NestedAdvisoryLockError < StandardError
3
- attr_accessor :lock_stack
4
-
5
- def initialize(msg = nil, lock_stack = nil)
6
- super(msg)
7
- @lock_stack = lock_stack
8
- end
9
-
10
- def to_s
11
- super + (lock_stack ? ": lock stack = #{lock_stack}" : '')
12
- end
13
- end
14
- end
data/test/database.yml DELETED
@@ -1,17 +0,0 @@
1
- sqlite:
2
- adapter: <%= "jdbc" if defined? JRUBY_VERSION %>sqlite3
3
- database: test/sqlite.db
4
- timeout: 500
5
- pool: 50
6
- postgresql:
7
- adapter: postgresql
8
- username: postgres
9
- database: with_advisory_lock_test
10
- min_messages: ERROR
11
- pool: 50
12
- mysql:
13
- adapter: mysql2
14
- host: localhost
15
- username: root
16
- database: with_advisory_lock_test
17
- pool: 50
@@ -1,40 +0,0 @@
1
- require 'erb'
2
- require 'active_record'
3
- require 'with_advisory_lock'
4
- require 'tmpdir'
5
- require 'securerandom'
6
-
7
- def env_db
8
- (ENV['DB'] || :mysql).to_sym
9
- end
10
-
11
- db_config = File.expand_path('database.yml', File.dirname(__FILE__))
12
- ActiveRecord::Base.configurations = YAML::load(ERB.new(IO.read(db_config)).result)
13
-
14
- ENV['WITH_ADVISORY_LOCK_PREFIX'] ||= SecureRandom.hex
15
-
16
- ActiveRecord::Base.establish_connection(env_db)
17
- ActiveRecord::Migration.verbose = false
18
-
19
- require 'test_models'
20
- begin
21
- require 'minitest'
22
- rescue LoadError
23
- puts 'Failed to load the minitest gem; built-in version will be used.'
24
- end
25
- require 'minitest/autorun'
26
- require 'minitest/great_expectations'
27
- require 'mocha/setup'
28
-
29
- class MiniTest::Spec
30
- before do
31
- ENV['FLOCK_DIR'] = Dir.mktmpdir
32
- Tag.delete_all
33
- TagAudit.delete_all
34
- Label.delete_all
35
- end
36
- after do
37
- FileUtils.remove_entry_secure ENV['FLOCK_DIR']
38
- end
39
- end
40
-
data/tests.sh DELETED
@@ -1,11 +0,0 @@
1
- #!/bin/bash -e
2
- export DB
3
-
4
- for RUBY in 2.4.0 jruby-1.7.13 ; do
5
- rbenv local $RUBY
6
- for DB in mysql postgresql sqlite ; do
7
- echo "$DB | $(ruby -v)"
8
- # appraisal bundle update
9
- appraisal rake test --verbose
10
- done
11
- done