mongoid_orderable 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7eaa2e05f5a3531b345dde5acd84bba859f71cc0
4
- data.tar.gz: 8cbe732f1b5b60e66d9dad58a904e0157f8ef987
3
+ metadata.gz: eb9edcb0b7e48f8910b7a098a650b2908e1ba5cf
4
+ data.tar.gz: c4ffa043177aa71c23f565d9e9d0765f94b4409c
5
5
  SHA512:
6
- metadata.gz: 874989f19ae666bf7777379f45640686f457b101b5e04fdded8867c3403f7de79383b30448df6fdcbab491f0640dd5a73eb03e9a503568205a3bd4b00b050f3a
7
- data.tar.gz: bacd372ac1644e959e668e1064fa771a3cae60c427c67f217ece8fdf5408cbc5d1d0ad97745e06905237deba44e30eb843c42527017f527a36cbd5ef3b0b5a9f
6
+ metadata.gz: 195681bcfce24cde2af7ebfb9b9ed74a36688ce24ec8acf59bc8f1b94c3ea81d3e252f1a20f67e4c554818c03739da3b84639026f5a80cb259575d7a2686f331
7
+ data.tar.gz: 51d3bb674839997759c72ef9aa88335900ff6e6f5859fd8809c5e81a14f733c18df29191485ff81257fbe5b16c693985fd60b75f0c4a3166f4e48c219067f258
@@ -7,20 +7,21 @@ cache: bundler
7
7
  services: mongodb
8
8
 
9
9
  rvm:
10
- - 2.3.1
10
+ - 2.1.10
11
+ - 2.3.6
12
+ - 2.5.0
11
13
 
12
14
  env:
13
- - MONGOID_VERSION=3
14
- - MONGOID_VERSION=4
15
- - MONGOID_VERSION=5
16
15
  - MONGOID_VERSION=HEAD
16
+ - MONGOID_VERSION=7
17
+ - MONGOID_VERSION=6
18
+ - MONGOID_VERSION=5
19
+ - MONGOID_VERSION=4
20
+ - MONGOID_VERSION=3
17
21
 
18
22
  before_install:
19
23
  - gem update bundler
20
24
 
21
- before_script:
22
- - bundle exec danger
23
-
24
25
  addons:
25
26
  apt:
26
27
  sources:
@@ -29,5 +30,19 @@ addons:
29
30
  - mongodb-org-server
30
31
 
31
32
  matrix:
33
+ fast_finish: true
32
34
  allow_failures:
33
35
  - env: MONGOID_VERSION=HEAD
