mongoid-compatibility 1.0.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 +4 -4
- data/.github/workflows/danger-comment.yml +19 -0
- data/.github/workflows/danger.yml +18 -15
- data/.github/workflows/lint.yml +29 -0
- data/.github/workflows/release.yml +30 -0
- data/.github/workflows/test.yml +38 -64
- data/.gitignore +4 -1
- data/.rubocop.yml +80 -2
- data/.rubocop_todo.yml +39 -19
- data/.spellcheck.txt +39 -0
- data/CHANGELOG.md +16 -0
- data/CONTRIBUTING.md +17 -18
- data/Dangerfile +3 -1
- data/Gemfile +20 -0
- data/README.md +11 -11
- data/RELEASING.md +23 -31
- data/Rakefile +22 -3
- data/lib/mongoid/compatibility/self.rb +1 -1
- data/mongoid-compatibility.gemspec +5 -5
- data/script/release.rb +16 -0
- data/spec/mongoid/compatibility/object_id_spec.rb +1 -0
- data/spec/mongoid/compatibility/version_spec.rb +9 -0
- data/spec/mongoid/compatibility_entry_points_spec.rb +17 -0
- data/spec/release/release_spec.rb +76 -0
- data/spec/spec_helper.rb +9 -0
- metadata +21 -28
- data/.github/workflows/rubocop.yml +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eab8a8ddca94d1ae3eae603443e320a3ca2d6459d499ee209ae67149618c4d80
|
|
4
|
+
data.tar.gz: f6e6a03abff49a9337af0072d94b706457030e739f2112bf958fbe90a0fe2180
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba07c5c3bde712171e3a539cabf83768700d39efe9434ba025e2c0ff20b171e3416d4517a5349070b5dea9169d0e8da55260c6c929dbddb7ed7eecb5f0a16e3c
|
|
7
|
+
data.tar.gz: af24a10fe3999bf42f342a8230191ea7541bd3aeb6ca0b7a413197f77449200d069aafa04c448819924b3e9c43e428fe3022bf1a94b21b135293933a82c72cdb
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: Danger Comment
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_run:
|
|
5
|
+
workflows: [Danger]
|
|
6
|
+
types: [completed]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
actions: read
|
|
10
|
+
issues: write
|
|
11
|
+
pull-requests: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
comment:
|
|
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
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
name:
|
|
2
|
-
|
|
1
|
+
name: Danger
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, reopened, edited, synchronize]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
3
14
|
jobs:
|
|
4
15
|
danger:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
16
|
+
name: Review Pull Request
|
|
17
|
+
uses: danger/danger-pr-comment/.github/workflows/danger-run.yml@645e89bcc7be89ee7e8362166110b05cbced8e59 # v0.3.0
|
|
18
|
+
with:
|
|
19
|
+
ruby-version: '2.7'
|
|
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
|
data/.github/workflows/test.yml
CHANGED
|
@@ -1,83 +1,57 @@
|
|
|
1
1
|
name: CI RSpec Test
|
|
2
2
|
|
|
3
|
-
on:
|
|
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
|
-
name:
|
|
8
|
-
|
|
13
|
+
name: Ruby ${{ matrix.entry.ruby }} / Mongoid ${{ matrix.entry.mongoid }} / MongoDB ${{ matrix.entry.mongodb }}
|
|
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
|
-
|
|
12
|
-
BUNDLE_GEMFILE: gemfiles
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
continue-on-error: false
|
|
19
|
+
COVERAGE: ${{ matrix.entry.coverage }}
|
|
20
|
+
BUNDLE_GEMFILE: gemfiles/mongoid_${{ matrix.entry.mongoid }}.gemfile
|
|
15
21
|
strategy:
|
|
22
|
+
fail-fast: false
|
|
16
23
|
matrix:
|
|
17
24
|
entry:
|
|
18
|
-
- { ruby:
|
|
19
|
-
- { ruby:
|
|
20
|
-
- { ruby:
|
|
21
|
-
- { ruby:
|
|
22
|
-
- { ruby:
|
|
23
|
-
- { ruby:
|
|
24
|
-
- { ruby:
|
|
25
|
-
- { ruby:
|
|
26
|
-
- { ruby:
|
|
27
|
-
- { ruby:
|
|
28
|
-
- { ruby:
|
|
29
|
-
- { ruby:
|
|
30
|
-
- { ruby:
|
|
31
|
-
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "4.0" }
|
|
32
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.0" }
|
|
33
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.0" }
|
|
34
|
-
- { ruby: "2.7", gemfile: 'mongoid_7', mongodb: "4.0" }
|
|
35
|
-
- { ruby: "3.0", gemfile: 'mongoid_8', mongodb: "4.0" }
|
|
36
|
-
- { ruby: "3.1", gemfile: 'mongoid_8', mongodb: "4.0" }
|
|
37
|
-
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "4.2" }
|
|
38
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.2" }
|
|
39
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.2" }
|
|
40
|
-
- { ruby: "2.7", gemfile: 'mongoid_7', mongodb: "4.2" }
|
|
41
|
-
- { ruby: "3.0", gemfile: 'mongoid_8', mongodb: "4.2" }
|
|
42
|
-
- { ruby: "3.1", gemfile: 'mongoid_8', mongodb: "4.2" }
|
|
43
|
-
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "4.4" }
|
|
44
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.4" }
|
|
45
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.4" }
|
|
46
|
-
- { ruby: "2.7", gemfile: 'mongoid_7', mongodb: "4.4" }
|
|
47
|
-
- { ruby: "3.0", gemfile: 'mongoid_8', mongodb: "4.4" }
|
|
48
|
-
- { ruby: "3.1", gemfile: 'mongoid_8', mongodb: "4.4" }
|
|
49
|
-
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "5.0" }
|
|
50
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "5.0" }
|
|
51
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "5.0" }
|
|
52
|
-
- { ruby: "2.7", gemfile: 'mongoid_7', mongodb: "5.0" }
|
|
53
|
-
- { ruby: "3.0", gemfile: 'mongoid_8', mongodb: "5.0" }
|
|
54
|
-
- { ruby: "3.1", gemfile: 'mongoid_8', mongodb: "5.0" }
|
|
55
|
-
- { ruby: "3.1", gemfile: 'mongoid_9', mongodb: "5.0" }
|
|
56
|
-
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "6.0" }
|
|
57
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "6.0" }
|
|
58
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "6.0" }
|
|
59
|
-
- { ruby: "2.7", gemfile: 'mongoid_7', mongodb: "6.0" }
|
|
60
|
-
- { ruby: "3.0", gemfile: 'mongoid_8', mongodb: "6.0" }
|
|
61
|
-
- { ruby: "3.1", gemfile: 'mongoid_8', mongodb: "6.0" }
|
|
62
|
-
- { ruby: "3.1", gemfile: 'mongoid_9', mongodb: "6.0" }
|
|
63
|
-
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "7.0" }
|
|
64
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "7.0" }
|
|
65
|
-
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "7.0" }
|
|
66
|
-
- { ruby: "2.7", gemfile: 'mongoid_7', mongodb: "7.0" }
|
|
67
|
-
- { ruby: "3.0", gemfile: 'mongoid_8', mongodb: "7.0" }
|
|
68
|
-
- { ruby: "3.1", gemfile: 'mongoid_8', mongodb: "7.0" }
|
|
69
|
-
- { ruby: "3.1", gemfile: 'mongoid_9', mongodb: "7.0" }
|
|
25
|
+
- { ruby: '2.6', mongoid: '3', mongodb: '3.6' }
|
|
26
|
+
- { ruby: '2.6', mongoid: '4', mongodb: '3.6' }
|
|
27
|
+
- { ruby: '2.6', mongoid: '5', mongodb: '3.6' }
|
|
28
|
+
- { ruby: '2.6', mongoid: '6', mongodb: '4.0' }
|
|
29
|
+
- { ruby: '2.6', mongoid: '7', mongodb: '4.2' }
|
|
30
|
+
- { ruby: '2.7', mongoid: '7', mongodb: '4.4' }
|
|
31
|
+
- { ruby: '3.0', mongoid: '8', mongodb: '5.0' }
|
|
32
|
+
- { ruby: '3.1', mongoid: '8', mongodb: '6.0' }
|
|
33
|
+
- { ruby: '3.1', mongoid: '9', mongodb: '5.0' }
|
|
34
|
+
- { ruby: '3.2', mongoid: '9', mongodb: '7.0' }
|
|
35
|
+
- { ruby: '3.3', mongoid: '9', mongodb: '8.0' }
|
|
36
|
+
- { ruby: '3.4', mongoid: '9', mongodb: '8.0', coverage: true }
|
|
37
|
+
- { ruby: '4.0', mongoid: '9', mongodb: '8.0' }
|
|
70
38
|
steps:
|
|
71
|
-
-
|
|
72
|
-
|
|
39
|
+
- uses: actions/checkout@v6
|
|
40
|
+
- name: Set up MongoDB
|
|
41
|
+
uses: supercharge/mongodb-github-action@1.12.1
|
|
73
42
|
with:
|
|
74
43
|
mongodb-version: ${{ matrix.entry.mongodb }}
|
|
75
|
-
- uses: actions/checkout@v3
|
|
76
44
|
- name: Set up Ruby
|
|
77
45
|
uses: ruby/setup-ruby@v1
|
|
78
46
|
with:
|
|
79
47
|
ruby-version: ${{ matrix.entry.ruby }}
|
|
80
|
-
bundler: '2'
|
|
81
48
|
bundler-cache: true
|
|
82
49
|
- name: Run tests
|
|
83
|
-
run: bundle exec rake
|
|
50
|
+
run: bundle exec rake spec
|
|
51
|
+
- name: Coveralls
|
|
52
|
+
if: matrix.entry.coverage
|
|
53
|
+
uses: coverallsapp/github-action@v2
|
|
54
|
+
with:
|
|
55
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
56
|
+
file: coverage/.resultset.json
|
|
57
|
+
format: simplecov
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,5 +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:
|
|
12
|
+
NewCops: enable
|
|
13
|
+
Exclude:
|
|
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
|
|
43
|
+
|
|
44
|
+
Markdown/HeadingCapitalization:
|
|
45
|
+
Enabled: true
|
|
46
|
+
Style: title_case
|
|
47
|
+
|
|
48
|
+
Prose/MaxLength:
|
|
49
|
+
Max: false
|
|
50
|
+
Exclude:
|
|
51
|
+
- LICENSE.md
|
|
52
|
+
|
|
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
|
|
2
74
|
Exclude:
|
|
3
|
-
-
|
|
75
|
+
- spec/release/release_spec.rb
|
|
4
76
|
|
|
5
|
-
|
|
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,39 +1,59 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
|
-
# `rubocop --auto-gen-config`
|
|
3
|
-
#
|
|
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
|
-
#
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
# Configuration parameters: EnforcedStyle, AllowedGems.
|
|
10
|
+
# SupportedStyles: Gemfile, gems.rb, gemspec
|
|
11
|
+
Gemspec/DevelopmentDependencies:
|
|
12
|
+
Exclude:
|
|
13
|
+
- 'mongoid-compatibility.gemspec'
|
|
13
14
|
|
|
14
15
|
Gemspec/RequiredRubyVersion:
|
|
15
16
|
Exclude:
|
|
16
17
|
- 'mongoid-compatibility.gemspec'
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
20
|
+
# Prefixes: when, with, without
|
|
21
|
+
RSpec/ContextWording:
|
|
22
|
+
Exclude:
|
|
23
|
+
- 'spec/mongoid/compatibility/version_spec.rb'
|
|
24
|
+
|
|
25
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
26
|
+
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
|
|
27
|
+
# SupportedStyles: described_class, explicit
|
|
28
|
+
RSpec/DescribedClass:
|
|
29
|
+
Exclude:
|
|
30
|
+
- 'spec/mongoid/compatibility/object_id_spec.rb'
|
|
31
|
+
- 'spec/mongoid/compatibility/version_spec.rb'
|
|
32
|
+
|
|
33
|
+
# Configuration parameters: Max, CountAsOne.
|
|
34
|
+
RSpec/ExampleLength:
|
|
19
35
|
Exclude:
|
|
20
|
-
- 'spec
|
|
21
|
-
- 'test/**/*'
|
|
36
|
+
- 'spec/mongoid/compatibility/version_spec.rb'
|
|
22
37
|
|
|
23
|
-
#
|
|
38
|
+
# Configuration parameters: Max.
|
|
39
|
+
RSpec/MultipleExpectations:
|
|
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'
|
|
49
|
+
|
|
50
|
+
# Configuration parameters: AllowedConstants.
|
|
24
51
|
Style/Documentation:
|
|
25
52
|
Exclude:
|
|
26
53
|
- 'lib/mongoid/compatibility/object_id.rb'
|
|
27
|
-
- 'lib/mongoid/compatibility/self.rb'
|
|
28
54
|
- 'lib/mongoid/compatibility/version.rb'
|
|
29
55
|
|
|
30
|
-
#
|
|
31
|
-
Style/
|
|
56
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
57
|
+
Style/RedundantStringEscape:
|
|
32
58
|
Exclude:
|
|
33
59
|
- 'lib/mongoid/compatibility/version.rb'
|
|
34
|
-
|
|
35
|
-
# Offense count: 1
|
|
36
|
-
# Configuration parameters: Exclude.
|
|
37
|
-
Style/FileName:
|
|
38
|
-
Exclude:
|
|
39
|
-
- 'lib/mongoid-compatibility.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,3 +1,19 @@
|
|
|
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
|
+
|
|
9
|
+
### 1.1.0 (2026/10/18)
|
|
10
|
+
|
|
11
|
+
* [#24](https://github.com/mongoid/mongoid-compatibility/pull/24): Cover supported require aliases and the public gem version - [@dblock](https://github.com/dblock).
|
|
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).
|
|
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).
|
|
14
|
+
* [#21](https://github.com/mongoid/mongoid-compatibility/pull/21): Migrate Danger to use danger-pr-comment workflow - [@dblock](https://github.com/dblock).
|
|
15
|
+
* [#20](https://github.com/mongoid/mongoid-compatibility/pull/20): Add gem caching to CI - [@saisrinivasan](https://github.com/SairamSrinivasan).
|
|
16
|
+
|
|
1
17
|
### 1.0.0 (2024/06/19)
|
|
2
18
|
|
|
3
19
|
* [#18](https://github.com/mongoid/mongoid-compatibility/pull/18): Test MongoDB 6 and 7 - [@saisrinivasan](https://github.com/SairamSrinivasan).
|
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
|
-
|
|
5
|
+
## Fork the Project
|
|
7
6
|
|
|
8
|
-
Fork the [project on
|
|
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
|
-
|
|
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 [
|
|
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
|
|
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
|
|
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/Dangerfile
CHANGED
data/Gemfile
CHANGED
|
@@ -3,3 +3,23 @@
|
|
|
3
3
|
source 'http://rubygems.org'
|
|
4
4
|
|
|
5
5
|
gemspec
|
|
6
|
+
|
|
7
|
+
group :test do
|
|
8
|
+
gem 'danger', require: false
|
|
9
|
+
gem 'danger-changelog', require: false
|
|
10
|
+
gem 'danger-pr-comment', require: false
|
|
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,19 +1,19 @@
|
|
|
1
|
-
Mongoid::Compatibility
|
|
2
|
-
=======================
|
|
1
|
+
# Mongoid::Compatibility
|
|
3
2
|
|
|
4
|
-
[](https://badge.fury.io/rb/mongoid-compatibility) [](https://github.com/mongoid/mongoid-compatibility/actions/workflows/test.yml?query=branch%3Amaster) [](https://coveralls.io/github/mongoid/mongoid-compatibility?branch=master)
|
|
4
|
+
|
|
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/`.
|
|
7
6
|
|
|
8
7
|
[Tested](https://github.com/mongoid/mongoid-compatibility/actions) against:
|
|
8
|
+
|
|
9
9
|
- MRI: `2.6.x`, `2.7.x`, `3.0.x`, `3.1.x`
|
|
10
10
|
- Compatibility helpers for Mongoid versions 2, 3, 4, 5, 6, 7, 8, and 9.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Install
|
|
13
13
|
|
|
14
14
|
Add `mongoid-compatibility` to your Gemfile.
|
|
15
15
|
|
|
16
|
-
```
|
|
16
|
+
```sh
|
|
17
17
|
gem 'mongoid-compatibility'
|
|
18
18
|
```
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ You may explicitly need to `require mongoid/compatibility`.
|
|
|
23
23
|
|
|
24
24
|
#### Mongoid::Compatibility::Version
|
|
25
25
|
|
|
26
|
-
```
|
|
26
|
+
```ruby
|
|
27
27
|
Mongoid::Compatibility::Version.mongoid2?
|
|
28
28
|
# => is this Mongoid 2.x?
|
|
29
29
|
|
|
@@ -41,14 +41,14 @@ Mongoid::Compatibility::Version.mongoid6?
|
|
|
41
41
|
|
|
42
42
|
Mongoid::Compatibility::Version.mongoid7?
|
|
43
43
|
# => is this Mongoid 7.x?
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
Mongoid::Compatibility::Version.mongoid8?
|
|
46
46
|
# => is this Mongoid 8.x?
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
Instead of checking specifically for a specific version, use `newer` and `older` helpers. For example:
|
|
50
50
|
|
|
51
|
-
```
|
|
51
|
+
```ruby
|
|
52
52
|
Mongoid::Compatibility::Version.mongoid6_or_newer?
|
|
53
53
|
# => is this Mongoid 6.x or 7.x or 8.x, including beta 8?
|
|
54
54
|
|
|
@@ -58,7 +58,7 @@ Mongoid::Compatibility::Version.mongoid5_or_older?
|
|
|
58
58
|
|
|
59
59
|
#### Mongoid::Compatibility::ObjectId
|
|
60
60
|
|
|
61
|
-
```
|
|
61
|
+
```ruby
|
|
62
62
|
Mongoid::Compatibility::ObjectId.legal?('4e4d66343b39b68407000001')
|
|
63
63
|
# => is this a valid BSON ID?
|
|
64
64
|
```
|
data/RELEASING.md
CHANGED
|
@@ -1,43 +1,35 @@
|
|
|
1
|
-
# Releasing
|
|
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
|
-
|
|
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
|
-
|
|
9
|
-
bundle install
|
|
10
|
-
rake
|
|
11
|
-
```
|
|
5
|
+
## One-Time Setup
|
|
12
6
|
|
|
13
|
-
|
|
7
|
+
Before the first automated release, a maintainer must:
|
|
14
8
|
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
15
|
+
```sh
|
|
16
|
+
gh workflow run release.yml --repo mongoid/mongoid-compatibility --ref master -f dry-run=true
|
|
17
|
+
```
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
## Prepare
|
|
24
20
|
|
|
25
|
-
|
|
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.
|
|
26
22
|
|
|
27
|
-
|
|
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.
|
|
28
24
|
|
|
29
|
-
|
|
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
|
-
```
|
|
25
|
+
## Publish
|
|
34
26
|
|
|
35
|
-
|
|
27
|
+
```sh
|
|
28
|
+
gh workflow run release.yml --repo mongoid/mongoid-compatibility --ref master
|
|
29
|
+
```
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
#=> Pushed mongoid-compatibility 0.4.0 to rubygems.org.
|
|
43
|
-
```
|
|
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.
|
|
32
|
+
|
|
33
|
+
## Recover a Partial Release
|
|
34
|
+
|
|
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
|
-
|
|
16
|
-
|
|
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]
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
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'
|
|
@@ -19,8 +18,9 @@ Gem::Specification.new do |s|
|
|
|
19
18
|
s.add_dependency 'mongoid', '>= 2.0'
|
|
20
19
|
|
|
21
20
|
s.add_development_dependency 'appraisal', '~> 2.0'
|
|
22
|
-
s.add_development_dependency '
|
|
23
|
-
s.add_development_dependency 'rake'
|
|
21
|
+
s.add_development_dependency 'ostruct'
|
|
22
|
+
s.add_development_dependency 'rake'
|
|
24
23
|
s.add_development_dependency 'rspec'
|
|
25
|
-
s.add_development_dependency '
|
|
24
|
+
s.add_development_dependency 'simplecov', '~> 0.22' if ENV['COVERAGE'] == 'true'
|
|
25
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
|
26
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
|
|
@@ -9,11 +9,14 @@ describe Mongoid::Compatibility::Version do
|
|
|
9
9
|
Mongoid::Compatibility::Version.send("mongoid#{v}?")
|
|
10
10
|
end).to be true
|
|
11
11
|
end
|
|
12
|
+
|
|
12
13
|
context "current version #{Mongoid::VERSION}" do
|
|
13
14
|
let(:version) { Mongoid::VERSION.split('.').first.to_i }
|
|
15
|
+
|
|
14
16
|
it 'mongoidX?' do
|
|
15
17
|
expect(Mongoid::Compatibility::Version.send("mongoid#{version}?")).to be true
|
|
16
18
|
end
|
|
19
|
+
|
|
17
20
|
it 'mongoidX?_or_newer?' do
|
|
18
21
|
expect(Mongoid::Compatibility::Version.send("mongoid#{version}_or_newer?")).to be true
|
|
19
22
|
if Mongoid::Compatibility::Version.respond_to?("mongoid#{version - 1}_or_newer?")
|
|
@@ -29,25 +32,31 @@ describe Mongoid::Compatibility::Version do
|
|
|
29
32
|
expect(Mongoid::Compatibility::Version.send("mongoid#{version + 1}_or_newer?")).to be false
|
|
30
33
|
end
|
|
31
34
|
end
|
|
35
|
+
|
|
32
36
|
it 'mongoidX?_or_older?' do
|
|
33
37
|
expect(Mongoid::Compatibility::Version.send("mongoid#{version}_or_older?")).to be true
|
|
34
38
|
end
|
|
35
39
|
end
|
|
40
|
+
|
|
36
41
|
(2..9).each do |v|
|
|
37
42
|
context "mongoid #{v}" do
|
|
38
43
|
before do
|
|
39
44
|
stub_const('::Mongoid::VERSION', v.to_s)
|
|
40
45
|
stub_const("::Mongoid::Compatibility::Version::ClassMethods::V#{v}", 1)
|
|
41
46
|
end
|
|
47
|
+
|
|
42
48
|
it "responds to mongoid#{v}?" do
|
|
43
49
|
expect(Mongoid::Compatibility::Version).to respond_to("mongoid#{v}?")
|
|
44
50
|
end
|
|
51
|
+
|
|
45
52
|
it "mongoid#{v}?" do
|
|
46
53
|
expect(Mongoid::Compatibility::Version.send("mongoid#{v}?")).to be true
|
|
47
54
|
end
|
|
55
|
+
|
|
48
56
|
it "mongoid#{v}_or_newer?" do
|
|
49
57
|
expect(Mongoid::Compatibility::Version.send("mongoid#{v}_or_newer?")).to be true
|
|
50
58
|
end
|
|
59
|
+
|
|
51
60
|
it "mongoid#{v}_or_older?" do
|
|
52
61
|
expect(Mongoid::Compatibility::Version.send("mongoid#{v}_or_older?")).to be true
|
|
53
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
|
|
@@ -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
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
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
|
+
|
|
3
11
|
ENV['MONGOID_ENV'] = 'test'
|
|
4
12
|
|
|
5
13
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
6
14
|
|
|
15
|
+
require 'logger'
|
|
7
16
|
require 'rubygems'
|
|
8
17
|
require 'rspec'
|
|
9
18
|
|
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.
|
|
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:
|
|
11
|
+
date: 2026-11-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -53,33 +53,33 @@ dependencies:
|
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '2.0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
56
|
+
name: ostruct
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- - "
|
|
59
|
+
- - ">="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0
|
|
61
|
+
version: '0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- - "
|
|
66
|
+
- - ">="
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0
|
|
68
|
+
version: '0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: rake
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- - "
|
|
73
|
+
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
75
|
+
version: '0'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
|
-
- - "
|
|
80
|
+
- - ">="
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
82
|
+
version: '0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: rspec
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -94,33 +94,22 @@ 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
97
|
description:
|
|
112
98
|
email: dblock@dblock.org
|
|
113
99
|
executables: []
|
|
114
100
|
extensions: []
|
|
115
101
|
extra_rdoc_files: []
|
|
116
102
|
files:
|
|
103
|
+
- ".github/workflows/danger-comment.yml"
|
|
117
104
|
- ".github/workflows/danger.yml"
|
|
118
|
-
- ".github/workflows/
|
|
105
|
+
- ".github/workflows/lint.yml"
|
|
106
|
+
- ".github/workflows/release.yml"
|
|
119
107
|
- ".github/workflows/test.yml"
|
|
120
108
|
- ".gitignore"
|
|
121
109
|
- ".rspec"
|
|
122
110
|
- ".rubocop.yml"
|
|
123
111
|
- ".rubocop_todo.yml"
|
|
112
|
+
- ".spellcheck.txt"
|
|
124
113
|
- Appraisals
|
|
125
114
|
- CHANGELOG.md
|
|
126
115
|
- CONTRIBUTING.md
|
|
@@ -147,6 +136,7 @@ files:
|
|
|
147
136
|
- lib/mongoid/compatibility/version.rb
|
|
148
137
|
- lib/mongoid_compatibility.rb
|
|
149
138
|
- mongoid-compatibility.gemspec
|
|
139
|
+
- script/release.rb
|
|
150
140
|
- spec/config/mongoid2.yml
|
|
151
141
|
- spec/config/mongoid3.yml
|
|
152
142
|
- spec/config/mongoid4.yml
|
|
@@ -158,12 +148,15 @@ files:
|
|
|
158
148
|
- spec/mongoid/compatibility/object_id_spec.rb
|
|
159
149
|
- spec/mongoid/compatibility/self_spec.rb
|
|
160
150
|
- spec/mongoid/compatibility/version_spec.rb
|
|
151
|
+
- spec/mongoid/compatibility_entry_points_spec.rb
|
|
152
|
+
- spec/release/release_spec.rb
|
|
161
153
|
- spec/spec_helper.rb
|
|
162
154
|
- spec/support/mongoid.rb
|
|
163
155
|
homepage: http://github.com/mongoid/mongoid-compatibility
|
|
164
156
|
licenses:
|
|
165
157
|
- MIT
|
|
166
|
-
metadata:
|
|
158
|
+
metadata:
|
|
159
|
+
rubygems_mfa_required: 'true'
|
|
167
160
|
post_install_message:
|
|
168
161
|
rdoc_options: []
|
|
169
162
|
require_paths:
|
|
@@ -179,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
179
172
|
- !ruby/object:Gem::Version
|
|
180
173
|
version: 1.3.6
|
|
181
174
|
requirements: []
|
|
182
|
-
rubygems_version: 3.5.
|
|
175
|
+
rubygems_version: 3.5.22
|
|
183
176
|
signing_key:
|
|
184
177
|
specification_version: 4
|
|
185
178
|
summary: Compatibility helpers for Mongoid.
|