mongoid-tree 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fdc505bb8df0d134efa3f5f4d3afca14603a44cd
4
- data.tar.gz: 2615195789c03a83ffe7cce55218ac0c9e8ff5e3
2
+ SHA256:
3
+ metadata.gz: 95f09f86db1baaf40ff2ccc51870dac22ce57cc4d46e6ba432cfca2d8da1ee72
4
+ data.tar.gz: 7363956d97733f02f4d2b06058112d8e0c4a32da4ac238902886ca1308d7782a
5
5
  SHA512:
6
- metadata.gz: 8cd3e9933fa16933ba6044826fe5bd935b4d2f93f4580c5bf63ebf2d6480a0941dedeb48b3b06118b2827e87564020760d4b6421fcb87b760846d69296b3078b
7
- data.tar.gz: 4a3609b0eb8e493952f3cf3bc222fc217a14f2a06cee2dae34f128fec7f4438a8f9ab30370cea2fbf6f146d2ff98c607e1b0afc15b70f32950aeef9ad7e27eaa
6
+ metadata.gz: 45489275101e16064a9ee2e95c60ee9127721c623fe9a23b948ef78901517b8e3c2aac7b85972bacb824e7340312771e8f2b7b2abbffc9e0aff320e2e6c27e51
7
+ data.tar.gz: 37aa5b0f41b6a2fbfbc04caf8ff684c86f1d42fefdd244fc2f82d72f31c6ace7718d1b3727141efdddfe213bab6124945e2eedb7923c10e1474d4f4029ff514c
data/Gemfile CHANGED
@@ -2,9 +2,20 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'guard-rspec', '>= 0.6.0'
6
- gem 'ruby_gntp', '>= 0.3.4'
7
- gem 'rb-fsevent' if RUBY_PLATFORM =~ /darwin/
5
+ case version = ENV['MONGOID_VERSION'] || '~> 7.0'
6
+ when 'HEAD' then gem 'mongoid', github: 'mongodb/mongoid'
7
+ when /7/ then gem 'mongoid', '~> 7.0'
8
+ when /6/ then gem 'mongoid', '~> 6.0'
9
+ when /5/ then gem 'mongoid', '~> 5.0'
10
+ when /4/ then gem 'mongoid', '~> 4.0'
11
+ else gem 'mongoid', version
12
+ end
13
+
14
+ unless ENV['CI']
15
+ gem 'guard-rspec', '>= 0.6.0'
16
+ gem 'ruby_gntp', '>= 0.3.4'
17
+ gem 'rb-fsevent' if RUBY_PLATFORM =~ /darwin/
18
+ end
8
19
 
9
20
  platforms :rbx do
10
21
  gem 'rubysl-rake', '~> 2.0'
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # mongoid-tree [![Build Status](https://secure.travis-ci.org/benedikt/mongoid-tree.png?branch=master)](http://travis-ci.org/benedikt/mongoid-tree) [![Dependency Status](https://gemnasium.com/benedikt/mongoid-tree.png)](http://gemnasium.com/benedikt/mongoid-tree)
1
+ # mongoid-tree [![Build Status](https://secure.travis-ci.org/benedikt/mongoid-tree.svg?branch=master)](http://travis-ci.org/benedikt/mongoid-tree) [![Dependency Status](https://gemnasium.com/benedikt/mongoid-tree.svg)](http://gemnasium.com/benedikt/mongoid-tree)
2
2
 
3
3
  A tree structure for Mongoid documents using the materialized path pattern
4
4
 
data/Rakefile CHANGED
@@ -1,25 +1,14 @@
1
+ require 'bundler/gem_tasks'
1
2
  require 'rspec/core/rake_task'
2
3
  require 'yard'
3
4
 
4
- spec = Gem::Specification.load("mongoid-tree.gemspec")
5
-
6
5
  RSpec::Core::RakeTask.new(:spec)
7
6
 
8
7
  task :default => :spec
9
8
 
10
9
  YARD::Rake::YardocTask.new(:doc)
11
10
 
12
- desc "Build the .gem file"
13
- task :build do
14
- system "gem build #{spec.name}.gemspec"
15
- end
16
-
17
- desc "Push the .gem file to rubygems.org"
18
- task :release => :build do
19
- system "gem push #{spec.name}-#{spec.version}.gem"
20
- end
21
-
22
11
  desc "Open an irb session"
