mongoid-compatibility 0.4.1 → 0.6.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
- SHA1:
3
- metadata.gz: 88dc135cf15e9485c44ceccde2ec8b25a73184a8
4
- data.tar.gz: 739ea9e74d17368c4a49083adac7fec708cc49b4
2
+ SHA256:
3
+ metadata.gz: 67f56f2a4f261301d9ce8856177e0dc45dd0f490fffe58842cc65814cbc039b8
4
+ data.tar.gz: 603268d9a0f89b086f0d239d75289edfdb0948a653050e54e8c6811e97992628
5
5
  SHA512:
6
- metadata.gz: 9b87667aee1355d87b5262e8efd5bbb53b1ff06ab11e3dedc30d0fff65cacb9577b4b4d7b4ac61eccb7d1b460c7eca504ace2fc41030f8a0bb756c7a5f930faf
7
- data.tar.gz: 39257d4303caa776fac3580b317946f9cc74679554a4b6cf756410029204b73dfc3368a93d47f718606f61c9feb7d7a89b7997da31e8b4bf834ea58c630d272e
6
+ metadata.gz: 91fd9d67679f2c7226dbde61790bb17640c0e8a2292f42251fadc0a507b1e96212c112dd8cbd1c23606a4316dd79d761a3e47205092dc1e3b49281f7244b88fc
7
+ data.tar.gz: 9c0ce0c31f6191162ce82cbb7685aa288015f9fb25aa48b0546761f4160d9dcb92563791711ad3559eae126bf0e93a302235b9b1730b4103126bc74d8e9b9056
@@ -0,0 +1,19 @@
1
+ name: PR Linter
2
+ on: [pull_request]
3
+ jobs:
4
+ 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
@@ -0,0 +1,13 @@
1
+ name: Rubocop
2
+ on: [push, pull_request]
3
+ jobs:
4
+ lint:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v2
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
@@ -0,0 +1,80 @@
1
+ name: CI RSpec Test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ name: >-
8
+ Mongoid ${{ matrix.entry.mongoid }} - Ruby ${{ matrix.entry.ruby }} - MongoDB ${{ matrix.entry.mongodb }}
9
+ env:
10
+ CI: true
11
+ TESTOPTS: -v
12
+ runs-on: ubuntu-latest
13
+ continue-on-error: false
14
+ strategy:
15
+ matrix:
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" }
54
+ steps:
55
+ - name: repo checkout
56
+ uses: actions/checkout@v2
57
+
58
+ - name: start mongodb
59
+ uses: supercharge/mongodb-github-action@1.6.0
60
+ with:
61
+ mongodb-version: ${{ matrix.entry.mongodb }}
62
+ mongodb-replica-set: rs0
63
+
64
+ - name: load ruby
65
+ uses: ruby/setup-ruby@v1
66
+ with:
67
+ 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 }}
data/.rubocop_todo.yml CHANGED
@@ -1,17 +1,17 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2015-09-25 07:58:30 -0400 using RuboCop version 0.33.0.
3
+ # on 2017-09-13 14:18:39 -0400 using RuboCop version 0.33.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: 4
9
+ # Offense count: 20
10
10
  # Configuration parameters: AllowURI, URISchemes.
11
11
  Metrics/LineLength:
12
12
  Max: 118
13
13
 
14
- # Offense count: 3
14
+ # Offense count: 4
15
15
  Style/Documentation:
16
16
  Exclude:
17
17
  - 'lib/mongoid/compatibility/object_id.rb'
data/.travis.yml CHANGED
@@ -6,6 +6,9 @@ matrix:
6
6
  - rvm: 2.3.1
7
7
  script:
8
8
  - bundle exec danger
9
+ - rvm: 2.4.0
10
+ env:
11
+ - MONGOID_VERSION=7
9
12
  - rvm: 2.4.0
10
13
  env:
11
14
  - MONGOID_VERSION=6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ### 0.6.0 (2022/08/18)
