mongoid-locker 2.0.2 → 2.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 +4 -4
- data/.github/workflows/danger.yml +17 -0
- data/.github/workflows/rubocop.yml +13 -0
- data/.github/workflows/test.yml +14 -22
- data/CHANGELOG.md +11 -0
- data/Gemfile +4 -1
- data/README.md +2 -3
- data/RELEASING.md +3 -4
- data/lib/mongoid/locker/version.rb +1 -1
- data/lib/mongoid/locker/wrapper.rb +1 -1
- data/lib/mongoid/locker.rb +1 -4
- data/mongoid-locker.gemspec +1 -1
- metadata +7 -9
- data/.travis.yml +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b26398184af745151395ab8ed2a865222ef35772acfa0844d9b471c6221ffa4
|
4
|
+
data.tar.gz: e67a619634f8ec9c43f040d4cc5c91117ea26f577ff7654de2255a18672065b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e37f059d72651fd282665d1e23dce67d1e2a6a92873dbc5d51a1b47520368c1c63eeaec3d5230a931e206f81b8e3d979eda9ce912bcf0f16d40f2fc95c30891
|
7
|
+
data.tar.gz: e1afb2032299e1ddf2c00d2ea834cf1014d30959b1f6b58e71b8262687b33977204fd191c8baa551a352234b593146ae80978544cce5431e7775ece125cf3e37
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: Danger
|
2
|
+
on: [pull_request]
|
3
|
+
jobs:
|
4
|
+
danger:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
steps:
|
7
|
+
- uses: actions/checkout@v3
|
8
|
+
with:
|
9
|
+
fetch-depth: 0
|
10
|
+
- uses: ruby/setup-ruby@v1
|
11
|
+
with:
|
12
|
+
ruby-version: 2.7
|
13
|
+
bundler-cache: true
|
14
|
+
- run: |
|
15
|
+
# Personal access token for dangerpr-bot - public, but base64 encoded to avoid tripping up GitHub
|
16
|
+
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
|
17
|
+
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
|
data/.github/workflows/test.yml
CHANGED
@@ -10,22 +10,24 @@ jobs:
|
|
10
10
|
matrix:
|
11
11
|
entry:
|
12
12
|
- { ruby: '2.6.6', mongo: 'mongo:4.4', mongoid: '5' }
|
13
|
-
- { ruby: 'jruby-9.1.17.0', mongo: 'mongo:4.4', mongoid: '5' }
|
14
|
-
- { ruby: 'jruby-9.
|
13
|
+
# - { ruby: 'jruby-9.1.17.0', mongo: 'mongo:4.4', mongoid: '5' }
|
14
|
+
- { ruby: 'jruby-9.4.13.0', mongo: 'mongo:4.4', mongoid: '5' }
|
15
15
|
- { ruby: '2.6.6', mongo: 'mongo:4.4', mongoid: '6' }
|
16
16
|
- { ruby: '2.7.1', mongo: 'mongo:4.4', mongoid: '6' }
|
17
17
|
- { ruby: '3.0.5', mongo: 'mongo:4.4', mongoid: '6' }
|
18
18
|
- { ruby: '3.1.3', mongo: 'mongo:4.4', mongoid: '6' }
|
19
|
-
- { ruby: 'jruby-9.
|
19
|
+
- { ruby: 'jruby-9.4.13.0', mongo: 'mongo:4.4', mongoid: '6' }
|
20
20
|
- { ruby: '2.6.6', mongo: 'mongo:4.4', mongoid: '7', coverage: 'true' }
|
21
21
|
- { ruby: '2.7.1', mongo: 'mongo:4.4', mongoid: '7' }
|
22
22
|
- { ruby: '3.0.5', mongo: 'mongo:4.4', mongoid: '7' }
|
23
23
|
- { ruby: '3.1.3', mongo: 'mongo:4.4', mongoid: '7' }
|
24
|
-
- { ruby: 'jruby-9.
|
25
|
-
- { ruby: '2.6.6', mongo: 'mongo:
|
26
|
-
- { ruby: '2.7.1', mongo: 'mongo:
|
27
|
-
- { ruby: '3.0.5', mongo: 'mongo:
|
28
|
-
- { ruby: '3.1.3', mongo: 'mongo:
|
24
|
+
# - { ruby: 'jruby-9.4.13.0', mongo: 'mongo:4.4', mongoid: '7' }
|
25
|
+
- { ruby: '2.6.6', mongo: 'mongo:6.0', mongoid: '8' }
|
26
|
+
- { ruby: '2.7.1', mongo: 'mongo:7.0', mongoid: '8' }
|
27
|
+
- { ruby: '3.0.5', mongo: 'mongo:6.0', mongoid: '8' }
|
28
|
+
- { ruby: '3.1.3', mongo: 'mongo:7.0', mongoid: '8' }
|
29
|
+
- { ruby: '3.1.3', mongo: 'mongo:8.0', mongoid: '9' }
|
30
|
+
# - { ruby: 'jruby-9.4.13.0', mongo: 'mongo:8.0', mongoid: '8' }
|
29
31
|
experimental: [false]
|
30
32
|
|
31
33
|
name: test (ruby=${{ matrix.entry.ruby }}, mongo=${{ matrix.entry.mongo }}, mongoid=${{ matrix.entry.mongoid }})
|
@@ -43,7 +45,7 @@ jobs:
|
|
43
45
|
COVERAGE: ${{ matrix.entry.coverage }}
|
44
46
|
|
45
47
|
steps:
|
46
|
-
- uses: actions/checkout@
|
48
|
+
- uses: actions/checkout@v3
|
47
49
|
|
48
50
|
- name: Set up Ruby
|
49
51
|
uses: ruby/setup-ruby@v1
|
@@ -51,21 +53,11 @@ jobs:
|
|
51
53
|
ruby-version: ${{ matrix.entry.ruby }}
|
52
54
|
bundler-cache: true
|
53
55
|
|
54
|
-
- name: Checks
|
55
|
-
if: ${{ matrix.entry.coverage == 'true' }}
|
56
|
-
run: |
|
57
|
-
bundle exec rubocop
|
58
|
-
# Disabled until mongoid-danger is updated to support Github Actions
|
59
|
-
# bundle exec danger
|
60
|
-
|
61
56
|
- name: Run tests
|
62
57
|
run: bundle exec rspec
|
63
58
|
|
64
59
|
- name: Code Climate
|
65
60
|
if: ${{ env.CC_TEST_REPORTER_ID != '' && success() && matrix.entry.coverage == 'true' }}
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
./cc-test-reporter before-build;
|
70
|
-
./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.json coverage/.resultset.json;
|
71
|
-
./cc-test-reporter upload-coverage;
|
61
|
+
uses: paambaati/codeclimate-action@v3.2.0
|
62
|
+
env:
|
63
|
+
CC_TEST_REPORTER_ID: ${{ vars.CC_TEST_REPORTER_ID }}
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
## Changelog
|
2
2
|
|
3
|
+
### 2.2.0 (2025-06-22)
|
4
|
+
|
5
|
+
* [#107](https://github.com/mongoid/mongoid-locker/pull/107): Revert introduction of `forwardable` to ensure compatibility with mongoid-history - [@scpike](https://github.com/scpike).
|
6
|
+
|
7
|
+
### 2.1.0 (2024-05-07)
|
8
|
+
|
9
|
+
* [#101](https://github.com/mongoid/mongoid-locker/pull/101): Replace the $where operator with the $expr operator - [@amanfrinati](https://github.com/amanfrinati).
|
10
|
+
* [#102](https://github.com/mongoid/mongoid-locker/pull/102): Re-added danger, removed Travis-CI config, extracted RuboCop - [@dblock](https://github.com/dblock).
|
11
|
+
* [#104](https://github.com/mongoid/mongoid-locker/pull/104): Fixed code coverage - [@dblock](https://github.com/dblock).
|
12
|
+
* [#105](https://github.com/mongoid/mongoid-locker/pull/105): Added support for Mongoid 9.0 - [@saisrinivasan](https://github.com/SairamSrinivasan).
|
13
|
+
|
3
14
|
### 2.0.2 (2023-01-24)
|
4
15
|
|
5
16
|
* [#92](https://github.com/mongoid/mongoid-locker/pull/92): Removed TTL and updated unique index definitions - [@cesarizu](https://github.com/cesarizu).
|
data/Gemfile
CHANGED
@@ -4,6 +4,8 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
case ENV['MONGOID_VERSION']
|
7
|
+
when /^9/
|
8
|
+
gem 'mongoid', '~> 9.0'
|
7
9
|
when /^8/
|
8
10
|
gem 'mongoid', '~> 8.0'
|
9
11
|
when /^7/
|
@@ -26,7 +28,8 @@ group :development, :test do
|
|
26
28
|
gem 'pry-byebug', platforms: :mri
|
27
29
|
|
28
30
|
gem 'mongoid-compatibility'
|
29
|
-
gem 'mongoid-danger', '~> 0.
|
31
|
+
gem 'mongoid-danger', '~> 0.2.0'
|
32
|
+
gem 'mongoid-history'
|
30
33
|
gem 'rspec', '~> 3.9'
|
31
34
|
gem 'rubocop', '0.81.0'
|
32
35
|
gem 'rubocop-rspec', '1.38.1'
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Mongoid-Locker
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/mongoid-locker)
|
4
|
-
[](https://travis-ci.org/mongoid/mongoid-locker)
|
4
|
+
[](https://github.com/mongoid/mongoid-locker/actions/workflows/test.yml)
|
6
5
|
[](https://codeclimate.com/github/mongoid/mongoid-locker/maintainability)
|
7
6
|
[](https://codeclimate.com/github/mongoid/mongoid-locker/test_coverage)
|
8
7
|
|
@@ -15,7 +14,7 @@ Document-level optimistic locking for MongoDB via Mongoid. Mongoid-Locker is an
|
|
15
14
|
[Tested](https://github.com/mongoid/mongoid-locker/actions) against:
|
16
15
|
- MRI: `2.3.8`, `2.4.7`, `2.5.7`, `2.6.6`, `2.7.1`, `3.0.5`, `3.1.3`
|
17
16
|
- JRuby `9.1.17.0`, `9.2.11.1`
|
18
|
-
- Mongoid: `5`, `6`, `7`, `8`
|
17
|
+
- Mongoid: `5`, `6`, `7`, `8`, `9`
|
19
18
|
|
20
19
|
See [.github/workflows/test.yml](.github/workflows/test.yml) for the latest test matrix.
|
21
20
|
|
data/RELEASING.md
CHANGED
@@ -48,17 +48,16 @@ Pushed mongoid-locker 0.4.0 to rubygems.org.
|
|
48
48
|
|
49
49
|
### Prepare for the Next Version
|
50
50
|
|
51
|
+
Increment the minor version, modify [lib/mongoid-locker/version.rb](lib/mongoid-locker/version.rb).
|
52
|
+
|
51
53
|
Add the next release to [CHANGELOG.md](CHANGELOG.md).
|
52
54
|
|
53
55
|
```
|
54
|
-
Next
|
55
|
-
============
|
56
|
+
### 0.4.1 (Next)
|
56
57
|
|
57
58
|
* Your contribution here.
|
58
59
|
```
|
59
60
|
|
60
|
-
Increment the minor version, modify [lib/mongoid-locker/version.rb](lib/mongoid-locker/version.rb).
|
61
|
-
|
62
61
|
Commit your changes.
|
63
62
|
|
64
63
|
```
|
@@ -36,7 +36,7 @@ module Mongoid
|
|
36
36
|
]
|
37
37
|
},
|
38
38
|
{
|
39
|
-
'$
|
39
|
+
'$expr': { '$gte': ['$$NOW', { '$add': ["$#{model.locked_at_field}", model.lock_timeout * 1000] }] } # The expr means "Time.now.utc >= model.locked_at_field + model.lock_timeout * 1000"
|
40
40
|
}
|
41
41
|
]
|
42
42
|
}
|
data/lib/mongoid/locker.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'forwardable'
|
4
3
|
require 'securerandom'
|
5
4
|
|
6
5
|
module Mongoid
|
@@ -104,8 +103,6 @@ module Mongoid
|
|
104
103
|
|
105
104
|
# @api private
|
106
105
|
def included(klass)
|
107
|
-
klass.extend(Forwardable) unless klass.ancestors.include?(Forwardable)
|
108
|
-
|
109
106
|
klass.extend ClassMethods
|
110
107
|
klass.singleton_class.instance_eval { attr_accessor(*MODULE_METHODS) }
|
111
108
|
|
@@ -117,7 +114,7 @@ module Mongoid
|
|
117
114
|
klass.backoff_algorithm = backoff_algorithm
|
118
115
|
klass.locking_name_generator = locking_name_generator
|
119
116
|
|
120
|
-
klass.
|
117
|
+
klass.delegate(*MODULE_METHODS, to: :class)
|
121
118
|
klass.singleton_class.delegate(*(methods(false) - MODULE_METHODS.flat_map { |method| [method, "#{method}=".to_sym] } - %i[included reset! configure]), to: self)
|
122
119
|
end
|
123
120
|
end
|
data/mongoid-locker.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-locker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aidan Feldman
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-06-22 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: mongoid
|
@@ -19,7 +18,7 @@ dependencies:
|
|
19
18
|
version: '5.0'
|
20
19
|
- - "<"
|
21
20
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
21
|
+
version: '10'
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +28,7 @@ dependencies:
|
|
29
28
|
version: '5.0'
|
30
29
|
- - "<"
|
31
30
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
31
|
+
version: '10'
|
33
32
|
description: Allows multiple processes to operate on individual documents in MongoDB
|
34
33
|
while ensuring that only one can act at a time.
|
35
34
|
email:
|
@@ -38,12 +37,13 @@ executables: []
|
|
38
37
|
extensions: []
|
39
38
|
extra_rdoc_files: []
|
40
39
|
files:
|
40
|
+
- ".github/workflows/danger.yml"
|
41
|
+
- ".github/workflows/rubocop.yml"
|
41
42
|
- ".github/workflows/test.yml"
|
42
43
|
- ".gitignore"
|
43
44
|
- ".rspec"
|
44
45
|
- ".rubocop.yml"
|
45
46
|
- ".rubocop_todo.yml"
|
46
|
-
- ".travis.yml"
|
47
47
|
- CHANGELOG.md
|
48
48
|
- CONTRIBUTING.md
|
49
49
|
- Dangerfile
|
@@ -65,7 +65,6 @@ homepage: https://github.com/mongoid/mongoid-locker
|
|
65
65
|
licenses:
|
66
66
|
- MIT
|
67
67
|
metadata: {}
|
68
|
-
post_install_message:
|
69
68
|
rdoc_options: []
|
70
69
|
require_paths:
|
71
70
|
- lib
|
@@ -80,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
79
|
- !ruby/object:Gem::Version
|
81
80
|
version: '0'
|
82
81
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
84
|
-
signing_key:
|
82
|
+
rubygems_version: 3.6.2
|
85
83
|
specification_version: 4
|
86
84
|
summary: Document-level optimistic locking for MongoDB via Mongoid.
|
87
85
|
test_files: []
|