23
12
  task :console do
24
13
  sh "irb -rubygems -I lib -r ./spec/spec_helper.rb"
25
- end
14
+ end
@@ -15,7 +15,7 @@ describe Mongoid::Tree::Traversal do
15
15
  end
16
16
 
17
17
  it "should complain about unsupported traversal methods" do
18
- expect { subject.traverse('non_existing') {} }.to raise_error
18
+ expect { subject.traverse('non_existing') {} }.to raise_error NoMethodError
19
19
  end
20
20
 
21
21
  it "should default to depth_first traversal" do
@@ -7,7 +7,11 @@ describe Mongoid::Tree do
7
7
  it "should reference many children as inverse of parent with index" do
8
8
  a = Node.reflect_on_association(:children)
9
9
  expect(a).to be
10
- expect(a.macro).to eq(:has_many)
10
+ if Mongoid::Compatibility::Version.mongoid7?
11
+ expect(a).to be_kind_of(Mongoid::Association::Referenced::HasMany)
12
+ else
13
+ expect(a.macro).to eq(:has_many)
14
+ end
11
15
  expect(a.class_name).to eq('Node')
12
16
  expect(a.foreign_key).to eq('parent_id')
13
17
  expect(Node.index_specification(:parent_id => 1)).to be
@@ -16,7 +20,11 @@ describe Mongoid::Tree do
16
20
  it "should be referenced in one parent as inverse of children" do
17
21
  a = Node.reflect_on_association(:parent)
18
22
  expect(a).to be
19
- expect(a.macro).to eq(:belongs_to)
23
+ if Mongoid::Compatibility::Version.mongoid7?
24
+ expect(a).to be_kind_of(Mongoid::Association::Referenced::BelongsTo)
25
+ else
26
+ expect(a.macro).to eq(:belongs_to)
27
+ end
20
28
  expect(a.class_name).to eq('Node')
21
29
  expect(a.inverse_of).to eq(:children)
22
30
  end
@@ -3,6 +3,7 @@ require 'bundler/setup'
3
3
 
4
4
  require 'mongoid'
5
5
  require 'mongoid/tree'
6
+ require 'mongoid-compatibility'
6
7
 
7
8
  require 'rspec'
8
9
 
@@ -0,0 +1,9 @@
1
+ FileUtils.mkdir_p File.expand_path('../../../log', __FILE__)
2
+
3
+ logger = Logger.new('log/mongoid.log')
4
+
5
+ if Mongoid::Compatibility::Version.mongoid5_or_newer?
6
+ Mongoid.logger = Mongo::Logger.logger = logger
7
+ else
8
+ Mongoid.logger = logger
9
+ end
metadata CHANGED
@@ -1,35 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benedikt Deicke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-21 00:00:00.000000000 Z
11
+ date: 2018-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
18
- - !ruby/object:Gem::Version
19
- version: '7.0'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: '4.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '8'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '4.0'
27
30
  - - "<"
28
31
  - !ruby/object:Gem::Version
29
- version: '7.0'
32
+ version: '8'
33
+ - !ruby/object:Gem::Dependency
34
+ name: mongoid-compatibility
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
30
37
  - - ">="
31
38
  - !ruby/object:Gem::Version
32
- version: '4.0'
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: rake
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -91,6 +105,7 @@ files:
91
105
  - spec/mongoid/tree/traversal_spec.rb
92
106
  - spec/mongoid/tree_spec.rb
93
107
  - spec/spec_helper.rb
108
+ - spec/support/logger.rb
94
109
  - spec/support/macros/tree_macros.rb
95
110
  - spec/support/models/node.rb
96
111
  homepage: https://github.com/benedikt/mongoid-tree
@@ -113,9 +128,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
128
  version: '0'
114
129
  requirements: []
115
130
  rubyforge_project:
116
- rubygems_version: 2.5.1
131
+ rubygems_version: 2.7.6
117
132
  signing_key:
118
133
  specification_version: 4
119
134
  summary: A tree structure for Mongoid documents
120
135
  test_files: []
121
- has_rdoc: