mongoid_orderable 5.1.0 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +22 -7
- data/CHANGELOG.md +5 -0
- data/Gemfile +5 -1
- data/LICENSE.txt +1 -1
- data/README.md +1 -2
- data/lib/mongoid_orderable.rb +8 -0
- data/lib/mongoid_orderable/version.rb +1 -1
- data/spec/mongoid/orderable_spec.rb +25 -6
- data/spec/spec_helper.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb9edcb0b7e48f8910b7a098a650b2908e1ba5cf
|
4
|
+
data.tar.gz: c4ffa043177aa71c23f565d9e9d0765f94b4409c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 195681bcfce24cde2af7ebfb9b9ed74a36688ce24ec8acf59bc8f1b94c3ea81d3e252f1a20f67e4c554818c03739da3b84639026f5a80cb259575d7a2686f331
|
7
|
+
data.tar.gz: 51d3bb674839997759c72ef9aa88335900ff6e6f5859fd8809c5e81a14f733c18df29191485ff81257fbe5b16c693985fd60b75f0c4a3166f4e48c219067f258
|
data/.travis.yml
CHANGED
@@ -7,20 +7,21 @@ cache: bundler
|
|
7
7
|
services: mongodb
|
8
8
|
|
9
9
|
rvm:
|
10
|
-
- 2.
|
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
|
data/CHANGELOG.md
CHANGED
@@ -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'] || '
|
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/
|
data/LICENSE.txt
CHANGED
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
|
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?
|
data/lib/mongoid_orderable.rb
CHANGED
@@ -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)
|
@@ -20,7 +20,11 @@ describe Mongoid::Orderable do
|
|
20
20
|
include Mongoid::Orderable
|
21
21
|
|
22
22
|
field :group_id
|
23
|
-
|
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
|
-
|
91
|
-
|
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
|
-
|
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
|
-
|
114
|
-
|
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
|
data/spec/spec_helper.rb
CHANGED
@@ -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.
|
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.
|
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:
|
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.
|
132
|
+
rubygems_version: 2.6.13
|
133
133
|
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: Acts as list mongoid implementation
|