with_advisory_lock 4.0.0 → 5.0.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 (40) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +80 -0
  3. data/.gitignore +3 -0
  4. data/.tool-versions +1 -0
  5. data/Appraisals +37 -11
  6. data/CHANGELOG.md +131 -0
  7. data/Gemfile +0 -12
  8. data/README.md +85 -171
  9. data/gemfiles/{activerecord_5.1.gemfile → activerecord_6.1.gemfile} +4 -2
  10. data/gemfiles/{activerecord_5.2.gemfile → activerecord_7.0.gemfile} +4 -2
  11. data/gemfiles/activerecord_7.1.gemfile +14 -0
  12. data/lib/with_advisory_lock/base.rb +16 -2
  13. data/lib/with_advisory_lock/concern.rb +13 -2
  14. data/lib/with_advisory_lock/database_adapter_support.rb +10 -3
  15. data/lib/with_advisory_lock/failed_to_acquire_lock.rb +7 -0
  16. data/lib/with_advisory_lock/flock.rb +4 -3
  17. data/lib/with_advisory_lock/mysql.rb +6 -16
  18. data/lib/with_advisory_lock/postgresql.rb +9 -7
  19. data/lib/with_advisory_lock/version.rb +3 -1
  20. data/lib/with_advisory_lock.rb +1 -1
  21. data/test/concern_test.rb +23 -10
  22. data/test/lock_test.rb +61 -28
  23. data/test/nesting_test.rb +14 -46
  24. data/test/options_test.rb +35 -33
  25. data/test/parallelism_test.rb +35 -37
  26. data/test/shared_test.rb +93 -90
  27. data/test/test_helper.rb +52 -0
  28. data/test/test_models.rb +9 -7
  29. data/test/thread_test.rb +23 -22
  30. data/test/transaction_test.rb +34 -36
  31. data/with_advisory_lock.gemspec +24 -23
  32. metadata +27 -41
  33. data/.travis.install-mysql-5.7.sh +0 -11
  34. data/.travis.yml +0 -32
  35. data/gemfiles/activerecord_4.2.gemfile +0 -19
  36. data/gemfiles/activerecord_5.0.gemfile +0 -19
  37. data/lib/with_advisory_lock/nested_advisory_lock_error.rb +0 -14
  38. data/test/database.yml +0 -17
  39. data/test/minitest_helper.rb +0 -40
  40. 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.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew McEachen
8
- autorequire:
8
+ - Abdelkader Boudih
9
+ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2018-07-04 00:00:00.000000000 Z
12
+ date: 2023-10-29 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activerecord
@@ -16,30 +17,16 @@ 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
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
29
+ name: appraisal
43
30
  requirement: !ruby/object:Gem::Requirement
44
31
  requirements:
45
32
  - - ">="
@@ -53,7 +40,7 @@ dependencies:
53
40
  - !ruby/object:Gem::Version
54
41
  version: '0'
55
42
  - !ruby/object:Gem::Dependency
56
- name: minitest-great_expectations
43
+ name: maxitest
57
44
  requirement: !ruby/object:Gem::Requirement
58
45
  requirements:
59
46
  - - ">="
@@ -95,7 +82,7 @@ dependencies:
95
82
  - !ruby/object:Gem::Version
96
83
  version: '0'
97
84
  - !ruby/object:Gem::Dependency
98
- name: appraisal
85
+ name: yard
99
86
  requirement: !ruby/object:Gem::Requirement
100
87
  requirements:
101
88
  - - ">="
@@ -111,49 +98,50 @@ dependencies:
111
98
  description: Advisory locking for ActiveRecord
112
99
  email:
113
100
  - matthew+github@mceachen.org
101
+ - terminale@gmail.com
114
102
  executables: []
115
103
  extensions: []
116
104
  extra_rdoc_files: []
117
105
  files:
106
+ - ".github/workflows/ci.yml"
118
107
  - ".gitignore"
119
- - ".travis.install-mysql-5.7.sh"
120
- - ".travis.yml"
108
+ - ".tool-versions"
121
109
  - Appraisals
110
+ - CHANGELOG.md
122
111
  - Gemfile
123
112
  - LICENSE.txt
124
113
  - README.md
125
114
  - Rakefile
126
- - gemfiles/activerecord_4.2.gemfile
127
- - gemfiles/activerecord_5.0.gemfile
128
- - gemfiles/activerecord_5.1.gemfile
129
- - gemfiles/activerecord_5.2.gemfile
115
+ - gemfiles/activerecord_6.1.gemfile
116
+ - gemfiles/activerecord_7.0.gemfile
117
+ - gemfiles/activerecord_7.1.gemfile
130
118
  - lib/with_advisory_lock.rb
131
119
  - lib/with_advisory_lock/base.rb
132
120
  - lib/with_advisory_lock/concern.rb
133
121
  - lib/with_advisory_lock/database_adapter_support.rb
122
+ - lib/with_advisory_lock/failed_to_acquire_lock.rb
134
123
  - lib/with_advisory_lock/flock.rb
135
124
  - lib/with_advisory_lock/mysql.rb
136
- - lib/with_advisory_lock/nested_advisory_lock_error.rb
137
125
  - lib/with_advisory_lock/postgresql.rb
138
126
  - lib/with_advisory_lock/version.rb
139
127
  - test/concern_test.rb
140
- - test/database.yml
141
128
  - test/lock_test.rb
142
- - test/minitest_helper.rb
143
129
  - test/nesting_test.rb
144
130
  - test/options_test.rb
145
131
  - test/parallelism_test.rb
146
132
  - test/shared_test.rb
133
+ - test/test_helper.rb
147
134
  - test/test_models.rb
148
135
  - test/thread_test.rb
149
136
  - test/transaction_test.rb
150
- - tests.sh
151
137
  - with_advisory_lock.gemspec
152
- homepage: https://github.com/mceachen/with_advisory_lock
138
+ homepage: https://github.com/ClosureTree/with_advisory_lock
153
139
  licenses:
154
140
  - MIT
155
- metadata: {}
156
- post_install_message:
141
+ metadata:
142
+ rubyspecs_mfa_required: 'true'
143
+ yard.run: yri
144
+ post_install_message:
157
145
  rdoc_options: []
158
146
  require_paths:
159
147
  - lib
@@ -161,27 +149,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
149
  requirements:
162
150
  - - ">="
163
151
  - !ruby/object:Gem::Version
164
- version: 2.2.10
152
+ version: 2.7.0
165
153
  required_rubygems_version: !ruby/object:Gem::Requirement
166
154
  requirements:
167
155
  - - ">="
168
156
  - !ruby/object:Gem::Version
169
157
  version: '0'
170
158
  requirements: []
171
- rubyforge_project:
172
- rubygems_version: 2.6.11
173
- signing_key:
159
+ rubygems_version: 3.4.12
160
+ signing_key:
174
161
  specification_version: 4
175
162
  summary: Advisory locking for ActiveRecord
176
163
  test_files:
177
164
  - test/concern_test.rb
178
- - test/database.yml
179
165
  - test/lock_test.rb
180
- - test/minitest_helper.rb
181
166
  - test/nesting_test.rb
182
167
  - test/options_test.rb
183
168
  - test/parallelism_test.rb
184
169
  - test/shared_test.rb
170
+ - test/test_helper.rb
185
171
  - test/test_models.rb
186
172
  - test/thread_test.rb
187
173
  - test/transaction_test.rb
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env bash
2
- if [[ "${MYSQL_VERSION}" == "5.7" ]]; then
3
- sudo service mysql stop || echo "mysql not stopped"
4
- sudo stop mysql-5.6 || echo "mysql-5.6 not stopped"
5
- echo mysql-apt-config mysql-apt-config/select-server select mysql-5.7 | sudo debconf-set-selections
6
- wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
7
- sudo dpkg --install mysql-apt-config_0.7.3-1_all.deb
8
- sudo apt-get update -q
9
- sudo apt-get install -q -y --allow-unauthenticated -o Dpkg::Options::=--force-confnew mysql-server
10
- sudo mysql_upgrade
11
- fi
data/.travis.yml DELETED
@@ -1,32 +0,0 @@
1
- language: ruby
2
-
3
- dist: trusty
4
- sudo: required
5
-
6
- rvm:
7
- - 2.5.1
8
- - 2.4.0
9
- - 2.3.3
10
- - 2.2.10
11
-
12
- gemfile:
13
- - gemfiles/activerecord_5.2.gemfile
14
- - gemfiles/activerecord_5.1.gemfile
15
- - gemfiles/activerecord_5.0.gemfile
16
- - gemfiles/activerecord_4.2.gemfile
17
-
18
- env:
19
- - DB=postgresql
20
- - DB=mysql
21
- - DB=mysql MYSQL_VERSION=5.7
22
- - DB=sqlite
23
-
24
- before_install:
25
- - gem install bundler
26
-
27
- script: WITH_ADVISORY_LOCK_PREFIX=$TRAVIS_JOB_ID bundle exec rake --trace
28
-
29
- before_script:
30
- - bash .travis.install-mysql-5.7.sh
31
- - mysql -e 'create database with_advisory_lock_test'
32
- - psql -c 'create database with_advisory_lock_test' -U postgres
@@ -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"
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"
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,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