mongoid-compatibility 1.1.0 → 1.1.1

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: f5c1b4338102dbc896ae63882a6f630426d2e3d4facef001d6c7b2b36c4d4c96
4
- data.tar.gz: a7fa288890bd1d597228d6b015ef8293ec9c1c78c2a62bab697b49c4bd300d8c
3
+ metadata.gz: eab8a8ddca94d1ae3eae603443e320a3ca2d6459d499ee209ae67149618c4d80
4
+ data.tar.gz: f6e6a03abff49a9337af0072d94b706457030e739f2112bf958fbe90a0fe2180
5
5
  SHA512:
6
- metadata.gz: 3eb4ff2240106bd8998ebf7210a48e270a68393015b985005372d4df3c639ec3d29939bfd4d6f1e04b849906a3b3a1bfaecf1cfbe033f1735e2b21fab9c5d523
7
- data.tar.gz: bf7af92da3ff937c1fea260d16a5b57f417179c053a32c28a693881580ecfd0ada33894f52b2c3635248ac159ccebe64a6eeb35f3c602e18205c125dd49988d4
6
+ metadata.gz: ba07c5c3bde712171e3a539cabf83768700d39efe9434ba025e2c0ff20b171e3416d4517a5349070b5dea9169d0e8da55260c6c929dbddb7ed7eecb5f0a16e3c
7
+ data.tar.gz: af24a10fe3999bf42f342a8230191ea7541bd3aeb6ca0b7a413197f77449200d069aafa04c448819924b3e9c43e428fe3022bf1a94b21b135293933a82c72cdb
@@ -5,7 +5,15 @@ on:
5
5
  workflows: [Danger]
6
6
  types: [completed]
7
7
 
8
+ permissions:
9
+ actions: read
10
+ issues: write
11
+ pull-requests: write
12
+
8
13
  jobs:
9
14
  comment:
10
- uses: numbata/danger-pr-comment/.github/workflows/danger-comment.yml@v0.1.0
11
- secrets: inherit
15
+ name: Post Review Comment
16
+ uses: danger/danger-pr-comment/.github/workflows/danger-comment.yml@645e89bcc7be89ee7e8362166110b05cbced8e59 # v0.3.0
17
+ with:
18
+ base-branch: '*'
19
+ comment-empty: false
@@ -4,10 +4,17 @@ on:
4
4
  pull_request:
5
5
  types: [opened, reopened, edited, synchronize]
6
6
 
7
+ permissions:
8
+ contents: read
9
+
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
7
14
  jobs:
8
15
  danger:
9
- uses: numbata/danger-pr-comment/.github/workflows/danger-run.yml@v0.1.0
10
- secrets: inherit
16
+ name: Review Pull Request
17
+ uses: danger/danger-pr-comment/.github/workflows/danger-run.yml@645e89bcc7be89ee7e8362166110b05cbced8e59 # v0.3.0
11
18
  with:
12
19
  ruby-version: '2.7'
13
- bundler-cache: true
20
+ bundler-cache: true
@@ -0,0 +1,29 @@
1
+ name: Lint
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ lint:
17
+ name: Lint Code and Documentation
18
+ runs-on: ubuntu-latest
19
+ timeout-minutes: 10
20
+ steps:
21
+ - name: Check Out Code
22
+ uses: actions/checkout@v7
23
+ - name: Set Up Ruby
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: '4.0'
27
+ bundler-cache: true
28
+ - name: Run Lint
29
+ run: bundle exec rake lint
@@ -0,0 +1,30 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: Optional release version overriding the checked-in version.
8
+ type: string
9
+ required: false
10
+ dry-run:
11
+ description: Check release prerequisites, such as RubyGems Trusted Publishing, without releasing.
12
+ type: boolean
13
+ default: false
14
+
15
+ permissions:
16
+ contents: write
17
+ id-token: write
18
+
19
+ jobs:
20
+ release:
21
+ if: github.repository == 'mongoid/mongoid-compatibility' && github.ref == 'refs/heads/master'
22
+ uses: dblock/ruby-gem-release/.github/workflows/release.yml@v0.9.0
23
+ with:
24
+ ruby-version: '3.3'
25
+ version: ${{ inputs.version }}
26
+ dry-run: ${{ inputs.dry-run }}
27
+ test: |
28
+ docker run --detach --name mongodb --publish 27017:27017 mongo:8.0
29
+ until docker exec mongodb mongosh --quiet --eval 'db.adminCommand({ping: 1})'; do sleep 1; done
30
+ bundle exec rake
@@ -1,12 +1,20 @@
1
1
  name: CI RSpec Test
2
2
 
3
- on: [push, pull_request]
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ concurrency:
8
+ group: ${{ github.workflow }}-${{ github.ref }}
9
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
4
10
 
5
11
  jobs:
6
12
  build:
7
13
  name: Ruby ${{ matrix.entry.ruby }} / Mongoid ${{ matrix.entry.mongoid }} / MongoDB ${{ matrix.entry.mongodb }}
8
14
  runs-on: ubuntu-latest
15
+ timeout-minutes: 20
9
16
  env:
17
+ BUNDLE_BUILD__BSON: --with-cflags=-Wno-error=implicit-function-declaration
10
18
  CI: true
11
19
  COVERAGE: ${{ matrix.entry.coverage }}
12
20
  BUNDLE_GEMFILE: gemfiles/mongoid_${{ matrix.entry.mongoid }}.gemfile
data/.gitignore CHANGED
@@ -1,4 +1,6 @@
1
1
  Gemfile.lock
2
2
  pkg
3
3
  gemfiles/*.gemfile.lock
4
- coverage/
4
+ coverage/
5
+ /vendor/bundle
6
+ /.bundle
data/.rubocop.yml CHANGED
@@ -1,10 +1,83 @@
1
+ plugins:
2
+ - rubocop-md
3
+ - rubocop-prose
4
+ - rubocop-rake
5
+ - rubocop-rspec
6
+ - rubocop-spellcheck
7
+ - rubocop-yaml
8
+
9
+ inherit_from: ".rubocop_todo.yml"
10
+
1
11
  AllCops:
2
12
  NewCops: enable
3
13
  Exclude:
4
- - vendor/**/*
14
+ - vendor/**/*
15
+ - coverage/**/*
16
+ - pkg/**/*
17
+ SuggestExtensions: false
18
+ inherit_mode:
19
+ merge:
20
+ - Include
21
+ Include:
22
+ - ".github/**/*.yml"
23
+ - ".rubocop.yml"
24
+
25
+ YAML/Lint/InvalidSyntax:
26
+ Include:
27
+ - "**/*.yml"
28
+ - "**/*.yaml"
29
+
30
+ YAML/Lint/DuplicateKey:
31
+ Include:
32
+ - "**/*.yml"
33
+ - "**/*.yaml"
34
+
35
+ Naming/FileName:
36
+ inherit_mode:
37
+ merge:
38
+ - Exclude
39
+ Exclude:
40
+ - "**/*.md"
41
+ - ".github/workflows/*.yml"
42
+ - lib/mongoid-compatibility.rb
5
43
 
6
- inherit_from: .rubocop_todo.yml
44
+ Markdown/HeadingCapitalization:
45
+ Enabled: true
46
+ Style: title_case
47
+
48
+ Prose/MaxLength:
49
+ Max: false
50
+ Exclude:
51
+ - LICENSE.md
7
52
 
8
- require:
9
- - rubocop-rake
10
- - rubocop-rspec
53
+ Spellcheck:
54
+ DictionaryFiles:
55
+ en:
56
+ - gem:rubocop-spellcheck/data/en/en.dic
57
+ - ".spellcheck.txt"
58
+ Spellcheck/Spelling:
59
+ Exclude:
60
+ - LICENSE.md
61
+
62
+ # One release example verifies the tag, the next development commit, and their files together.
63
+ RSpec/MultipleExpectations:
64
+ inherit_mode:
65
+ merge:
66
+ - Exclude
67
+ Exclude:
68
+ - spec/release/release_spec.rb
69
+
70
+ RSpec/ExampleLength:
71
+ inherit_mode:
72
+ merge:
73
+ - Exclude
74
+ Exclude:
75
+ - spec/release/release_spec.rb
76
+
77
+ Layout/LineLength:
78
+ inherit_mode:
79
+ merge:
80
+ - Exclude
81
+ Exclude:
82
+ # Reusable workflows are pinned by full commit SHA with a version comment, which cannot be wrapped.
83
+ - '.github/workflows/*.yml'
data/.rubocop_todo.yml CHANGED
@@ -1,63 +1,59 @@
1
1
  # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2026-01-02 19:41:49 UTC using RuboCop version 1.36.0.
2
+ # `rubocop --auto-gen-config --no-exclude-limit --no-offense-counts --no-auto-gen-timestamp`
3
+ # using RuboCop version 1.92.3.
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: 1
10
- # Configuration parameters: Include.
11
- # Include: **/*.gemspec
12
- Gemspec/RequiredRubyVersion:
9
+ # Configuration parameters: EnforcedStyle, AllowedGems.
10
+ # SupportedStyles: Gemfile, gems.rb, gemspec
11
+ Gemspec/DevelopmentDependencies:
13
12
  Exclude:
14
13
  - 'mongoid-compatibility.gemspec'
15
14
 
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:
15
+ Gemspec/RequiredRubyVersion:
21
16
  Exclude:
22
- - 'lib/mongoid-compatibility.rb'
17
+ - 'mongoid-compatibility.gemspec'
23
18
 