36
+ exclude:
37
+ - env: MONGOID_VERSION=HEAD
38
+ rvm: 2.1.10
39
+ - env: MONGOID_VERSION=7
40
+ rvm: 2.1.10
41
+ - env: MONGOID_VERSION=6
42
+ rvm: 2.1.10
43
+ - env: MONGOID_VERSION=5
44
+ rvm: 2.1.10
45
+ include:
46
+ - env: MONGOID_VERSION=6
47
+ rvm: 2.3.6
48
+ before_script: bundle exec danger
@@ -1,3 +1,8 @@
1
+ ### 5.2.0 (2018/05/01)
2
+
3
+ * [#57](https://github.com/mongoid/mongoid_orderable/pull/57): Compatibility with Mongoid 7 - [@tomasc](https://github.com/tomasc).
4
+ * [#52](https://github.com/mongoid/mongoid_orderable/pull/52): Test against Mongoid 6 - [@dblock](https://github.com/dblock).
5
+
1
6
  ### 5.1.0 (2017/06/04)
2
7
 
3
8
  * [#50](https://github.com/mongoid/mongoid_orderable/pull/50): Added Danger, PR linter - [@dblock](https://github.com/dblock).
data/Gemfile CHANGED
@@ -3,9 +3,13 @@ source 'http://rubygems.org'
3
3
  # Specify your gem's dependencies in mongoid_orderable.gemspec
4
4
  gemspec
5
5
 
6
- case version = ENV['MONGOID_VERSION'] || '5.0'
6
+ case version = ENV['MONGOID_VERSION'] || '7'
7
7
  when 'HEAD'
8
8
  gem 'mongoid', github: 'mongodb/mongoid'
9
+ when /^7/
10
+ gem 'mongoid', '~> 7.0'
11
+ when /^6/
12
+ gem 'mongoid', '~> 6.0'
9
13
  when /^5/
10
14
  gem 'mongoid', '~> 5.0'
11
15
  when /^4/
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2016 Arkadiy Zabazhanov & Contributors
1
+ Copyright (c) 2011-2017 Arkadiy Zabazhanov & Contributors
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -3,14 +3,13 @@
3
3
 
4
4
  # What?
5
5
 
6
- Mongoid::Orderable is a ordered list implementation for your Mongoid 2, 3, 4 and 5 models.
6
+ Mongoid::Orderable is a ordered list implementation for your Mongoid 3, 4, 5, 6 and 7 models.
7
7
 
8
8
  # Why?
9
9
 
10
10
  * It uses native mongo batch increment feature
11
11
  * It supports mutators api
12
12
  * It correctly assigns the position while moving document between scopes
13
- * It supports mongoid 2, 3 and 4
14
13
  * It supports specifying multiple orderable columns
15
14
 
16
15
  # How?
@@ -15,6 +15,14 @@ module MongoidOrderable
15
15
  def self.metadata(instance)
16
16
  instance.metadata
17
17
  end
18
+ elsif ::Mongoid::Compatibility::Version.mongoid7?
19
+ def self.inc(instance, attribute, value)
20
+ instance.inc(attribute => value)
21
+ end
22
+
23
+ def self.metadata(instance)
24
+ instance._association
25
+ end
18
26
  else
19
27
  def self.inc(instance, attribute, value)
20
28
  instance.inc(attribute => value)
@@ -1,3 +1,3 @@
1
1
  module MongoidOrderable
2
- VERSION = '5.1.0'.freeze
2
+ VERSION = '5.2.0'.freeze
3
3
  end
@@ -20,7 +20,11 @@ describe Mongoid::Orderable do
20
20
  include Mongoid::Orderable
21
21
 
22
22
  field :group_id
23
- belongs_to :scoped_group
23
+ if ::Mongoid::Compatibility::Version.mongoid7?
24
+ belongs_to :scoped_group, optional: true
25
+ else
26
+ belongs_to :scoped_group
27
+ end
24
28
 
25
29
  orderable scope: :group
26
30
  end
@@ -87,8 +91,14 @@ describe Mongoid::Orderable do
87
91
  include Mongoid::Document
88
92
  include Mongoid::Orderable
89
93
 
90
- belongs_to :different_scope, class_name: 'ForeignKeyDiffersOrderable',
91
- foreign_key: 'different_orderable_id'
94
+ if ::Mongoid::Compatibility::Version.mongoid7?
95
+ belongs_to :different_scope, class_name: 'ForeignKeyDiffersOrderable',
96
+ foreign_key: 'different_orderable_id',
97
+ optional: true
98
+ else
99
+ belongs_to :different_scope, class_name: 'ForeignKeyDiffersOrderable',
100
+ foreign_key: 'different_orderable_id'
101
+ end
92
102
 
93
103
  orderable scope: :different_scope
94
104
  end
@@ -99,7 +109,11 @@ describe Mongoid::Orderable do
99
109
 
100
110
  field :group_id
101
111
 
102
- belongs_to :scoped_group
112
+ if ::Mongoid::Compatibility::Version.mongoid7?
113
+ belongs_to :scoped_group, optional: true
114
+ else
115
+ belongs_to :scoped_group
116
+ end
103
117
 
104
118
  orderable column: :pos, base: 0, index: false, as: :position
105
119
  orderable column: :serial_no, default: true
@@ -110,8 +124,13 @@ describe Mongoid::Orderable do
110
124
  include Mongoid::Document
111
125
  include Mongoid::Orderable
112
126
 
113
- belongs_to :apple
114
- belongs_to :orange
127
+ if ::Mongoid::Compatibility::Version.mongoid7?
128
+ belongs_to :apple, optional: true
129
+ belongs_to :orange, optional: true
130
+ else
131
+ belongs_to :apple
132
+ belongs_to :orange
133
+ end
115
134
 
116
135
  orderable column: :posa, scope: :apple_id
117
136
  orderable column: :poso, scope: :orange_id
@@ -6,7 +6,9 @@ Mongoid.configure do |config|
6
6
  end
7
7
 
8
8
  Mongoid.logger.level = Logger::INFO
9
- Mongo::Logger.logger.level = Logger::INFO if Mongoid::Compatibility::Version.mongoid5?
9
+ Mongo::Logger.logger.level = Logger::INFO if Mongoid::Compatibility::Version.mongoid5_or_newer?
10
+
11
+ Mongoid::Config.belongs_to_required_by_default = false if Mongoid::Compatibility::Version.mongoid6?
10
12
 
11
13
  RSpec.configure do |config|
12
14
  config.after(:all) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_orderable
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyromaniac
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-04 00:00:00.000000000 Z
11
+ date: 2018-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project: mongoid_orderable
132
- rubygems_version: 2.6.12
132
+ rubygems_version: 2.6.13
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Acts as list mongoid implementation