mongoid-locker 2.0.2 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81cc5f3f7114bc807ad56afade38745fb74d2d4ed45eb007a12b0e61a0237450
4
- data.tar.gz: 81ba6e72064c31a302ffcbfd0a6df6c555051057d2b8890b696ef3b62d033baa
3
+ metadata.gz: 2e8773897b78e752adb20817abcc9ac800089614d3a1e3b797e2f551f87470d1
4
+ data.tar.gz: e6283788f21ccefda79d62b61329530a6a996874ed067496c102f51087d6dd21
5
5
  SHA512:
6
- metadata.gz: 75b674da45761991d07da697139454f53864327d9b3f0a73b20e5d5a278f1faabce95430c3cfc7e06ff2597a5be4acccb4c714b66d2ec17b0b93ef270c934a5e
7
- data.tar.gz: 402ab3c14985c52c65b4440c7b763d8b59ccf1f9e33cd97b7324f237353443edd96e9134031ee15735213ed1d19cf8865151f05a0e32dd12d8ce43f3c3e4f04e
6
+ metadata.gz: 2922aac736bb767623cec9d51d69d80b51473d2e02be9265ddea767b29e4109185bc3ef259a8643697efc91cf7c1e7b506e7018ef46810e3881275ba18955138
7
+ data.tar.gz: 5c215fb77dcba9646496f0eaf4735cdacd955540946d6cf5565d61c639764be3336e2123cdab050b1587444488e2ba82b4501955ad63aade3e289e353f9de75d
@@ -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
@@ -0,0 +1,13 @@
1
+ name: Rubocop
2
+ on: [push, pull_request]
3
+ jobs:
4
+ lint:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v3
8
+ - name: Set up Ruby
9
+ uses: ruby/setup-ruby@v1
10
+ with:
11
+ ruby-version: 2.7
12
+ bundler-cache: true
13
+ - run: bundle exec rubocop
@@ -10,7 +10,7 @@ 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' }
13
+ # - { ruby: 'jruby-9.1.17.0', mongo: 'mongo:4.4', mongoid: '5' }
14
14
  - { ruby: 'jruby-9.2.11.1', 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' }
@@ -26,6 +26,7 @@ jobs:
26
26
  - { ruby: '2.7.1', mongo: 'mongo:4.4', mongoid: '8' }
27
27
  - { ruby: '3.0.5', mongo: 'mongo:4.4', mongoid: '8' }
28
28
  - { ruby: '3.1.3', mongo: 'mongo:4.4', mongoid: '8' }
29
+ - { ruby: '3.1.3', mongo: 'mongo:4.4', mongoid: '9' }
29
30
  experimental: [false]
30
31
 
31
32
  name: test (ruby=${{ matrix.entry.ruby }}, mongo=${{ matrix.entry.mongo }}, mongoid=${{ matrix.entry.mongoid }})
@@ -43,7 +44,7 @@ jobs:
43
44
  COVERAGE: ${{ matrix.entry.coverage }}
44
45
 
45
46
  steps:
46
- - uses: actions/checkout@v2
47
+ - uses: actions/checkout@v3
47
48
 
48
49
  - name: Set up Ruby
49
50
  uses: ruby/setup-ruby@v1
@@ -51,21 +52,11 @@ jobs:
51
52
  ruby-version: ${{ matrix.entry.ruby }}
52
53
  bundler-cache: true
53
54
 
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
55
  - name: Run tests
62
56
  run: bundle exec rspec
63
57
 
64
58
  - name: Code Climate
65
59
  if: ${{ env.CC_TEST_REPORTER_ID != '' && success() && matrix.entry.coverage == 'true' }}
66
- run: |
67
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter;
68
- chmod +x ./cc-test-reporter;
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;
60
+ uses: paambaati/codeclimate-action@v3.2.0
61
+ env:
62
+ CC_TEST_REPORTER_ID: ${{ vars.CC_TEST_REPORTER_ID }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## Changelog
2
2
 
3
+ ### 2.1.0 (2024-05-07)
4
+
5
+ * [#101](https://github.com/mongoid/mongoid-locker/pull/101): Replace the $where operator with the $expr operator - [@amanfrinati](https://github.com/amanfrinati).
6
+ * [#102](https://github.com/mongoid/mongoid-locker/pull/102): Re-added danger, removed Travis-CI config, extracted RuboCop - [@dblock](https://github.com/dblock).
7
+ * [#104](https://github.com/mongoid/mongoid-locker/pull/104): Fixed code coverage - [@dblock](https://github.com/dblock).
8
+ * [#105](https://github.com/mongoid/mongoid-locker/pull/105): Added support for Mongoid 9.0 - [@saisrinivasan](https://github.com/SairamSrinivasan).
9
+
3
10
  ### 2.0.2 (2023-01-24)
4
11
 
5
12
  * [#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,7 @@ group :development, :test do
26
28
  gem 'pry-byebug', platforms: :mri
27
29
 
28
30
  gem 'mongoid-compatibility'
29
- gem 'mongoid-danger', '~> 0.1.1'
31
+ gem 'mongoid-danger', '~> 0.2.0'
30
32
  gem 'rspec', '~> 3.9'
31
33
  gem 'rubocop', '0.81.0'
32
34
  gem 'rubocop-rspec', '1.38.1'
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Mongoid-Locker
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/mongoid-locker.svg)](https://badge.fury.io/rb/mongoid-locker)
4
- [![Test Status](https://github.com/mongoid/mongoid-locker/workflows/Test/badge.svg)](https://github.com/mongoid/mongoid-locker/actions)
5
- [![Build Status](https://travis-ci.org/mongoid/mongoid-locker.svg?branch=master)](https://travis-ci.org/mongoid/mongoid-locker)
4
+ [![Test](https://github.com/mongoid/mongoid-locker/actions/workflows/test.yml/badge.svg)](https://github.com/mongoid/mongoid-locker/actions/workflows/test.yml)
6
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/04ee4ee75ff54659300a/maintainability)](https://codeclimate.com/github/mongoid/mongoid-locker/maintainability)
7
6
  [![Test Coverage](https://api.codeclimate.com/v1/badges/04ee4ee75ff54659300a/test_coverage)](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 Release
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
  ```
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mongoid
4
4
  module Locker
5
- VERSION = '2.0.2'
5
+ VERSION = '2.1.0'
6
6
  end
7
7
  end
@@ -36,7 +36,7 @@ module Mongoid
36
36
  ]
37
37
  },
38
38
  {
39
- '$where': "new Date() - this.#{model.locked_at_field} >= #{model.lock_timeout * 1000}"
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
  }
@@ -18,5 +18,5 @@ Gem::Specification.new do |s|
18
18
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
19
19
  s.require_paths = ['lib']
20
20
 
21
- s.add_dependency 'mongoid', '>= 5.0', '< 9'
21
+ s.add_dependency 'mongoid', '>= 5.0', '< 10'
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-locker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aidan Feldman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-24 00:00:00.000000000 Z
11
+ date: 2024-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '9'
22
+ version: '10'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '9'
32
+ version: '10'
33
33
  description: Allows multiple processes to operate on individual documents in MongoDB
34
34
  while ensuring that only one can act at a time.
35
35
  email:
@@ -38,12 +38,13 @@ executables: []
38
38
  extensions: []
39
39
  extra_rdoc_files: []
40
40
  files:
41
+ - ".github/workflows/danger.yml"
42
+ - ".github/workflows/rubocop.yml"
41
43
  - ".github/workflows/test.yml"
42
44
  - ".gitignore"
43
45
  - ".rspec"
44
46
  - ".rubocop.yml"
45
47
  - ".rubocop_todo.yml"
46
- - ".travis.yml"
47
48
  - CHANGELOG.md
48
49
  - CONTRIBUTING.md
49
50
  - Dangerfile
@@ -65,7 +66,7 @@ homepage: https://github.com/mongoid/mongoid-locker
65
66
  licenses:
66
67
  - MIT
67
68
  metadata: {}
68
- post_install_message:
69
+ post_install_message:
69
70
  rdoc_options: []
70
71
  require_paths:
71
72
  - lib
@@ -80,8 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
81
  - !ruby/object:Gem::Version
81
82
  version: '0'
82
83
  requirements: []
83
- rubygems_version: 3.0.9
84
- signing_key:
84
+ rubygems_version: 3.3.7
85
+ signing_key:
85
86
  specification_version: 4
86
87
  summary: Document-level optimistic locking for MongoDB via Mongoid.
87
88
  test_files: []
data/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- language: ruby
2
-
3
- cache: bundler
4
-
5
- rvm:
6
- - 2.6.6
7
-
8
- env:
9
- - MONGOID_VERSION=7
10
-
11
- before_script:
12
- - bundle exec danger
13
-
14
- script:
15
- - echo SKIP
16
-