24
- # Offense count: 1
25
19
  # Configuration parameters: Prefixes, AllowedPatterns.
26
20
  # Prefixes: when, with, without
27
21
  RSpec/ContextWording:
28
22
  Exclude:
29
23
  - 'spec/mongoid/compatibility/version_spec.rb'
30
24
 
31
- # Offense count: 18
32
25
  # This cop supports unsafe autocorrection (--autocorrect-all).
33
- # Configuration parameters: SkipBlocks, EnforcedStyle.
26
+ # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
34
27
  # SupportedStyles: described_class, explicit
35
28
  RSpec/DescribedClass:
36
29
  Exclude:
37
30
  - 'spec/mongoid/compatibility/object_id_spec.rb'
38
31
  - 'spec/mongoid/compatibility/version_spec.rb'
39
32
 
40
- # Offense count: 1
41
- # Configuration parameters: CountAsOne.
33
+ # Configuration parameters: Max, CountAsOne.
42
34
  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:
49
35
  Exclude:
50
- - 'spec/mongoid/compatibility/self_spec.rb'
36
+ - 'spec/mongoid/compatibility/version_spec.rb'
51
37
 
52
- # Offense count: 1
38
+ # Configuration parameters: Max.
53
39
  RSpec/MultipleExpectations:
54
- Max: 5
40
+ Exclude:
41
+ - 'spec/mongoid/compatibility/version_spec.rb'
42
+ - 'spec/mongoid/compatibility_entry_points_spec.rb'
43
+
44
+ # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
45
+ # SupportedInflectors: default, active_support
46
+ RSpec/SpecFilePathFormat:
47
+ Exclude:
48
+ - 'spec/mongoid/compatibility/self_spec.rb'
55
49
 
56
- # Offense count: 3
57
50
  # Configuration parameters: AllowedConstants.
58
51
  Style/Documentation:
59
52
  Exclude:
60
- - 'spec/**/*'
61
- - 'test/**/*'
62
53
  - 'lib/mongoid/compatibility/object_id.rb'
63
54
  - 'lib/mongoid/compatibility/version.rb'
