glebtv-mongoid_nested_set 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +0 -2
- data/README.markdown +2 -3
- data/glebtv-mongoid_nested_set.gemspec +2 -1
- data/lib/mongoid_nested_set/document.rb +6 -1
- data/lib/mongoid_nested_set/version.rb +1 -1
- data/spec/mongoid.yml +5 -1
- data/spec/spec_helper.rb +3 -3
- metadata +22 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0150a61bd3085508ba1b90a5fdf1e60f7d0191bd4e2866940bca21e2941d934
|
4
|
+
data.tar.gz: 11b348f417467e3a7676e95c9952d17af654eb45754e61dadc1d316176f7c450
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acc1a4b357b3d906787b7d98fd8dbd8cd2411d500559e6bba2ada1e68960bf7649af3e635f9169b2e57a466442fdafe75a5aa9d943aad89d624b02fd1527df73
|
7
|
+
data.tar.gz: 5039c5e8d5f4998e45b268f0ca713e15cb5b59dca3bf0c8f3d9a0a326a922542a6121ed9eab35b257f1cf189b0c4f5aea66da2d9720560d78b013a3cd3bf34a9
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.3.1
|
data/Gemfile
CHANGED
data/README.markdown
CHANGED
@@ -3,11 +3,10 @@ Mongoid Nested Set
|
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/glebtv-mongoid_nested_set.png)](http://badge.fury.io/rb/glebtv-mongoid_nested_set)
|
5
5
|
[![Build Status](https://travis-ci.org/glebtv/mongoid_nested_set.png?branch=master)](https://travis-ci.org/glebtv/mongoid_nested_set)
|
6
|
-
[![Dependency Status](https://gemnasium.com/glebtv/mongoid_nested_set.png)](https://gemnasium.com/glebtv/mongoid_nested_set)
|
7
6
|
|
8
7
|
Mongoid Nested Set is an implementation of the nested set pattern for Mongoid.
|
9
8
|
It is a port of [AwesomeNestedSet for ActiveRecord](https://github.com/galetahub/awesome_nested_set).
|
10
|
-
It supports Mongoid
|
9
|
+
It supports Mongoid 4+ and Rails 4+
|
11
10
|
|
12
11
|
Nested Set represents hierarchies of trees in MongoDB using references rather
|
13
12
|
than embedded documents. A tree is stored as a flat list of documents in a
|
@@ -26,7 +25,7 @@ Install as Gem
|
|
26
25
|
|
27
26
|
via Gemfile
|
28
27
|
|
29
|
-
gem 'glebtv-mongoid_nested_set', '~> 0.
|
28
|
+
gem 'glebtv-mongoid_nested_set', '~> 0.7.0'
|
30
29
|
|
31
30
|
|
32
31
|
## Usage
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_runtime_dependency 'mongoid', [">= 6.0", "<
|
22
|
+
s.add_runtime_dependency 'mongoid', [">= 6.0", "< 9.0"]
|
23
23
|
|
24
24
|
s.add_development_dependency 'rake'
|
25
25
|
s.add_development_dependency 'rspec'
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_development_dependency 'simplecov'
|
28
28
|
s.add_development_dependency 'simplecov-rcov'
|
29
29
|
s.add_development_dependency 'database_cleaner'
|
30
|
+
s.add_development_dependency 'database_cleaner-mongoid'
|
30
31
|
s.add_development_dependency 'rspec-expectations'
|
31
32
|
s.add_development_dependency 'mongoid-rspec'
|
32
33
|
end
|
@@ -220,7 +220,12 @@ module Mongoid::Acts::NestedSet
|
|
220
220
|
conditions = scopes.inject({}) do |conditions,attr|
|
221
221
|
conditions.merge attr => self[attr]
|
222
222
|
end unless scopes.empty?
|
223
|
-
|
223
|
+
|
224
|
+
if conditions.nil?
|
225
|
+
scope_class.criteria.asc(left_field_name)
|
226
|
+
else
|
227
|
+
scope_class.criteria.where(conditions).asc(left_field_name)
|
228
|
+
end
|
224
229
|
end
|
225
230
|
|
226
231
|
|
data/spec/mongoid.yml
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -2,6 +2,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
require 'rspec'
|
4
4
|
require 'database_cleaner'
|
5
|
+
require 'database_cleaner-mongoid'
|
5
6
|
require 'active_support'
|
6
7
|
require 'active_support/deprecation'
|
7
8
|
require 'mongoid'
|
@@ -36,12 +37,11 @@ RSpec.configure do |config|
|
|
36
37
|
#config.expect_with(:rspec) { |c| c.syntax = :should }
|
37
38
|
|
38
39
|
config.before(:suite) do
|
39
|
-
DatabaseCleaner[:mongoid
|
40
|
-
DatabaseCleaner[:mongoid].strategy = :truncation
|
40
|
+
DatabaseCleaner[:mongoid].strategy = :deletion
|
41
41
|
end
|
42
42
|
|
43
43
|
config.before(:each) do
|
44
|
-
DatabaseCleaner.clean
|
44
|
+
DatabaseCleaner[:mongoid].clean
|
45
45
|
end
|
46
46
|
|
47
47
|
config.include(Mongoid::Acts::NestedSet::Matchers)
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glebtv-mongoid_nested_set
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GlebTV
|
8
8
|
- Brandon Turner
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-04-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '6.0'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '9.0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: '6.0'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '9.0'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rake
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,6 +115,20 @@ dependencies:
|
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: database_cleaner-mongoid
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
type: :development
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
118
132
|
- !ruby/object:Gem::Dependency
|
119
133
|
name: rspec-expectations
|
120
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,7 +208,7 @@ homepage: http://github.com/glebtv/mongoid_nested_set
|
|
194
208
|
licenses:
|
195
209
|
- MIT
|
196
210
|
metadata: {}
|
197
|
-
post_install_message:
|
211
|
+
post_install_message:
|
198
212
|
rdoc_options: []
|
199
213
|
require_paths:
|
200
214
|
- lib
|
@@ -209,9 +223,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
223
|
- !ruby/object:Gem::Version
|
210
224
|
version: '0'
|
211
225
|
requirements: []
|
212
|
-
|
213
|
-
|
214
|
-
signing_key:
|
226
|
+
rubygems_version: 3.5.9
|
227
|
+
signing_key:
|
215
228
|
specification_version: 4
|
216
229
|
summary: Nested set based tree implementation for Mongoid
|
217
230
|
test_files:
|