mongoid-compatibility 0.6.0 → 1.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: 67f56f2a4f261301d9ce8856177e0dc45dd0f490fffe58842cc65814cbc039b8
4
- data.tar.gz: 603268d9a0f89b086f0d239d75289edfdb0948a653050e54e8c6811e97992628
3
+ metadata.gz: f5c1b4338102dbc896ae63882a6f630426d2e3d4facef001d6c7b2b36c4d4c96
4
+ data.tar.gz: a7fa288890bd1d597228d6b015ef8293ec9c1c78c2a62bab697b49c4bd300d8c
5
5
  SHA512:
6
- metadata.gz: 91fd9d67679f2c7226dbde61790bb17640c0e8a2292f42251fadc0a507b1e96212c112dd8cbd1c23606a4316dd79d761a3e47205092dc1e3b49281f7244b88fc
7
- data.tar.gz: 9c0ce0c31f6191162ce82cbb7685aa288015f9fb25aa48b0546761f4160d9dcb92563791711ad3559eae126bf0e93a302235b9b1730b4103126bc74d8e9b9056
6
+ metadata.gz: 3eb4ff2240106bd8998ebf7210a48e270a68393015b985005372d4df3c639ec3d29939bfd4d6f1e04b849906a3b3a1bfaecf1cfbe033f1735e2b21fab9c5d523
7
+ data.tar.gz: bf7af92da3ff937c1fea260d16a5b57f417179c053a32c28a693881580ecfd0ada33894f52b2c3635248ac159ccebe64a6eeb35f3c602e18205c125dd49988d4
@@ -0,0 +1,11 @@
1
+ name: Danger Comment
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: [Danger]
6
+ types: [completed]
7
+
8
+ jobs:
9
+ comment:
10
+ uses: numbata/danger-pr-comment/.github/workflows/danger-comment.yml@v0.1.0
11
+ secrets: inherit
@@ -1,19 +1,13 @@
1
- name: PR Linter
2
- on: [pull_request]
1
+ name: Danger
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, reopened, edited, synchronize]
6
+
3
7
  jobs:
4
8
  danger:
5
- runs-on: ubuntu-latest
6
- env:
7
- BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.danger
8
- steps:
9
- - uses: actions/checkout@v2
10
- with:
11
- fetch-depth: 0
12
- - uses: ruby/setup-ruby@v1
13
- with:
14
- ruby-version: 2.6
15
- bundler-cache: true
16
- - run: |
17
- # the personal token is public, this is ok, base64 encode to avoid tripping Github
18
- TOKEN=$(echo -n NWY1ZmM5MzEyMzNlYWY4OTZiOGU3MmI3MWQ3Mzk0MzgxMWE4OGVmYwo= | base64 --decode)
19
- DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
9
+ uses: numbata/danger-pr-comment/.github/workflows/danger-run.yml@v0.1.0
10
+ secrets: inherit
11
+ with:
12
+ ruby-version: '2.7'
13
+ bundler-cache: true
@@ -4,7 +4,7 @@ jobs:
4
4
  lint:
5
5
  runs-on: ubuntu-latest
6
6
  steps:
7
- - uses: actions/checkout@v2
7
+ - uses: actions/checkout@v6
8
8
  - name: Set up Ruby
9
9
  uses: ruby/setup-ruby@v1
10
10
  with:
@@ -4,77 +4,46 @@ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  build:
7
- name: >-
8
- Mongoid ${{ matrix.entry.mongoid }} - Ruby ${{ matrix.entry.ruby }} - MongoDB ${{ matrix.entry.mongodb }}
7
+ name: Ruby ${{ matrix.entry.ruby }} / Mongoid ${{ matrix.entry.mongoid }} / MongoDB ${{ matrix.entry.mongodb }}
8
+ runs-on: ubuntu-latest
9
9
  env:
10
10
  CI: true
11
- TESTOPTS: -v
12
- runs-on: ubuntu-latest
13
- continue-on-error: false
11
+ COVERAGE: ${{ matrix.entry.coverage }}
12
+ BUNDLE_GEMFILE: gemfiles/mongoid_${{ matrix.entry.mongoid }}.gemfile
14
13
  strategy:
14
+ fail-fast: false
15
15
  matrix:
16
16
  entry:
17
- - { ruby: "2.1", mongoid: "3", bundler: "1", mongodb: "3.6" }
18
- - { ruby: "2.1", mongoid: "4", bundler: "1", mongodb: "3.6" }
19
- - { ruby: "2.2", mongoid: "4", bundler: "2", mongodb: "3.6" }
20
- - { ruby: "2.2", mongoid: "5", bundler: "2", mongodb: "3.6" }
21
- - { ruby: "2.3", mongoid: "5", bundler: "2", mongodb: "3.6" }
22
- - { ruby: "2.4", mongoid: "6.1", bundler: "2", mongodb: "3.6" }
23
- - { ruby: "2.5", mongoid: "6.2", bundler: "2", mongodb: "3.6" }
24
- - { ruby: "2.5", mongoid: "6.4", bundler: "2", mongodb: "3.6" }
25
- - { ruby: "2.6", mongoid: "7.4", bundler: "2", mongodb: "3.6" }
26
- - { ruby: "2.6", mongoid: "7.5", bundler: "2", mongodb: "3.6" }
27
- - { ruby: "2.7", mongoid: "7.5", bundler: "2", mongodb: "3.6" }
28
- - { ruby: "3.0", mongoid: "8.0", bundler: "2", mongodb: "3.6" }
29
- - { ruby: "3.1", mongoid: "8.0", bundler: "2", mongodb: "3.6" }
30
- - { ruby: "2.5", mongoid: "6.4", bundler: "2", mongodb: "4.0" }
31
- - { ruby: "2.6", mongoid: "7.4", bundler: "2", mongodb: "4.0" }
32
- - { ruby: "2.6", mongoid: "7.5", bundler: "2", mongodb: "4.0" }
33
- - { ruby: "2.7", mongoid: "7.5", bundler: "2", mongodb: "4.0" }
34
- - { ruby: "3.0", mongoid: "8.0", bundler: "2", mongodb: "4.0" }
35
- - { ruby: "3.1", mongoid: "8.0", bundler: "2", mongodb: "4.0" }
36
- - { ruby: "2.5", mongoid: "6.4", bundler: "2", mongodb: "4.2" }
37
- - { ruby: "2.6", mongoid: "7.4", bundler: "2", mongodb: "4.2" }
38
- - { ruby: "2.6", mongoid: "7.5", bundler: "2", mongodb: "4.2" }
39
- - { ruby: "2.7", mongoid: "7.5", bundler: "2", mongodb: "4.2" }
40
- - { ruby: "3.0", mongoid: "8.0", bundler: "2", mongodb: "4.2" }
41
- - { ruby: "3.1", mongoid: "8.0", bundler: "2", mongodb: "4.2" }
42
- - { ruby: "2.5", mongoid: "6.4", bundler: "2", mongodb: "4.4" }
43
- - { ruby: "2.6", mongoid: "7.4", bundler: "2", mongodb: "4.4" }
44
- - { ruby: "2.6", mongoid: "7.5", bundler: "2", mongodb: "4.4" }
45
- - { ruby: "2.7", mongoid: "7.5", bundler: "2", mongodb: "4.4" }
46
- - { ruby: "3.0", mongoid: "8.0", bundler: "2", mongodb: "4.4" }
47
- - { ruby: "3.1", mongoid: "8.0", bundler: "2", mongodb: "4.4" }
48
- - { ruby: "2.5", mongoid: "6.4", bundler: "2", mongodb: "5.0" }
49
- - { ruby: "2.6", mongoid: "7.4", bundler: "2", mongodb: "5.0" }
50
- - { ruby: "2.6", mongoid: "7.5", bundler: "2", mongodb: "5.0" }
51
- - { ruby: "2.7", mongoid: "7.5", bundler: "2", mongodb: "5.0" }
52
- - { ruby: "3.0", mongoid: "8.0", bundler: "2", mongodb: "5.0" }
53
- - { ruby: "3.1", mongoid: "8.0", bundler: "2", mongodb: "5.0" }
17
+ - { ruby: '2.6', mongoid: '3', mongodb: '3.6' }
18
+ - { ruby: '2.6', mongoid: '4', mongodb: '3.6' }
19
+ - { ruby: '2.6', mongoid: '5', mongodb: '3.6' }
20
+ - { ruby: '2.6', mongoid: '6', mongodb: '4.0' }
21
+ - { ruby: '2.6', mongoid: '7', mongodb: '4.2' }
22
+ - { ruby: '2.7', mongoid: '7', mongodb: '4.4' }
23
+ - { ruby: '3.0', mongoid: '8', mongodb: '5.0' }
24
+ - { ruby: '3.1', mongoid: '8', mongodb: '6.0' }
25
+ - { ruby: '3.1', mongoid: '9', mongodb: '5.0' }
26
+ - { ruby: '3.2', mongoid: '9', mongodb: '7.0' }
27
+ - { ruby: '3.3', mongoid: '9', mongodb: '8.0' }
28
+ - { ruby: '3.4', mongoid: '9', mongodb: '8.0', coverage: true }
29
+ - { ruby: '4.0', mongoid: '9', mongodb: '8.0' }
54
30
  steps:
55
- - name: repo checkout
56
- uses: actions/checkout@v2
57
-
58
- - name: start mongodb
59
- uses: supercharge/mongodb-github-action@1.6.0
31
+ - uses: actions/checkout@v6
32
+ - name: Set up MongoDB
33
+ uses: supercharge/mongodb-github-action@1.12.1
60
34
  with:
61
35
  mongodb-version: ${{ matrix.entry.mongodb }}
62
- mongodb-replica-set: rs0
63
-
64
- - name: load ruby
36
+ - name: Set up Ruby
65
37
  uses: ruby/setup-ruby@v1
66
38
  with:
67
39
  ruby-version: ${{ matrix.entry.ruby }}
68
- bundler: ${{ matrix.entry.bundler }}
69
-
70
- - name: bundle install
71
- run: bundle install --jobs 4 --retry 3
72
- env:
73
- MONGOID_VERSION: ${{ matrix.entry.mongoid }}
74
-
75
- - name: test
76
- timeout-minutes: 10
77
- run: bundle exec rspec spec
78
- continue-on-error: false
79
- env:
80
- MONGOID_VERSION: ${{ matrix.entry.mongoid }}
40
+ bundler-cache: true
41
+ - name: Run tests
42
+ run: bundle exec rake spec
43
+ - name: Coveralls
44
+ if: matrix.entry.coverage
45
+ uses: coverallsapp/github-action@v2
46
+ with:
47
+ github-token: ${{ secrets.GITHUB_TOKEN }}
48
+ file: coverage/.resultset.json
49
+ format: simplecov
data/.gitignore CHANGED
@@ -1,2 +1,4 @@
1
1
  Gemfile.lock
2
2
  pkg
3
+ gemfiles/*.gemfile.lock
4
+ coverage/
data/.rubocop.yml CHANGED
@@ -1,5 +1,10 @@
1
1
  AllCops:
2
+ NewCops: enable
2
3
  Exclude:
3
4
  - vendor/**/*
4
5
 
5
6
  inherit_from: .rubocop_todo.yml
7
+
8
+ require:
9
+ - rubocop-rake
10
+ - rubocop-rspec
data/.rubocop_todo.yml CHANGED
@@ -1,30 +1,63 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-09-13 14:18:39 -0400 using RuboCop version 0.33.0.
3
+ # on 2026-01-02 19:41:49 UTC using RuboCop version 1.36.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 20
10
- # Configuration parameters: AllowURI, URISchemes.
11
- Metrics/LineLength:
12
- Max: 118
9
+ # Offense count: 1
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'mongoid-compatibility.gemspec'
13
15
 
14
- # Offense count: 4
15
- Style/Documentation:
16
+ # Offense count: 1
17
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
18
+ # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
19
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
20
+ Naming/FileName:
16
21
  Exclude:
17
- - 'lib/mongoid/compatibility/object_id.rb'
18
- - 'lib/mongoid/compatibility/self.rb'
19
- - 'lib/mongoid/compatibility/version.rb'
22
+ - 'lib/mongoid-compatibility.rb'
20
23
 
21
24
  # Offense count: 1
22
- Style/DoubleNegation:
25
+ # Configuration parameters: Prefixes, AllowedPatterns.
26
+ # Prefixes: when, with, without
27
+ RSpec/ContextWording:
23
28
  Exclude:
24
- - 'lib/mongoid/compatibility/version.rb'
29
+ - 'spec/mongoid/compatibility/version_spec.rb'
30
+
31
+ # Offense count: 18
32
+ # This cop supports unsafe autocorrection (--autocorrect-all).
33
+ # Configuration parameters: SkipBlocks, EnforcedStyle.
34
+ # SupportedStyles: described_class, explicit
35
+ RSpec/DescribedClass:
36
+ Exclude:
37
+ - 'spec/mongoid/compatibility/object_id_spec.rb'
38
+ - 'spec/mongoid/compatibility/version_spec.rb'
25
39
 
26
40
  # Offense count: 1
27
- # Configuration parameters: Exclude.
28
- Style/FileName:
41
+ # Configuration parameters: CountAsOne.
42
+ RSpec/ExampleLength:
43
+ Max: 13
44
+
45
+ # Offense count: 1
46
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
47
+ # Include: **/*_spec*rb*, **/spec/**/*
48
+ RSpec/FilePath:
29
49
  Exclude:
30
- - 'lib/mongoid-compatibility.rb'
50
+ - 'spec/mongoid/compatibility/self_spec.rb'
51
+
52
+ # Offense count: 1
53
+ RSpec/MultipleExpectations:
54
+ Max: 5
55
+
56
+ # Offense count: 3
57
+ # Configuration parameters: AllowedConstants.
58
+ Style/Documentation:
59
+ Exclude:
60
+ - 'spec/**/*'
61
+ - 'test/**/*'
62
+ - 'lib/mongoid/compatibility/object_id.rb'
63
+ - 'lib/mongoid/compatibility/version.rb'
data/Appraisals ADDED
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise 'mongoid-9' do
4
+ gem 'mongoid', '~> 9.0.0'
5
+ end
6
+
7
+ appraise 'mongoid-8' do
8
+ gem 'mongoid', '~> 8.0.0'
9
+ end
10
+
11
+ appraise 'mongoid-7' do
12
+ gem 'mongoid', '~> 7.0.0'
13
+ end
14
+
15
+ appraise 'mongoid-6' do
16
+ gem 'mongoid', '~> 6.0.2'
17
+ end
18
+
19
+ appraise 'mongoid-5' do
20
+ gem 'mongoid', '~> 5.0.0'
21
+ end
22
+
23
+ appraise 'mongoid-4' do
24
+ gem 'mongoid', '~> 4.0.0'
25
+ end
26
+
27
+ appraise 'mongoid-3' do
28
+ gem 'mongoid', '~> 3.0.0'
29
+ end
30
+
31
+ appraise 'mongoid-2' do
32
+ gem 'mongoid', '~> 2.0.0'
33
+ gem 'bson_ext', platforms: :ruby
34
+ end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### 1.1.0 (2026/10/18)
2
+ * [#24](https://github.com/mongoid/mongoid-compatibility/pull/24): Cover supported require aliases and the public gem version - [@dblock](https://github.com/dblock).
3
+ * [#23](https://github.com/mongoid/mongoid-compatibility/pull/23): Replace Code Climate with SimpleCov and Coveralls reporting in CI and update status badges - [@dblock](https://github.com/dblock).
4
+ * [#22](https://github.com/mongoid/mongoid-compatibility/pull/22): Modernize CI with representative MongoDB 3.6–8.0, Mongoid 3–9, and Ruby 2.6–4.0 coverage - [@dblock](https://github.com/dblock).
5
+ * [#21](https://github.com/mongoid/mongoid-compatibility/pull/21): Migrate Danger to use danger-pr-comment workflow - [@dblock](https://github.com/dblock).
6
+ * [#20](https://github.com/mongoid/mongoid-compatibility/pull/20): Add gem caching to CI - [@saisrinivasan](https://github.com/SairamSrinivasan).
7
+
8
+ ### 1.0.0 (2024/06/19)
9
+
10
+ * [#18](https://github.com/mongoid/mongoid-compatibility/pull/18): Test MongoDB 6 and 7 - [@saisrinivasan](https://github.com/SairamSrinivasan).
11
+ * [#16](https://github.com/mongoid/mongoid-compatibility/pull/16): Add support for Mongoid 9 - [@saisrinivasan](https://github.com/SairamSrinivasan).
12
+
1
13
  ### 0.6.0 (2022/08/18)
2
14
 
3
15
  * [#13](https://github.com/mongoid/mongoid-compatibility/pull/13): Compatibility with Mongoid 8.x - [@joe1chen](https://github.com/joe1chen).
data/Dangerfile CHANGED
@@ -1 +1,5 @@
1
- danger.import_dangerfile(gem: 'mongoid-danger')
1
+ # frozen_string_literal: true
2
+
3
+ danger.import_dangerfile(gem: 'danger-pr-comment')
4
+
5
+ changelog.check!
data/Gemfile CHANGED
@@ -1,34 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'http://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
- case version = ENV['MONGOID_VERSION'] || '8.0.2'
6
- when 'HEAD'
7
- gem 'mongoid', github: 'mongodb/mongoid'
8
- when /^8/
9
- gem 'mongoid', '~> 8.0'
10
- when /^7/
11
- gem 'mongoid', '~> 7.0'
12
- when /^6/
13
- gem 'mongoid', '~> 6.0'
14
- when /^5/
15
- gem 'mongoid', '~> 5.0'
16
- when /^4/
17
- gem 'mongoid', '~> 4.0'
18
- when /^3/
19
- gem 'mongoid', '~> 3.1'
20
- when /^2/
21
- gem 'mongoid', '~> 2.0'
22
- gem 'bson_ext', platforms: :ruby
23
- else
24
- gem 'mongoid', version
25
- end
26
-
27
7
  group :test do
28
- gem 'rspec'
29
- end
30
-
31
- group :development do
32
- gem 'rake', '< 12'
33
- gem 'rubocop', '0.33.0'
8
+ gem 'danger', require: false
9
+ gem 'danger-changelog', require: false
10
+ gem 'danger-pr-comment', require: false
34
11
  end
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2015-2017 Daniel Doubrovkine, Artsy and Contributors
3
+ Copyright (c) 2015-2022 Daniel Doubrovkine, Artsy and Contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -2,10 +2,14 @@ Mongoid::Compatibility
2
2
  =======================
3
3
 
4
4
  [![Gem Version](http://img.shields.io/gem/v/mongoid-compatibility.svg)](http://badge.fury.io/rb/mongoid-compatibility)
5
- [![Build Status](https://github.com/mongoid/mongoid-compatibility/actions/workflows/test.yml/badge.svg)](https://github.com/mongoid/mongoid-compatibility/actions)
6
- [![Code Climate](https://codeclimate.com/github/mongoid/mongoid-compatibility.svg)](https://codeclimate.com/github/mongoid/mongoid-compatibility)
5
+ [![Build Status](https://github.com/mongoid/mongoid-compatibility/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/mongoid/mongoid-compatibility/actions/workflows/test.yml?query=branch%3Amaster)
6
+ [![Coverage Status](https://coveralls.io/repos/github/mongoid/mongoid-compatibility/badge.svg?branch=master)](https://coveralls.io/github/mongoid/mongoid-compatibility?branch=master)
7
7
 
8
- Compatibility helpers for Mongoid versions 2, 3, 4, 5, 6, 7, and 8.
8
+ CI collects SimpleCov coverage on Ruby 3.4 with Mongoid 9 and MongoDB 8.0 and submits one report to Coveralls using GitHub's workflow token. To generate a local report, run `COVERAGE=true BUNDLE_GEMFILE=gemfiles/mongoid_9.gemfile bundle install` followed by `COVERAGE=true BUNDLE_GEMFILE=gemfiles/mongoid_9.gemfile bundle exec rake spec`. Reports are written to `coverage/`.
9
+
10
+ [Tested](https://github.com/mongoid/mongoid-compatibility/actions) against:
11
+ - MRI: `2.6.x`, `2.7.x`, `3.0.x`, `3.1.x`
12
+ - Compatibility helpers for Mongoid versions 2, 3, 4, 5, 6, 7, 8, and 9.
9
13
 
10
14
  ### Install
11
15
 
@@ -44,7 +48,7 @@ Mongoid::Compatibility::Version.mongoid8?
44
48
  # => is this Mongoid 8.x?
45
49
  ```
46
50
 
47
- Instead of checking for Mongoid 6 and 7 and 8, use `newer` and `older` helpers.
51
+ Instead of checking specifically for a specific version, use `newer` and `older` helpers. For example:
48
52
 
49
53
  ``` ruby
50
54
  Mongoid::Compatibility::Version.mongoid6_or_newer?
@@ -67,6 +71,6 @@ See [CONTRIBUTING](CONTRIBUTING.md).
67
71
 
68
72
  ### Copyright and License
69
73
 
70
- Copyright Daniel Doubrovkine and Contributors, Artsy Inc., 2015-2017
74
+ Copyright Daniel Doubrovkine and Contributors, Artsy Inc., 2015-2022
71
75
 
72
76
  [MIT License](LICENSE.md)
data/RELEASING.md CHANGED
@@ -10,7 +10,7 @@ Generally, `mongoid-compatibility` should be released with enthusiasm but care.
10
10
  rake
11
11
  ```
12
12
 
13
- 2. Run the test suite on [Travis](https://travis-ci.org) to be certain that your changes work in a variety of environments. Only merge and release when all tests are passing.
13
+ 2. Wait for the release preparation commit's [GitHub Actions](https://github.com/mongoid/mongoid-compatibility/actions) checks to pass before publishing.
14
14
 
15
15
  3. Bump the version in [`lib/mongoid/compatibility/self.rb`](lib/mongoid/compatibility/self.rb).
16
16
 
@@ -41,3 +41,22 @@ Generally, `mongoid-compatibility` should be released with enthusiasm but care.
41
41
  #=> Pushed git commits and tags.
42
42
  #=> Pushed mongoid-compatibility 0.4.0 to rubygems.org.
43
43
  ```
44
+ ## Prepare for the Next Version
45
+
46
+ Add the next release to [CHANGELOG.md](CHANGELOG.md).
47
+
48
+ ```
49
+ ### 1.1.1 (Next)
50
+
51
+ * Your contribution here.
52
+ ```
53
+
54
+ Increment the development patch version in [lib/mongoid/compatibility/self.rb](lib/mongoid/compatibility/self.rb).
55
+
56
+ Commit your changes.
57
+
58
+ ```
59
+ git add CHANGELOG.md lib/mongoid/compatibility/self.rb
60
+ git commit -m "Setting up next release, 1.1.1."
61
+ git push origin master
62
+ ```
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'bundler/gem_tasks'
3
5
 
@@ -13,4 +15,4 @@ end
13
15
  require 'rubocop/rake_task'
14
16
  RuboCop::RakeTask.new(:rubocop)
15
17
 
16
- task default: [:rubocop, :spec]
18
+ task default: %i[rubocop spec]
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'http://rubygems.org'
6
+
7
+ gem 'bson_ext', platforms: :ruby
8
+ gem 'mongoid', '~> 2.0.0'
9
+
10
+ gemspec path: '../'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'http://rubygems.org'
6
+
7
+ gem 'mongoid', '~> 3.0.0'
8
+
9
+ gemspec path: '../'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'http://rubygems.org'
6
+
7
+ gem 'mongoid', '~> 4.0.0'
8
+
9
+ gemspec path: '../'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'http://rubygems.org'
6
+
7
+ gem 'mongoid', '~> 5.0.0'
8
+
9
+ gemspec path: '../'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'http://rubygems.org'
6
+
7
+ gem 'mongoid', '~> 6.0.2'
8
+
9
+ gemspec path: '../'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'http://rubygems.org'
6
+
7
+ gem 'mongoid', '~> 7.0.0'
8
+
9
+ gemspec path: '../'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'http://rubygems.org'
6
+
7
+ gem 'mongoid', '~> 8.0.0'
8
+
9
+ gemspec path: '../'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'http://rubygems.org'
6
+
7
+ gem 'mongoid', '~> 9.0.0'
8
+
9
+ gemspec path: '../'
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'http://rubygems.org'
6
+
7
+ gem 'mongoid', github: 'mongodb/mongoid'
8
+
9
+ group :development do
10
+ gem 'appraisal', '~> 2.0'
11
+ gem 'rake', '< 12'
12
+ gem 'rubocop', '0.33.0'
13
+ end
14
+
15
+ group :test do
16
+ gem 'rspec'
17
+ end
18
+
19
+ gemspec path: '../'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Mongoid
2
4
  module Compatibility
3
5
  module ObjectId
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Mongoid
2
4
  module Compatibility
3
- VERSION = '0.6.0'.freeze
5
+ VERSION = '1.1.0'
4
6
  end
5
7
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Mongoid
2
4
  module Compatibility
3
5
  module Version
4
6
  module ClassMethods
5
- (2..8).each do |v|
7
+ (2..9).each do |v|
6
8
  const_set "V#{v}", Mongoid::VERSION =~ Regexp.new("^#{v}\.")
7
9
 
8
10
  define_method "mongoid#{v}?" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mongoid'
2
4
  require 'mongoid/compatibility/self'
3
5
  require 'mongoid/compatibility/version'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mongoid/compatibility'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mongoid-compatibility'
@@ -1,4 +1,6 @@
1
- $LOAD_PATH.push File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
2
4
  require 'mongoid/compatibility/self'
3
5
 
4
6
  Gem::Specification.new do |s|
@@ -13,6 +15,16 @@ Gem::Specification.new do |s|
13
15
  s.homepage = 'http://github.com/mongoid/mongoid-compatibility'
14
16
  s.licenses = ['MIT']
15
17
  s.summary = 'Compatibility helpers for Mongoid.'
16
- s.add_dependency 'mongoid', '>= 2.0'
17
18
  s.add_dependency 'activesupport'
19
+ s.add_dependency 'mongoid', '>= 2.0'
20
+
21
+ s.add_development_dependency 'appraisal', '~> 2.0'
22
+ s.add_development_dependency 'ostruct'
23
+ s.add_development_dependency 'rake'
24
+ s.add_development_dependency 'rspec'
25
+ s.add_development_dependency 'rubocop', '~> 1.36.0'
26
+ s.add_development_dependency 'rubocop-rake'
27
+ s.add_development_dependency 'rubocop-rspec'
28
+ s.add_development_dependency 'simplecov', '~> 0.22' if ENV['COVERAGE'] == 'true'
29
+ s.metadata['rubygems_mfa_required'] = 'true'
18
30
  end
@@ -0,0 +1,8 @@
1
+ test:
2
+ clients:
3
+ default:
4
+ database: mongoid-compatibility
5
+ hosts:
6
+ - localhost:27017
7
+ options:
8
+ raise_not_found_error: false
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Mongoid::Compatibility::ObjectId do
4
6
  it 'valid' do
5
7
  expect(Mongoid::Compatibility::ObjectId.legal?('4e4d66343b39b68407000001')).to be true
6
8
  end
9
+
7
10
  it 'invalid' do
8
11
  expect(Mongoid::Compatibility::ObjectId.legal?('asadsf')).to be false
9
12
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Mongoid::Compatibility do
@@ -1,17 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Mongoid::Compatibility::Version do
4
6
  context 'mongoid? methods' do
5
7
  it 'only true for one version' do
6
- expect((2..8).one? do |v|
8
+ expect((2..9).one? do |v|
7
9
  Mongoid::Compatibility::Version.send("mongoid#{v}?")
8
10
  end).to be true
9
11
  end
12
+
10
13
  context "current version #{Mongoid::VERSION}" do
11
14
  let(:version) { Mongoid::VERSION.split('.').first.to_i }
15
+
12
16
  it 'mongoidX?' do
13
17
  expect(Mongoid::Compatibility::Version.send("mongoid#{version}?")).to be true
14
18
  end
19
+
15
20
  it 'mongoidX?_or_newer?' do
16
21
  expect(Mongoid::Compatibility::Version.send("mongoid#{version}_or_newer?")).to be true
17
22
  if Mongoid::Compatibility::Version.respond_to?("mongoid#{version - 1}_or_newer?")
@@ -27,25 +32,31 @@ describe Mongoid::Compatibility::Version do
27
32
  expect(Mongoid::Compatibility::Version.send("mongoid#{version + 1}_or_newer?")).to be false
28
33
  end
29
34
  end
35
+
30
36
  it 'mongoidX?_or_older?' do
31
37
  expect(Mongoid::Compatibility::Version.send("mongoid#{version}_or_older?")).to be true
32
38
  end
33
39
  end
34
- (2..8).each do |v|
40
+
41
+ (2..9).each do |v|
35
42
  context "mongoid #{v}" do
36
43
  before do
37
- stub_const('::Mongoid::VERSION', "#{v}")
44
+ stub_const('::Mongoid::VERSION', v.to_s)
38
45
  stub_const("::Mongoid::Compatibility::Version::ClassMethods::V#{v}", 1)
39
46
  end
47
+
40
48
  it "responds to mongoid#{v}?" do
41
49
  expect(Mongoid::Compatibility::Version).to respond_to("mongoid#{v}?")
42
50
  end
51
+
43
52
  it "mongoid#{v}?" do
44
53
  expect(Mongoid::Compatibility::Version.send("mongoid#{v}?")).to be true
45
54
  end
55
+
46
56
  it "mongoid#{v}_or_newer?" do
47
57
  expect(Mongoid::Compatibility::Version.send("mongoid#{v}_or_newer?")).to be true
48
58
  end
59
+
49
60
  it "mongoid#{v}_or_older?" do
50
61
  expect(Mongoid::Compatibility::Version.send("mongoid#{v}_or_older?")).to be true
51
62
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Mongoid::Compatibility do
6
+ it 'loads the hyphenated and underscored compatibility entry points' do
7
+ require 'mongoid-compatibility'
8
+ require 'mongoid_compatibility'
9
+
10
+ expect(Mongoid::Compatibility::Version).to respond_to(:mongoid9?)
11
+ expect(Mongoid::Compatibility::ObjectId).to respond_to(:legal?)
12
+ end
13
+
14
+ it 'defines a semantic gem version' do
15
+ expect(Mongoid::Compatibility::VERSION).to match(/\A\d+\.\d+\.\d+\z/)
16
+ end
17
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ if ENV['COVERAGE'] == 'true'
4
+ require 'simplecov'
5
+ SimpleCov.start do
6
+ add_filter '/spec/'
7
+ track_files 'lib/**/*.rb'
8
+ end
9
+ end
10
+
11
+ ENV['MONGOID_ENV'] = 'test'
12
+
1
13
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
14
 
15
+ require 'logger'
3
16
  require 'rubygems'
4
17
  require 'rspec'
5
18
 
@@ -1,4 +1,4 @@
1
- ENV['MONGOID_ENV'] = 'test'
1
+ # frozen_string_literal: true
2
2
 
3
3
  if Mongoid::Compatibility::Version.mongoid2?
4
4
  Mongoid.load! 'spec/config/mongoid2.yml'
@@ -14,8 +14,10 @@ elsif Mongoid::Compatibility::Version.mongoid7?
14
14
  Mongoid.load! 'spec/config/mongoid7.yml'
15
15
  elsif Mongoid::Compatibility::Version.mongoid8?
16
16
  Mongoid.load! 'spec/config/mongoid8.yml'
17
+ elsif Mongoid::Compatibility::Version.mongoid9?
18
+ Mongoid.load! 'spec/config/mongoid9.yml'
17
19
  else
18
- fail "unsupported Mongoid version #{Mongoid::VERSION}"
20
+ raise "unsupported Mongoid version #{Mongoid::VERSION}"
19
21
  end
20
22
 
21
23
  RSpec.configure do |config|
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-compatibility
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-18 00:00:00.000000000 Z
11
+ date: 2026-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: mongoid
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -25,13 +39,97 @@ dependencies:
25
39
  - !ruby/object:Gem::Version
26
40
  version: '2.0'
27
41
  - !ruby/object:Gem::Dependency
28
- name: activesupport
42
+ name: appraisal
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ostruct
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
59
  - - ">="
32
60
  - !ruby/object:Gem::Version
33
61
  version: '0'
34
- type: :runtime
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.36.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.36.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
35
133
  prerelease: false
36
134
  version_requirements: !ruby/object:Gem::Requirement
37
135
  requirements:
@@ -44,6 +142,7 @@ executables: []
44
142
  extensions: []
45
143
  extra_rdoc_files: []
46
144
  files:
145
+ - ".github/workflows/danger-comment.yml"
47
146
  - ".github/workflows/danger.yml"
48
147
  - ".github/workflows/rubocop.yml"
49
148
  - ".github/workflows/test.yml"
@@ -51,7 +150,7 @@ files:
51
150
  - ".rspec"
52
151
  - ".rubocop.yml"
53
152
  - ".rubocop_todo.yml"
54
- - ".travis.yml"
153
+ - Appraisals
55
154
  - CHANGELOG.md
56
155
  - CONTRIBUTING.md
57
156
  - Dangerfile
@@ -61,6 +160,15 @@ files:
61
160
  - README.md
62
161
  - RELEASING.md
63
162
  - Rakefile
163
+ - gemfiles/mongoid_2.gemfile
164
+ - gemfiles/mongoid_3.gemfile
165
+ - gemfiles/mongoid_4.gemfile
166
+ - gemfiles/mongoid_5.gemfile
167
+ - gemfiles/mongoid_6.gemfile
168
+ - gemfiles/mongoid_7.gemfile
169
+ - gemfiles/mongoid_8.gemfile
170
+ - gemfiles/mongoid_9.gemfile
171
+ - gemfiles/mongoid_head.gemfile
64
172
  - lib/mongoid-compatibility.rb
65
173
  - lib/mongoid/compatibility.rb
66
174
  - lib/mongoid/compatibility/object_id.rb
@@ -75,15 +183,18 @@ files:
75
183
  - spec/config/mongoid6.yml
76
184
  - spec/config/mongoid7.yml
77
185
  - spec/config/mongoid8.yml
186
+ - spec/config/mongoid9.yml
78
187
  - spec/mongoid/compatibility/object_id_spec.rb
79
188
  - spec/mongoid/compatibility/self_spec.rb
80
189
  - spec/mongoid/compatibility/version_spec.rb
190
+ - spec/mongoid/compatibility_entry_points_spec.rb
81
191
  - spec/spec_helper.rb
82
192
  - spec/support/mongoid.rb
83
193
  homepage: http://github.com/mongoid/mongoid-compatibility
84
194
  licenses:
85
195
  - MIT
86
- metadata: {}
196
+ metadata:
197
+ rubygems_mfa_required: 'true'
87
198
  post_install_message:
88
199
  rdoc_options: []
89
200
  require_paths:
@@ -99,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
210
  - !ruby/object:Gem::Version
100
211
  version: 1.3.6
101
212
  requirements: []
102
- rubygems_version: 3.1.3
213
+ rubygems_version: 3.5.16
103
214
  signing_key:
104
215
  specification_version: 4
105
216
  summary: Compatibility helpers for Mongoid.
data/.travis.yml DELETED
@@ -1,33 +0,0 @@
1
- services:
2
- - mongodb
3
-
4
- matrix:
5
- include:
6
- - rvm: 2.3.1
7
- script:
8
- - bundle exec danger
9
- - rvm: 2.4.0
10
- env:
11
- - MONGOID_VERSION=7
12
- - rvm: 2.4.0
13
- env:
14
- - MONGOID_VERSION=6
15
- - rvm: 2.3.1
16
- env:
17
- - MONGOID_VERSION=6
18
- - rvm: 2.3.1
19
- env:
20
- - MONGOID_VERSION=5
21
- - rvm: 2.3.1
22
- env:
23
- - MONGOID_VERSION=4
24
- - rvm: 2.3.1
25
- env:
26
- - MONGOID_VERSION=3
27
- - rvm: 2.3.1
28
- env:
29
- - MONGOID_VERSION=2
30
- - rvm: 2.3.1
31
- env:
32
- - MONGOID_VERSION=HEAD
33
- - rvm: 2.3.0