2
+
3
+ * [#13](https://github.com/mongoid/mongoid-compatibility/pull/13): Compatibility with Mongoid 8.x - [@joe1chen](https://github.com/joe1chen).
4
+ * [#15](https://github.com/mongoid/mongoid-compatibility/pull/15): Upgraded to mongoid-danger 0.2.0 - [@dblock](https://github.com/dblock).
5
+
6
+ ### 0.5.1 (2017/12/02)
7
+
8
+ * [#8](https://github.com/mongoid/mongoid-compatibility/issues/8): Added `mongoidX_or_newer?` and `mongoidX_or_older?` helpers - [@dblock](https://github.com/dblock).
9
+
10
+ ### 0.5.0 (2017/09/13)
11
+
12
+ * [#10](https://github.com/mongoid/mongoid-compatibility/pull/10): Compatibility with Mongoid 7.x - [@joeyAghion](https://github.com/joeyAghion).
13
+
1
14
  ### 0.4.1 (2017/01/19)
2
15
 
3
16
  * [#5](https://github.com/mongoid/mongoid-compatibility/pull/5): Compatibility with Ruby 2.4.0 and Mongoid 6.0 - [@moodlemags](https://github.com/moodlemags).
data/Gemfile CHANGED
@@ -2,9 +2,13 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- case version = ENV['MONGOID_VERSION'] || '6.0'
5
+ case version = ENV['MONGOID_VERSION'] || '8.0.2'
6
6
  when 'HEAD'
7
7
  gem 'mongoid', github: 'mongodb/mongoid'
8
+ when /^8/
9
+ gem 'mongoid', '~> 8.0'
10
+ when /^7/
11
+ gem 'mongoid', '~> 7.0'
8
12
  when /^6/
9
13
  gem 'mongoid', '~> 6.0'
10
14
  when /^5/
@@ -22,7 +26,6 @@ end
22
26
 
23
27
  group :test do
24
28
  gem 'rspec'
25
- gem 'mongoid-danger', '~> 0.1.1', require: false
26
29
  end
27
30
 
28
31
  group :development do
data/Gemfile.danger ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :test do
4
+ gem 'mongoid-danger', '~> 0.2.0', require: false
5
+ end
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2015 Daniel Doubrovkine, Artsy and Contributors
3
+ Copyright (c) 2015-2017 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,11 +2,10 @@ 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](http://img.shields.io/travis/mongoid/mongoid-compatibility.svg)](https://travis-ci.org/mongoid/mongoid-compatibility)
6
- [![Dependency Status](https://gemnasium.com/mongoid/mongoid-compatibility.svg)](https://gemnasium.com/mongoid/mongoid-compatibility)
5
+ [![Build Status](https://github.com/mongoid/mongoid-compatibility/actions/workflows/test.yml/badge.svg)](https://github.com/mongoid/mongoid-compatibility/actions)
7
6
  [![Code Climate](https://codeclimate.com/github/mongoid/mongoid-compatibility.svg)](https://codeclimate.com/github/mongoid/mongoid-compatibility)
8
7
 
9
- Compatibility helpers for Mongoid versions 2, 3, 4, and 5, and the **prerelease** version 6.
8
+ Compatibility helpers for Mongoid versions 2, 3, 4, 5, 6, 7, and 8.
10
9
 
11
10
  ### Install
12
11
 
@@ -22,7 +21,7 @@ You may explicitly need to `require mongoid/compatibility`.
22
21
 
23
22
  #### Mongoid::Compatibility::Version
24
23
 
25
- ```
24
+ ``` ruby
26
25
  Mongoid::Compatibility::Version.mongoid2?
27
26
  # => is this Mongoid 2.x?
28
27
 
@@ -37,11 +36,27 @@ Mongoid::Compatibility::Version.mongoid5?
37
36
 
38
37
  Mongoid::Compatibility::Version.mongoid6?
39
38
  # => is this Mongoid 6.x?
39
+
40
+ Mongoid::Compatibility::Version.mongoid7?
41
+ # => is this Mongoid 7.x?
42
+
43
+ Mongoid::Compatibility::Version.mongoid8?
44
+ # => is this Mongoid 8.x?
40
45
  ```
41
46
 
42
- #### Mongoid::Compatibility::ObjectId
47
+ Instead of checking for Mongoid 6 and 7 and 8, use `newer` and `older` helpers.
48
+
49
+ ``` ruby
50
+ Mongoid::Compatibility::Version.mongoid6_or_newer?
51
+ # => is this Mongoid 6.x or 7.x or 8.x, including beta 8?
43
52
 
53
+ Mongoid::Compatibility::Version.mongoid5_or_older?
54
+ # => is this Mongoid 2.x, 3.x, 4.x or 5.x?
44
55
  ```
56
+
57
+ #### Mongoid::Compatibility::ObjectId
58
+
59
+ ``` ruby
45
60
  Mongoid::Compatibility::ObjectId.legal?('4e4d66343b39b68407000001')
46
61
  # => is this a valid BSON ID?
47
62
  ```
@@ -52,6 +67,6 @@ See [CONTRIBUTING](CONTRIBUTING.md).
52
67
 
53
68
  ### Copyright and License
54
69
 
55
- Copyright Daniel Doubrovkine and Contributors, Artsy Inc., 2015
70
+ Copyright Daniel Doubrovkine and Contributors, Artsy Inc., 2015-2017
56
71
 
57
72
  [MIT License](LICENSE.md)
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Compatibility
3
- VERSION = '0.4.1'.freeze
3
+ VERSION = '0.6.0'.freeze
4
4
  end
5
5
  end
@@ -2,12 +2,20 @@ module Mongoid
2
2
  module Compatibility
3
3
  module Version
4
4
  module ClassMethods
5
- (2..6).each do |v|
5
+ (2..8).each do |v|
6
6
  const_set "V#{v}", Mongoid::VERSION =~ Regexp.new("^#{v}\.")
7
7
 
8
8
  define_method "mongoid#{v}?" do
9
9
  !!Mongoid::Compatibility::Version::ClassMethods.const_get("V#{v}")
10
10
  end
11
+
12
+ define_method "mongoid#{v}_or_newer?" do
13
+ Gem::Version.new(Mongoid::VERSION).segments.first >= v
14
+ end
15
+
16
+ define_method "mongoid#{v}_or_older?" do
17
+ Gem::Version.new(Mongoid::VERSION).segments.first <= v
18
+ end
11
19
  end
12
20
  end
13
21
 
@@ -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
@@ -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
@@ -3,20 +3,52 @@ require 'spec_helper'
3
3
  describe Mongoid::Compatibility::Version do
4
4
  context 'mongoid? methods' do
5
5
  it 'only true for one version' do
6
- expect(
7
- (Mongoid::Compatibility::Version.methods - Object.methods).one? do |m|
8
- Mongoid::Compatibility::Version.send(m)
9
- end
10
- ).to be true
6
+ expect((2..8).one? do |v|
7
+ Mongoid::Compatibility::Version.send("mongoid#{v}?")
8
+ end).to be true
11
9
  end
12
- it 'defines version methods' do
13
- expect(Mongoid::Compatibility::Version.methods - Object.methods).to_not eq []
10
+ context "current version #{Mongoid::VERSION}" do
11
+ let(:version) { Mongoid::VERSION.split('.').first.to_i }
12
+ it 'mongoidX?' do
13
+ expect(Mongoid::Compatibility::Version.send("mongoid#{version}?")).to be true
14
+ end
15
+ it 'mongoidX?_or_newer?' do
16
+ expect(Mongoid::Compatibility::Version.send("mongoid#{version}_or_newer?")).to be true
17
+ if Mongoid::Compatibility::Version.respond_to?("mongoid#{version - 1}_or_newer?")
18
+ expect(Mongoid::Compatibility::Version.send("mongoid#{version - 1}_or_newer?")).to be true
19
+ end
20
+ if Mongoid::Compatibility::Version.respond_to?("mongoid#{version - 1}_or_older?")
21
+ expect(Mongoid::Compatibility::Version.send("mongoid#{version - 1}_or_older?")).to be false
22
+ end
23
+ if Mongoid::Compatibility::Version.respond_to?("mongoid#{version + 1}_or_older?")
24
+ expect(Mongoid::Compatibility::Version.send("mongoid#{version + 1}_or_older?")).to be true
25
+ end
26
+ if Mongoid::Compatibility::Version.respond_to?("mongoid#{version + 1}_or_newer?")
27
+ expect(Mongoid::Compatibility::Version.send("mongoid#{version + 1}_or_newer?")).to be false
28
+ end
29
+ end
30
+ it 'mongoidX?_or_older?' do
31
+ expect(Mongoid::Compatibility::Version.send("mongoid#{version}_or_older?")).to be true
32
+ end
14
33
  end
15
- (2..6).each do |v|
34
+ (2..8).each do |v|
16
35
  context "mongoid #{v}" do
36
+ before do
37
+ stub_const('::Mongoid::VERSION', "#{v}")
38
+ stub_const("::Mongoid::Compatibility::Version::ClassMethods::V#{v}", 1)
39
+ end
17
40
  it "responds to mongoid#{v}?" do
18
41
  expect(Mongoid::Compatibility::Version).to respond_to("mongoid#{v}?")
19
42
  end
43
+ it "mongoid#{v}?" do
44
+ expect(Mongoid::Compatibility::Version.send("mongoid#{v}?")).to be true
45
+ end
46
+ it "mongoid#{v}_or_newer?" do
47
+ expect(Mongoid::Compatibility::Version.send("mongoid#{v}_or_newer?")).to be true
48
+ end
49
+ it "mongoid#{v}_or_older?" do
50
+ expect(Mongoid::Compatibility::Version.send("mongoid#{v}_or_older?")).to be true
51
+ end
20
52
  end
21
53
  end
22
54
  end
@@ -10,6 +10,10 @@ elsif Mongoid::Compatibility::Version.mongoid5?
10
10
  Mongoid.load! 'spec/config/mongoid5.yml'
11
11
  elsif Mongoid::Compatibility::Version.mongoid6?
12
12
  Mongoid.load! 'spec/config/mongoid6.yml'
13
+ elsif Mongoid::Compatibility::Version.mongoid7?
14
+ Mongoid.load! 'spec/config/mongoid7.yml'
15
+ elsif Mongoid::Compatibility::Version.mongoid8?
16
+ Mongoid.load! 'spec/config/mongoid8.yml'
13
17
  else
14
18
  fail "unsupported Mongoid version #{Mongoid::VERSION}"
15
19
  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: 0.4.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-19 00:00:00.000000000 Z
11
+ date: 2022-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -38,12 +38,15 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description:
41
+ description:
42
42
  email: dblock@dblock.org
43
43
  executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
+ - ".github/workflows/danger.yml"
48
+ - ".github/workflows/rubocop.yml"
49
+ - ".github/workflows/test.yml"
47
50
  - ".gitignore"
48
51
  - ".rspec"
49
52
  - ".rubocop.yml"
@@ -53,6 +56,7 @@ files:
53
56
  - CONTRIBUTING.md
54
57
  - Dangerfile
55
58
  - Gemfile
59
+ - Gemfile.danger
56
60
  - LICENSE.md
57
61
  - README.md
58
62
  - RELEASING.md
@@ -69,6 +73,8 @@ files:
69
73
  - spec/config/mongoid4.yml
70
74
  - spec/config/mongoid5.yml
71
75
  - spec/config/mongoid6.yml
76
+ - spec/config/mongoid7.yml
77
+ - spec/config/mongoid8.yml
72
78
  - spec/mongoid/compatibility/object_id_spec.rb
73
79
  - spec/mongoid/compatibility/self_spec.rb
74
80
  - spec/mongoid/compatibility/version_spec.rb
@@ -78,7 +84,7 @@ homepage: http://github.com/mongoid/mongoid-compatibility
78
84
  licenses:
79
85
  - MIT
80
86
  metadata: {}
81
- post_install_message:
87
+ post_install_message:
82
88
  rdoc_options: []
83
89
  require_paths:
84
90
  - lib
@@ -93,9 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
99
  - !ruby/object:Gem::Version
94
100
  version: 1.3.6
95
101
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.6.8
98
- signing_key:
102
+ rubygems_version: 3.1.3
103
+ signing_key:
99
104
  specification_version: 4
100
105
  summary: Compatibility helpers for Mongoid.
101
106
  test_files: []