55
+
56
+ # This cop supports safe autocorrection (--autocorrect).
57
+ Style/RedundantStringEscape:
58
+ Exclude:
59
+ - 'lib/mongoid/compatibility/version.rb'
data/.spellcheck.txt ADDED
@@ -0,0 +1,39 @@
1
+ activesupport
2
+ asadsf
3
+ Bundler
4
+ CHANGELOG
5
+ Changelog
6
+ ClassMethods
7
+ config
8
+ dblock
9
+ Doubrovkine
10
+ Gemfile
11
+ gemspec
12
+ joeyAghion
13
+ JRuby
14
+ linter
15
+ md
16
+ mongodb
17
+ Mongoid
18
+ mongoid
19
+ MongoidCompatibilityRelease
20
+ mongoidX
21
+ moodlemags
22
+ nitpicky
23
+ ObjectId
24
+ ostruct
25
+ phyllisstein
26
+ prerelease
27
+ Rakefile
28
+ rb
29
+ README
30
+ Rebase
31
+ rebase
32
+ rspec
33
+ RuboCop
34
+ RubyGems
35
+ saisrinivasan
36
+ SimpleCov
37
+ simplecov
38
+ YAML
39
+ yml
data/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
+ ### 1.1.1 (2026/11/24)
2
+
3
+ * [#29](https://github.com/mongoid/mongoid-compatibility/pull/29): Upgrade danger-pr-comment to 0.3.0 from the `danger` organization and skip empty Danger report comments - [@dblock](https://github.com/dblock).
4
+ * [#25](https://github.com/mongoid/mongoid-compatibility/pull/25): Lint Markdown, YAML, and spelling with rubocop-md, rubocop-prose, rubocop-spellcheck, and rubocop-yaml in a separate Lint workflow, and clean up documentation - [@dblock](https://github.com/dblock).
5
+ * [#26](https://github.com/mongoid/mongoid-compatibility/pull/26): Run CI pushes only on the default branch, cancel superseded pull request runs, skip duplicate lint in the test matrix, and bound job times - [@dblock](https://github.com/dblock).
6
+ * [#27](https://github.com/mongoid/mongoid-compatibility/pull/27): Release with ruby-gem-release from a manually dispatched GitHub Actions workflow using RubyGems Trusted Publishing, with dry runs - [@dblock](https://github.com/dblock).
7
+ * [#30](https://github.com/mongoid/mongoid-compatibility/pull/30): Fix release blockers: ignore `.bundle`, which `bundler-cache` writes and the release workflow's clean-checkout check rejects, and exempt pinned workflow lines from `Layout/LineLength` so lint passes on `master` - [@dblock](https://github.com/dblock).
8
+
1
9
  ### 1.1.0 (2026/10/18)
10
+
2
11
  * [#24](https://github.com/mongoid/mongoid-compatibility/pull/24): Cover supported require aliases and the public gem version - [@dblock](https://github.com/dblock).
3
12
  * [#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
13
  * [#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).
data/CONTRIBUTING.md CHANGED
@@ -1,23 +1,22 @@
1
- Contributing to Mongoid::Compatibility
2
- =======================================
1
+ # Contributing to Mongoid::Compatibility
3
2
 
4
3
  Mongoid::Compatibility is work of [many of contributors](https://github.com/mongoid/mongoid-compatibility/graphs/contributors). You're encouraged to submit [pull requests](https://github.com/mongoid/mongoid-compatibility/pulls), [propose features, ask questions and discuss issues](https://github.com/mongoid/mongoid-compatibility/issues).
5
4
 
6
- #### Fork the Project
5
+ ## Fork the Project
7
6
 
8
- Fork the [project on Github](https://github.com/mongoid/mongoid-compatibility) and check out your copy.
7
+ Fork the [project on GitHub](https://github.com/mongoid/mongoid-compatibility) and check out your copy.
9
8
 
10
- ```
9
+ ```sh
11
10
  git clone https://github.com/contributor/mongoid-compatibility.git
12
11
  cd mongoid-compatibility
13
12
  git remote add upstream https://github.com/mongoid/mongoid-compatibility.git
14
13
  ```
15
14
 
16
- #### Create a Topic Branch
15
+ ### Create a Topic Branch
17
16
 
18
17
  Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
19
18
 
20
- ```
19
+ ```sh
21
20
  git checkout master
22
21
  git pull upstream master
23
22
  git checkout -b my-feature-branch
@@ -27,7 +26,7 @@ git checkout -b my-feature-branch
27
26
 
28
27
  Ensure that you can build the project and run tests.
29
28
 
30
- ```
29
+ ```sh
31
30
  bundle install
32
31
  bundle exec rake
33
32
  ```
@@ -42,7 +41,7 @@ We definitely appreciate pull requests that highlight or reproduce a problem, ev
42
41
 
43
42
  Implement your feature or bug fix.
44
43
 
45
- Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop), run `bundle exec rubocop` and fix any style issues highlighted.
44
+ Ruby style is enforced with [RuboCop](https://github.com/bbatsov/rubocop), run `bundle exec rubocop` and fix any style issues highlighted.
46
45
 
47
46
  Make sure that `bundle exec rake` completes without errors.
48
47
 
@@ -52,28 +51,28 @@ Document any external behavior in the [README](README.md).
52
51
 
53
52
  #### Update Changelog
54
53
 
55
- Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Make it look like every other line, including your name and link to your Github account.
54
+ Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Make it look like every other line, including your name and link to your GitHub account.
56
55
 
57
56
  #### Commit Changes
58
57
 
59
58
  Make sure git knows your name and email address:
60
59
 
61
- ```
60
+ ```sh
62
61
  git config --global user.name "Your Name"
63
62
  git config --global user.email "contributor@example.com"
64
63
  ```
65
64
 
66
65
  Writing good commit logs is important. A commit log should describe what changed and why.
67
66
 
68
- ```
67
+ ```sh
69
68
  git add ...
70
69
  git commit
71
70
  ```
72
71
 
73
72
  #### Push
74
73
 
75
- ```
76
- git push origin my-feature-branch
74
+ ```sh
75
+ git push origin my - feature - branch
77
76
  ```
78
77
 
79
78
  #### Make a Pull Request
@@ -84,7 +83,7 @@ Go to https://github.com/contributor/mongoid-compatibility and select your featu
84
83
 
85
84
  If you've been working on a change for a while, rebase with upstream/master.
86
85
 
87
- ```
86
+ ```sh
88
87
  git fetch upstream
89
88
  git rebase upstream/master
90
89
  git push origin my-feature-branch -f
@@ -94,20 +93,20 @@ git push origin my-feature-branch -f
94
93
 
95
94
  Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
96
95
 
97
- ```
96
+ ```text
98
97
  * [#123](https://github.com/mongoid/mongoid-compatibility/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
99
98
  ```
100
99
 
101
100
  Amend your previous commit and force push the changes.
102
101
 
103
- ```
102
+ ```sh
104
103
  git commit --amend
105
104
  git push origin my-feature-branch -f
106
105
  ```
107
106
 
108
107
  #### Check on Your Pull Request
109
108
 
110
- Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
109
+ Go back to your pull request after a few minutes and see whether it passed muster with GitHub Actions. Everything should look green, otherwise fix issues and amend your commit as described above.
111
110
 
112
111
  #### Be Patient
113
112
 
data/Gemfile CHANGED
@@ -9,3 +9,17 @@ group :test do
9
9
  gem 'danger-changelog', require: false
10
10
  gem 'danger-pr-comment', require: false
11
11
  end
12
+
13
+ group :development, :test do
14
+ if RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3')
15
+ gem 'commonmarker', '~> 2.10', require: false
16
+ gem 'rubocop', '~> 1.92'
17
+ gem 'rubocop-md', '~> 3.0', require: false
18
+ gem 'rubocop-prose', '~> 0.2', require: false
19
+ gem 'rubocop-rake', '~> 0.7', require: false
20
+ gem 'rubocop-rspec', '~> 3.10', require: false
21
+ gem 'rubocop-spellcheck', '~> 0.2', require: false
22
+ gem 'rubocop-yaml', '~> 0.1.0', require: false
23
+ gem 'ruby-gem-release', '0.9.0', require: false
24
+ end
25
+ end
data/README.md CHANGED
@@ -1,21 +1,19 @@
1
- Mongoid::Compatibility
2
- =======================
1
+ # Mongoid::Compatibility
3
2
 
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?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)
3
+ [![Gem Version](https://img.shields.io/gem/v/mongoid-compatibility.svg)](https://badge.fury.io/rb/mongoid-compatibility) [![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) [![Coverage Status](https://coveralls.io/repos/github/mongoid/mongoid-compatibility/badge.svg?branch=master)](https://coveralls.io/github/mongoid/mongoid-compatibility?branch=master)
7
4
 
8
5
  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
6
 
10
7
  [Tested](https://github.com/mongoid/mongoid-compatibility/actions) against:
8
+
11
9
  - MRI: `2.6.x`, `2.7.x`, `3.0.x`, `3.1.x`
12
10
  - Compatibility helpers for Mongoid versions 2, 3, 4, 5, 6, 7, 8, and 9.
13
11
 
14
- ### Install
12
+ ## Install
15
13
 
16
14
  Add `mongoid-compatibility` to your Gemfile.
17
15
 
18
- ```
16
+ ```sh
19
17
  gem 'mongoid-compatibility'
20
18
  ```
21
19
 
@@ -25,7 +23,7 @@ You may explicitly need to `require mongoid/compatibility`.
25
23
 
26
24
  #### Mongoid::Compatibility::Version
27
25
 
28
- ``` ruby
26
+ ```ruby
29
27
  Mongoid::Compatibility::Version.mongoid2?
30
28
  # => is this Mongoid 2.x?
31
29
 
@@ -43,14 +41,14 @@ Mongoid::Compatibility::Version.mongoid6?
43
41
 
44
42
  Mongoid::Compatibility::Version.mongoid7?
45
43
  # => is this Mongoid 7.x?
46
-
44
+
47
45
  Mongoid::Compatibility::Version.mongoid8?
48
46
  # => is this Mongoid 8.x?
49
47
  ```
50
48
 
51
49
  Instead of checking specifically for a specific version, use `newer` and `older` helpers. For example:
52
50
 
53
- ``` ruby
51
+ ```ruby
54
52
  Mongoid::Compatibility::Version.mongoid6_or_newer?
55
53
  # => is this Mongoid 6.x or 7.x or 8.x, including beta 8?
56
54
 
@@ -60,7 +58,7 @@ Mongoid::Compatibility::Version.mongoid5_or_older?
60
58
 
61
59
  #### Mongoid::Compatibility::ObjectId
62
60
 
63
- ``` ruby
61
+ ```ruby
64
62
  Mongoid::Compatibility::ObjectId.legal?('4e4d66343b39b68407000001')
65
63
  # => is this a valid BSON ID?
66
64
  ```
data/RELEASING.md CHANGED
@@ -1,62 +1,35 @@
1
- # Releasing `mongoid-compatibility`
2
- ## Guidelines
3
- Generally, `mongoid-compatibility` should be released with enthusiasm but care. Release bug fixes as added, features as desired, and breaking API changes as absolutely necessary.
1
+ # Releasing Mongoid::Compatibility
4
2
 
5
- ## This is how we do it.
6
- 1. Run the test suite in your local environment first, and ensure that everything's passing.
3
+ Releases use [ruby-gem-release](https://github.com/dblock/ruby-gem-release) 0.9.0 through a manually dispatched [Release workflow](.github/workflows/release.yml). Keep the `ruby-gem-release` gem in [Gemfile](Gemfile) and the reusable workflow in `release.yml` pinned to the same version. The workflow publishes through RubyGems Trusted Publishing, so no RubyGems API key or one-time password is needed. It only runs from `master` in `mongoid/mongoid-compatibility`. The local Bundler `rake release`, `release:rubygem_push`, and `release:source_control_push` tasks are disabled.
7
4
 
8
- ```bash
9
- bundle install
10
- rake
11
- ```
5
+ ## One-Time Setup
12
6
 
13
- 2. Wait for the release preparation commit's [GitHub Actions](https://github.com/mongoid/mongoid-compatibility/actions) checks to pass before publishing.
7
+ Before the first automated release, a maintainer must:
14
8
 
15
- 3. Bump the version in [`lib/mongoid/compatibility/self.rb`](lib/mongoid/compatibility/self.rb).
9
+ 1. Create the GitHub environment `release` in `mongoid/mongoid-compatibility`, for example with `gh api --method PUT repos/mongoid/mongoid-compatibility/environments/release`, and restrict its deployment branches to `master`. Add required reviewers to require maintainer approval before publication.
10
+ 2. At [mongoid-compatibility's trusted publishers](https://rubygems.org/gems/mongoid-compatibility/trusted_publishers), add a GitHub Actions publisher with repository owner `mongoid`, repository `mongoid-compatibility`, workflow filename `release.yml`, environment `release`, and the separate workflow repository owner `dblock` and repository `ruby-gem-release`.
11
+ 3. Allow GitHub Actions to push release commits and `v*` tags to `master`. See the upstream [setup and permissions guidance](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/RELEASING.md#one-time-setup).
16
12
 
17
- * If the release fixes bugs or adds features with negligible impact, increment the third number (e.g., `0.3.2` → `0.3.3`).
18
- * If the release adds significant new features, increment the second number and zero out the third (e.g., `0.3.2` → `0.4.0`).
19
- * If the release adds breaking API changes, increment the first number and zero out the second and third (e.g., `0.3.2` → `1.0.0`).
13
+ Verify the setup without publishing with a [dry run](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/docs/actions/release.md#dry-run), which never edits files, builds, pushes, or publishes:
20
14
 
21
- You've gotta know it---it's semantic!
22
-
23
- 4. Add a header for the new version to [`CHANGELOG.md`](CHANGELOG.md) and list all the changes your release will include underneath it, crediting contributors as appropriate.
24
-
25
- 6. Update the [`README`](README.md) to document any new features. Remove any warnings indicating that users are reading the documentation for an unreleased version.
26
-
27
- 7. Commit your changes...
28
-
29
- ```bash
30
- git add README.md CHANGELOG.md lib/mongoid/compatibility/self.rb
31
- git commit -m "Preparing for release, 0.4.0."
32
- git push origin master
33
- ```
15
+ ```sh
16
+ gh workflow run release.yml --repo mongoid/mongoid-compatibility --ref master -f dry-run=true
17
+ ```
34
18
 
35
- 8. ...and do the thing!
19
+ ## Prepare
36
20
 
37
- ```bash
38
- rake release
39
- #=> mongoid-compatibility 0.4.0 built to pkg/mongoid-compatibility-0.4.0.gem
40
- #=> Tagged 0.4.0.
41
- #=> Pushed git commits and tags.
42
- #=> Pushed mongoid-compatibility 0.4.0 to rubygems.org.
43
- ```
44
- ## Prepare for the Next Version
21
+ Start with a clean, up-to-date `master` and verify that the latest [CI checks](https://github.com/mongoid/mongoid-compatibility/actions) pass. Follow semantic versioning: patch for fixes, minor for backward-compatible features, major for breaking changes. Check `VERSION` in [lib/mongoid/compatibility/self.rb](lib/mongoid/compatibility/self.rb) and the matching `(Next)` heading in [CHANGELOG.md](CHANGELOG.md), and change both in a pull request if needed, or pass a `version` override when dispatching. The workflow dates the `(Next)` heading using `YYYY/MM/DD` and removes the `* Your contribution here.` placeholder; a section without notes cannot be released.
45
22
 
46
- Add the next release to [CHANGELOG.md](CHANGELOG.md).
23
+ Release automation requires MRI Ruby 3.3 or newer; the release dependency and tasks are skipped on older Ruby versions and JRuby. Release specs in [spec/release](spec/release) run the actual release tasks against a local fixture with the [ruby-gem-release RSpec helpers](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/docs/testing.md), without contacting RubyGems or GitHub.
47
24
 
48
- ```
49
- ### 1.1.1 (Next)
25
+ ## Publish
50
26
 
51
- * Your contribution here.
27
+ ```sh
28
+ gh workflow run release.yml --repo mongoid/mongoid-compatibility --ref master
52
29
  ```
53
30
 
54
- Increment the development patch version in [lib/mongoid/compatibility/self.rb](lib/mongoid/compatibility/self.rb).
31
+ Pass `-f version=x.y.z` to release a different version. Dispatching starts a real release; do not merge into `master` while it runs. The workflow prepares the release commit, starts MongoDB 8.0, runs lint and specs on Ruby 3.3, builds the gem, preserves recovery artifacts, publishes to RubyGems, pushes the release commit and `v` tag, and creates a GitHub Release with the changelog notes and the gem attached. It then increments the patch version, adds a new `(Next)` section, and pushes the next development commit. Verify the published version on [RubyGems](https://rubygems.org/gems/mongoid-compatibility), the tag, the [GitHub Release](https://github.com/mongoid/mongoid-compatibility/releases), and the next development commit.
55
32
 
56
- Commit your changes.
33
+ ## Recover a Partial Release
57
34
 
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
- ```
35
+ Inspect the failed run, RubyGems, remote commits and tags, and the GitHub Release before retrying. Publication may have succeeded even if a later step failed. Never move a published tag or republish a version with different contents. Use the run's retained recovery artifacts and the upstream [recovery instructions](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/docs/actions/release.md#recovery-artifacts).
data/Rakefile CHANGED
@@ -3,6 +3,18 @@
3
3
  require 'rubygems'
4
4
  require 'bundler/gem_tasks'
5
5
 
6
+ if RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3') &&
7
+ Gem.loaded_specs.key?('ruby-gem-release')
8
+ require_relative 'script/release'
9
+ MongoidCompatibilityRelease.workflow.install_tasks
10
+
11
+ %w[release release:rubygem_push release:source_control_push].each do |name|
12
+ Rake::Task[name].clear
13
+ desc 'Disabled; releases run through GitHub Actions, see RELEASING.md'
14
+ task(name) { abort "#{name} is disabled; releases run through GitHub Actions, see RELEASING.md" }
15
+ end
16
+ end
17
+
6
18
  Bundler.setup :default, :development
7
19
 
8
20
  require 'rspec/core'
@@ -12,7 +24,14 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
12
24
  spec.pattern = FileList['spec/**/*_spec.rb']
13
25
  end
14
26
 
15
- require 'rubocop/rake_task'
16
- RuboCop::RakeTask.new(:rubocop)
27
+ lint = RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3') &&
28
+ Gem.loaded_specs.key?('rubocop')
29
+ if lint
30
+ require 'rubocop/rake_task'
31
+ RuboCop::RakeTask.new(:rubocop)
32
+
33
+ desc 'Lint Ruby, Markdown, YAML, and spelling'
34
+ task lint: :rubocop
35
+ end
17
36
 
18
- task default: %i[rubocop spec]
37
+ task default: lint ? %i[rubocop spec] : %i[spec]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mongoid
4
4
  module Compatibility
5
- VERSION = '1.1.0'
5
+ VERSION = '1.1.1'
6
6
  end
7
7
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.push File.expand_path('lib', __dir__)
4
- require 'mongoid/compatibility/self'
3
+ require_relative 'lib/mongoid/compatibility/self'
5
4
 
6
5
  Gem::Specification.new do |s|
7
6
  s.name = 'mongoid-compatibility'
@@ -22,9 +21,6 @@ Gem::Specification.new do |s|
22
21
  s.add_development_dependency 'ostruct'
23
22
  s.add_development_dependency 'rake'
24
23
  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
24
  s.add_development_dependency 'simplecov', '~> 0.22' if ENV['COVERAGE'] == 'true'
29
25
  s.metadata['rubygems_mfa_required'] = 'true'
30
26
  end
data/script/release.rb ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby-gem-release/changelog'
4
+ require 'ruby-gem-release/workflow/ruby_gem'
5
+
6
+ # Builds the ruby-gem-release workflow used by the Rakefile, the Release GitHub Actions workflow, and spec/release.
7
+ module MongoidCompatibilityRelease
8
+ def self.workflow(**options)
9
+ RubyGemRelease::Workflow::RubyGem.new(
10
+ version: RubyGemRelease::Version::RubyConstant.new(path: 'lib/mongoid/compatibility/self.rb',
11
+ constant: 'VERSION'),
12
+ changelog: RubyGemRelease::Changelog::Intridea.new(placeholder: '* Your contribution here.'),
13
+ **options
14
+ )
15
+ end
16
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ if RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3') &&
4
+ Gem.loaded_specs.key?('ruby-gem-release')
5
+ require_relative '../../script/release'
6
+ require 'ruby-gem-release/rspec'
7
+
8
+ RSpec.describe MongoidCompatibilityRelease do
9
+ include RubyGemRelease::RSpec
10
+
11
+ let(:root) { File.expand_path('../..', __dir__) }
12
+ let(:version_path) { 'lib/mongoid/compatibility/self.rb' }
13
+ let(:fixture_files) do
14
+ %w[
15
+ mongoid-compatibility.gemspec script/release.rb lib/**/*.rb CHANGELOG.md
16
+ CONTRIBUTING.md LICENSE.md README.md RELEASING.md
17
+ ]
18
+ end
19
+ let(:placeholder) { '* Your contribution here.' }
20
+ let(:note) { '* [#1](https://github.com/mongoid/mongoid-compatibility/pull/1): Added a feature.' }
21
+
22
+ def changelog(notes)
23
+ [
24
+ '### 1.2.0 (Next)', '', notes, placeholder, '',
25
+ '### 1.1.0 (2026/01/01)', '', '* Previous release.', ''
26
+ ].join("\n")
27
+ end
28
+
29
+ def write_version(project, version)
30
+ source = File.read(File.join(root, version_path))
31
+ project.write(version_path, source.sub(/VERSION = (['"])[^'"]+\1/, "VERSION = '#{version}'"))
32
+ end
33
+
34
+ def with_project(notes)
35
+ with_release_project do |project|
36
+ project.copy_files(path: root, files: fixture_files)
37
+ project.configure_workflow(require: 'script/release', builder: 'MongoidCompatibilityRelease.workflow')
38
+ project.write('CHANGELOG.md', changelog(notes))
39
+ write_version(project, '1.2.0')
40
+ project.commit!
41
+ yield project
42
+ end
43
+ end
44
+
45
+ it 'builds the standard ruby-gem-release workflow' do
46
+ expect(described_class.workflow).to be_a(RubyGemRelease::Workflow::RubyGem)
47
+ end
48
+
49
+ it 'dates the release and prepares the next patch version' do
50
+ with_project(note) do |project|
51
+ project.release!
52
+
53
+ released = project.remote_file('v1.2.0', 'CHANGELOG.md')
54
+ expect(released).to match(%r{\A### 1\.2\.0 \(\d{4}/\d{2}/\d{2}\)\n\n})
55
+ expect(released).to include(note)
56
+ expect(released).not_to include('(Next)', placeholder)
57
+ expect(project.remote_file('v1.2.0', version_path)).to include("VERSION = '1.2.0'")
58
+ pending = project.remote_file('master', 'CHANGELOG.md')
59
+ expect(pending).to start_with("### 1.2.1 (Next)\n\n#{placeholder}\n\n### 1.2.0 (")
60
+ expect(project.remote_file('master', version_path)).to include("VERSION = '1.2.1'")
61
+ expect(project.git('status', '--porcelain')).to be_empty
62
+ end
63
+ end
64
+
65
+ it 'rejects placeholder-only notes without changing files or remote refs' do
66
+ with_project('') do |project|
67
+ original = project.git('rev-parse', 'origin/master')
68
+ project.run_task('release:workflow:capture')
69
+
70
+ expect { project.run_task('release:validate') }.to raise_error(RuntimeError, /no pending changelog notes/)
71
+ expect(project.git('status', '--porcelain')).to be_empty
72
+ expect(project.git('rev-parse', 'origin/master')).to eq(original)
73
+ end
74
+ end
75
+ end
76
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-compatibility
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-18 00:00:00.000000000 Z
11
+ date: 2026-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -94,48 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
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
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
97
  description:
140
98
  email: dblock@dblock.org
141
99
  executables: []
@@ -144,12 +102,14 @@ extra_rdoc_files: []
144
102
  files:
145
103
  - ".github/workflows/danger-comment.yml"
146
104
  - ".github/workflows/danger.yml"
147
- - ".github/workflows/rubocop.yml"
105
+ - ".github/workflows/lint.yml"
106
+ - ".github/workflows/release.yml"
148
107
  - ".github/workflows/test.yml"
149
108
  - ".gitignore"
150
109
  - ".rspec"
151
110
  - ".rubocop.yml"
152
111
  - ".rubocop_todo.yml"
112
+ - ".spellcheck.txt"
153
113
  - Appraisals
154
114
  - CHANGELOG.md
155
115
  - CONTRIBUTING.md
@@ -176,6 +136,7 @@ files:
176
136
  - lib/mongoid/compatibility/version.rb
177
137
  - lib/mongoid_compatibility.rb
178
138
  - mongoid-compatibility.gemspec
139
+ - script/release.rb
179
140
  - spec/config/mongoid2.yml
180
141
  - spec/config/mongoid3.yml
181
142
  - spec/config/mongoid4.yml
@@ -188,6 +149,7 @@ files:
188
149
  - spec/mongoid/compatibility/self_spec.rb
189
150
  - spec/mongoid/compatibility/version_spec.rb
190
151
  - spec/mongoid/compatibility_entry_points_spec.rb
152
+ - spec/release/release_spec.rb
191
153
  - spec/spec_helper.rb
192
154
  - spec/support/mongoid.rb
193
155
  homepage: http://github.com/mongoid/mongoid-compatibility
@@ -210,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
172
  - !ruby/object:Gem::Version
211
173
  version: 1.3.6
212
174
  requirements: []
213
- rubygems_version: 3.5.16
175
+ rubygems_version: 3.5.22
214
176
  signing_key:
215
177
  specification_version: 4
216
178
  summary: Compatibility helpers for Mongoid.
@@ -1,13 +0,0 @@
1
- name: Rubocop
2
- on: [push, pull_request]
3
- jobs:
4
- lint:
5
- runs-on: ubuntu-latest
6
- steps:
7
- - uses: actions/checkout@v6
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