closure_tree 6.2.0 → 6.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +0 -0
- data/.travis.yml +0 -10
- data/.yardopts +0 -0
- data/Appraisals +0 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +0 -0
- data/MIT-LICENSE +0 -0
- data/README.md +17 -6
- data/Rakefile +0 -0
- data/closure_tree.gemspec +0 -0
- data/gemfiles/activerecord_4.1.gemfile +0 -0
- data/gemfiles/activerecord_4.2.gemfile +0 -0
- data/gemfiles/activerecord_5.0.gemfile +0 -0
- data/gemfiles/activerecord_5.0_foreigner.gemfile +0 -0
- data/gemfiles/activerecord_edge.gemfile +0 -0
- data/img/example.png +0 -0
- data/img/preorder.png +0 -0
- data/lib/closure_tree.rb +0 -0
- data/lib/closure_tree/active_record_support.rb +0 -0
- data/lib/closure_tree/configuration.rb +0 -0
- data/lib/closure_tree/deterministic_ordering.rb +0 -0
- data/lib/closure_tree/digraphs.rb +0 -0
- data/lib/closure_tree/finders.rb +0 -0
- data/lib/closure_tree/has_closure_tree.rb +0 -0
- data/lib/closure_tree/has_closure_tree_root.rb +0 -0
- data/lib/closure_tree/hash_tree.rb +0 -0
- data/lib/closure_tree/hash_tree_support.rb +0 -0
- data/lib/closure_tree/hierarchy_maintenance.rb +0 -0
- data/lib/closure_tree/model.rb +0 -0
- data/lib/closure_tree/numeric_deterministic_ordering.rb +6 -3
- data/lib/closure_tree/numeric_order_support.rb +0 -0
- data/lib/closure_tree/support.rb +0 -0
- data/lib/closure_tree/support_attributes.rb +0 -0
- data/lib/closure_tree/support_flags.rb +0 -0
- data/lib/closure_tree/test/matcher.rb +0 -0
- data/lib/closure_tree/version.rb +1 -1
- data/lib/generators/closure_tree/config_generator.rb +0 -0
- data/lib/generators/closure_tree/migration_generator.rb +0 -0
- data/lib/generators/closure_tree/templates/config.rb +0 -0
- data/lib/generators/closure_tree/templates/create_hierarchies_table.rb.erb +0 -0
- data/spec/cache_invalidation_spec.rb +0 -0
- data/spec/cuisine_type_spec.rb +0 -0
- data/spec/db/database.yml +0 -0
- data/spec/db/models.rb +0 -0
- data/spec/db/schema.rb +0 -0
- data/spec/fixtures/tags.yml +0 -0
- data/spec/generators/migration_generator_spec.rb +0 -0
- data/spec/has_closure_tree_root_spec.rb +0 -0
- data/spec/hierarchy_maintenance_spec.rb +0 -0
- data/spec/label_spec.rb +0 -0
- data/spec/matcher_spec.rb +0 -0
- data/spec/metal_spec.rb +0 -0
- data/spec/model_spec.rb +0 -0
- data/spec/namespace_type_spec.rb +0 -0
- data/spec/parallel_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/support/database.rb +0 -0
- data/spec/support/database_cleaner.rb +0 -0
- data/spec/support/exceed_query_limit.rb +0 -0
- data/spec/support/hash_monkey_patch.rb +0 -0
- data/spec/support/query_counter.rb +0 -0
- data/spec/support/sqlite3_with_advisory_lock.rb +0 -0
- data/spec/support_spec.rb +0 -0
- data/spec/tag_examples.rb +0 -0
- data/spec/tag_spec.rb +0 -0
- data/spec/user_spec.rb +0 -0
- data/spec/uuid_tag_spec.rb +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06cbb37da1e1592760ad47995f099a8f69be5d81
|
4
|
+
data.tar.gz: a9e2ece8d7e792b0cb97378c9885b9201e654bbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ca685fbfaf26efad13f7633039553940d7655fe73d83e2c5e0d2b3b00f2905de07b648026e8d093b59c43082f14e7e3bbc87c963c3933dff46b12c54311673b
|
7
|
+
data.tar.gz: 0bed535b6c550b3b6fa09aa40de17d82c022e8997914e98cf4ba1ba436a9d6f453a41e549831a10e50a8836365acccf9e5201105b44a8cbfdf297445e267f5a5
|
data/.rspec
CHANGED
File without changes
|
data/.travis.yml
CHANGED
@@ -4,7 +4,6 @@ language: ruby
|
|
4
4
|
rvm:
|
5
5
|
- 2.3.1
|
6
6
|
- 2.2.5
|
7
|
-
- 2.0
|
8
7
|
# these haven't been passing for a while:
|
9
8
|
# - jruby-head
|
10
9
|
# - rbx
|
@@ -28,12 +27,3 @@ matrix:
|
|
28
27
|
- gemfile: gemfiles/activerecord_edge.gemfile
|
29
28
|
- rvm: jruby-head
|
30
29
|
- rvm: rbx
|
31
|
-
|
32
|
-
# rails 5+ requires ruby >= 2.2:
|
33
|
-
exclude:
|
34
|
-
- rvm: 2.0
|
35
|
-
gemfile: gemfiles/activerecord_5.0_foreigner.gemfile
|
36
|
-
- rvm: 2.0
|
37
|
-
gemfile: gemfiles/activerecord_5.0.gemfile
|
38
|
-
- rvm: 2.0
|
39
|
-
gemfile: gemfiles/activerecord_edge.gemfile
|
data/.yardopts
CHANGED
File without changes
|
data/Appraisals
CHANGED
File without changes
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 6.3.0
|
4
|
+
|
5
|
+
* `prepend_child` [handles invalid children properly now](https://github.com/mceachen/closure_tree/issues/249).
|
6
|
+
Thanks [Amit Saxena](https://github.com/amitsaxena)!
|
7
|
+
* Dropped official support for jruby and ruby 2.0 (no code was changed)
|
8
|
+
|
3
9
|
### 6.2.0
|
4
10
|
|
5
11
|
* Fix for [MySQL lock lengths](https://github.com/mceachen/closure_tree/issues/231).
|
data/Gemfile
CHANGED
File without changes
|
data/MIT-LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -5,10 +5,11 @@
|
|
5
5
|
Common applications include modeling hierarchical data, like tags, threaded comments, page graphs in CMSes,
|
6
6
|
and tracking user referrals.
|
7
7
|
|
8
|
-
[![
|
9
|
-
[![
|
10
|
-
[![
|
11
|
-
[![
|
8
|
+
[![Join the chat at https://gitter.im/closure_tree/Lobby](https://badges.gitter.im/closure_tree/Lobby.svg)](https://gitter.im/closure_tree/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
9
|
+
[![Build Status](https://api.travis-ci.org/mceachen/closure_tree.svg?branch=master)](http://travis-ci.org/mceachen/closure_tree)
|
10
|
+
[![Gem Version](https://badge.fury.io/rb/closure_tree.svg)](https://badge.fury.io/rb/closure_tree)
|
11
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/fa5a8ae2193d42adb30b4256732a757d)](https://www.codacy.com/app/matthew-github/closure_tree)
|
12
|
+
[![Dependency Status](https://gemnasium.com/badges/github.com/mceachen/closure_tree.svg)](https://gemnasium.com/github.com/mceachen/closure_tree)
|
12
13
|
|
13
14
|
Dramatically more performant than
|
14
15
|
[ancestry](https://github.com/stefankroes/ancestry) and
|
@@ -27,7 +28,7 @@ closure_tree has some great features:
|
|
27
28
|
* 3 SQL INSERT/UPDATEs on node reparenting
|
28
29
|
* __Support for [concurrency](#concurrency)__ (using [with_advisory_lock](https://github.com/mceachen/with_advisory_lock))
|
29
30
|
* __Support for ActiveRecord 4.1, 4.2 and 5.0__
|
30
|
-
* __Support for Ruby 2.
|
31
|
+
* __Support for Ruby 2.2 and 2.3__
|
31
32
|
* Support for reparenting children (and all their descendants)
|
32
33
|
* Support for [single-table inheritance (STI)](#sti) within the hierarchy
|
33
34
|
* ```find_or_create_by_path``` for [building out heterogeneous hierarchies quickly and conveniently](#find_or_create_by_path)
|
@@ -475,6 +476,10 @@ Yup! [Ilya Bodrov](https://github.com/bodrovis) wrote [Nested Comments with Rail
|
|
475
476
|
**No.** `update_attribute` skips the validation hook that is required for maintaining the
|
476
477
|
hierarchy table.
|
477
478
|
|
479
|
+
### Can I assign a parent to multiple children with ```#update_all```?
|
480
|
+
|
481
|
+
**No.** Please see [issue 197](https://github.com/mceachen/closure_tree/issues/197) for details.
|
482
|
+
|
478
483
|
### Does this gem support multiple parents?
|
479
484
|
|
480
485
|
No. This gem's API is based on the assumption that each node has either 0 or 1 parent.
|
@@ -530,10 +535,16 @@ sudo apt-get install libpq-dev libsqlite3-dev libmysqlclient-dev
|
|
530
535
|
bundle install
|
531
536
|
```
|
532
537
|
|
533
|
-
### Object destroy fails with MySQL
|
538
|
+
### Object destroy fails with MySQL v5.7+
|
534
539
|
|
535
540
|
A bug was introduced in MySQL's query optimizer. [See the workaround here](https://github.com/mceachen/closure_tree/issues/206).
|
536
541
|
|
542
|
+
### Hierarchy maintenance errors from MySQL v5.7.9-v5.7.10
|
543
|
+
|
544
|
+
Upgrade to MySQL 5.7.12 or later if you see [this issue](https://github.com/mceachen/closure_tree/issues/190):
|
545
|
+
|
546
|
+
Mysql2::Error: You can't specify target table '*_hierarchies' for update in FROM clause
|
547
|
+
|
537
548
|
## Testing with Closure Tree
|
538
549
|
|
539
550
|
Closure tree comes with some RSpec2/3 matchers which you may use for your tests:
|
data/Rakefile
CHANGED
File without changes
|
data/closure_tree.gemspec
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/img/example.png
CHANGED
File without changes
|
data/img/preorder.png
CHANGED
File without changes
|
data/lib/closure_tree.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/closure_tree/finders.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/closure_tree/model.rb
CHANGED
File without changes
|
@@ -89,9 +89,12 @@ module ClosureTree
|
|
89
89
|
child_node.order_value = -1
|
90
90
|
child_node.parent = self
|
91
91
|
child_node._ct_skip_sort_order_maintenance!
|
92
|
-
child_node.save
|
93
|
-
|
94
|
-
|
92
|
+
if child_node.save
|
93
|
+
_ct_reorder_children
|
94
|
+
child_node.reload
|
95
|
+
else
|
96
|
+
child_node
|
97
|
+
end
|
95
98
|
end
|
96
99
|
|
97
100
|
def append_sibling(sibling_node)
|
File without changes
|
data/lib/closure_tree/support.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/closure_tree/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/cuisine_type_spec.rb
CHANGED
File without changes
|
data/spec/db/database.yml
CHANGED
File without changes
|
data/spec/db/models.rb
CHANGED
File without changes
|
data/spec/db/schema.rb
CHANGED
File without changes
|
data/spec/fixtures/tags.yml
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/label_spec.rb
CHANGED
File without changes
|
data/spec/matcher_spec.rb
CHANGED
File without changes
|
data/spec/metal_spec.rb
CHANGED
File without changes
|
data/spec/model_spec.rb
CHANGED
File without changes
|
data/spec/namespace_type_spec.rb
CHANGED
File without changes
|
data/spec/parallel_spec.rb
CHANGED
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
data/spec/support/database.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/support_spec.rb
CHANGED
File without changes
|
data/spec/tag_examples.rb
CHANGED
File without changes
|
data/spec/tag_spec.rb
CHANGED
File without changes
|
data/spec/user_spec.rb
CHANGED
File without changes
|
data/spec/uuid_tag_spec.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: closure_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew McEachen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|