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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rspec +0 -0
  4. data/.travis.yml +0 -10
  5. data/.yardopts +0 -0
  6. data/Appraisals +0 -0
  7. data/CHANGELOG.md +6 -0
  8. data/Gemfile +0 -0
  9. data/MIT-LICENSE +0 -0
  10. data/README.md +17 -6
  11. data/Rakefile +0 -0
  12. data/closure_tree.gemspec +0 -0
  13. data/gemfiles/activerecord_4.1.gemfile +0 -0
  14. data/gemfiles/activerecord_4.2.gemfile +0 -0
  15. data/gemfiles/activerecord_5.0.gemfile +0 -0
  16. data/gemfiles/activerecord_5.0_foreigner.gemfile +0 -0
  17. data/gemfiles/activerecord_edge.gemfile +0 -0
  18. data/img/example.png +0 -0
  19. data/img/preorder.png +0 -0
  20. data/lib/closure_tree.rb +0 -0
  21. data/lib/closure_tree/active_record_support.rb +0 -0
  22. data/lib/closure_tree/configuration.rb +0 -0
  23. data/lib/closure_tree/deterministic_ordering.rb +0 -0
  24. data/lib/closure_tree/digraphs.rb +0 -0
  25. data/lib/closure_tree/finders.rb +0 -0
  26. data/lib/closure_tree/has_closure_tree.rb +0 -0
  27. data/lib/closure_tree/has_closure_tree_root.rb +0 -0
  28. data/lib/closure_tree/hash_tree.rb +0 -0
  29. data/lib/closure_tree/hash_tree_support.rb +0 -0
  30. data/lib/closure_tree/hierarchy_maintenance.rb +0 -0
  31. data/lib/closure_tree/model.rb +0 -0
  32. data/lib/closure_tree/numeric_deterministic_ordering.rb +6 -3
  33. data/lib/closure_tree/numeric_order_support.rb +0 -0
  34. data/lib/closure_tree/support.rb +0 -0
  35. data/lib/closure_tree/support_attributes.rb +0 -0
  36. data/lib/closure_tree/support_flags.rb +0 -0
  37. data/lib/closure_tree/test/matcher.rb +0 -0
  38. data/lib/closure_tree/version.rb +1 -1
  39. data/lib/generators/closure_tree/config_generator.rb +0 -0
  40. data/lib/generators/closure_tree/migration_generator.rb +0 -0
  41. data/lib/generators/closure_tree/templates/config.rb +0 -0
  42. data/lib/generators/closure_tree/templates/create_hierarchies_table.rb.erb +0 -0
  43. data/spec/cache_invalidation_spec.rb +0 -0
  44. data/spec/cuisine_type_spec.rb +0 -0
  45. data/spec/db/database.yml +0 -0
  46. data/spec/db/models.rb +0 -0
  47. data/spec/db/schema.rb +0 -0
  48. data/spec/fixtures/tags.yml +0 -0
  49. data/spec/generators/migration_generator_spec.rb +0 -0
  50. data/spec/has_closure_tree_root_spec.rb +0 -0
  51. data/spec/hierarchy_maintenance_spec.rb +0 -0
  52. data/spec/label_spec.rb +0 -0
  53. data/spec/matcher_spec.rb +0 -0
  54. data/spec/metal_spec.rb +0 -0
  55. data/spec/model_spec.rb +0 -0
  56. data/spec/namespace_type_spec.rb +0 -0
  57. data/spec/parallel_spec.rb +0 -0
  58. data/spec/spec_helper.rb +0 -0
  59. data/spec/support/database.rb +0 -0
  60. data/spec/support/database_cleaner.rb +0 -0
  61. data/spec/support/exceed_query_limit.rb +0 -0
  62. data/spec/support/hash_monkey_patch.rb +0 -0
  63. data/spec/support/query_counter.rb +0 -0
  64. data/spec/support/sqlite3_with_advisory_lock.rb +0 -0
  65. data/spec/support_spec.rb +0 -0
  66. data/spec/tag_examples.rb +0 -0
  67. data/spec/tag_spec.rb +0 -0
  68. data/spec/user_spec.rb +0 -0
  69. data/spec/uuid_tag_spec.rb +0 -0
  70. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3b96ba78aea59298da3138316379a458d28c713
4
- data.tar.gz: f1c786fb41309ea4460a06ae296b7393ea058b63
3
+ metadata.gz: 06cbb37da1e1592760ad47995f099a8f69be5d81
4
+ data.tar.gz: a9e2ece8d7e792b0cb97378c9885b9201e654bbb
5
5
  SHA512:
6
- metadata.gz: b5850fadca83ecdc88e53f4fac48a19faaafda82c7b6bd93f8051e264b632a94b56edbc3b22d9d060d658cf76dca02268fda625835c74e9e6cfb6ef75e9430d6
7
- data.tar.gz: cae0ca262a5f9f76d1a01b24aac119a5307a49637a77e9287305630d2e97c2b3265a767180b5e76eedff9a4a9ada44ff07aebe648d0b109949c7ed2e012b9b93
6
+ metadata.gz: 1ca685fbfaf26efad13f7633039553940d7655fe73d83e2c5e0d2b3b00f2905de07b648026e8d093b59c43082f14e7e3bbc87c963c3933dff46b12c54311673b
7
+ data.tar.gz: 0bed535b6c550b3b6fa09aa40de17d82c022e8997914e98cf4ba1ba436a9d6f453a41e549831a10e50a8836365acccf9e5201105b44a8cbfdf297445e267f5a5
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  .bundle/
2
+ .history/
2
3
  .idea/
3
4
  pkg/
4
5
  rdoc/
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
- [![Build Status](https://secure.travis-ci.org/mceachen/closure_tree.png?branch=master)](http://travis-ci.org/mceachen/closure_tree)
9
- [![Gem Version](https://badge.fury.io/rb/closure_tree.png)](http://rubygems.org/gems/closure_tree)
10
- [![Code Climate](https://codeclimate.com/github/mceachen/closure_tree.png)](https://codeclimate.com/github/mceachen/closure_tree)
11
- [![Dependency Status](https://gemnasium.com/mceachen/closure_tree.png)](https://gemnasium.com/mceachen/closure_tree)
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.0, 2.1, 2.2, 2.3.1 and JRuby 9000__
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 5.7+
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
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
- _ct_reorder_children
94
- child_node.reload
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
File without changes
File without changes
File without changes
File without changes
@@ -1,3 +1,3 @@
1
1
  module ClosureTree
2
- VERSION = Gem::Version.new('6.2.0')
2
+ VERSION = Gem::Version.new('6.3.0')
3
3
  end
File without changes
File without changes
File without changes
File without changes
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
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
File without changes
File without changes
data/spec/spec_helper.rb CHANGED
File without changes
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
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.2.0
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: 2016-10-10 00:00:00.000000000 Z
11
+ date: 2017-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord