parentry 1.6.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,199 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ parentry (1.8.0)
5
+ activerecord (>= 6.1, < 8.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionpack (7.2.2)
11
+ actionview (= 7.2.2)
12
+ activesupport (= 7.2.2)
13
+ nokogiri (>= 1.8.5)
14
+ racc
15
+ rack (>= 2.2.4, < 3.2)
16
+ rack-session (>= 1.0.1)
17
+ rack-test (>= 0.6.3)
18
+ rails-dom-testing (~> 2.2)
19
+ rails-html-sanitizer (~> 1.6)
20
+ useragent (~> 0.16)
21
+ actionview (7.2.2)
22
+ activesupport (= 7.2.2)
23
+ builder (~> 3.1)
24
+ erubi (~> 1.11)
25
+ rails-dom-testing (~> 2.2)
26
+ rails-html-sanitizer (~> 1.6)
27
+ activemodel (7.2.2)
28
+ activesupport (= 7.2.2)
29
+ activerecord (7.2.2)
30
+ activemodel (= 7.2.2)
31
+ activesupport (= 7.2.2)
32
+ timeout (>= 0.4.0)
33
+ activesupport (7.2.2)
34
+ base64
35
+ benchmark (>= 0.3)
36
+ bigdecimal
37
+ concurrent-ruby (~> 1.0, >= 1.3.1)
38
+ connection_pool (>= 2.2.5)
39
+ drb
40
+ i18n (>= 1.6, < 2)
41
+ logger (>= 1.4.2)
42
+ minitest (>= 5.1)
43
+ securerandom (>= 0.3)
44
+ tzinfo (~> 2.0, >= 2.0.5)
45
+ appraisal (2.5.0)
46
+ bundler
47
+ rake
48
+ thor (>= 0.14.0)
49
+ ast (2.4.2)
50
+ base64 (0.2.0)
51
+ benchmark (0.4.0)
52
+ bigdecimal (3.1.8)
53
+ builder (3.3.0)
54
+ coderay (1.1.3)
55
+ combustion (1.5.0)
56
+ activesupport (>= 3.0.0)
57
+ railties (>= 3.0.0)
58
+ thor (>= 0.14.6)
59
+ concurrent-ruby (1.3.4)
60
+ connection_pool (2.4.1)
61
+ crass (1.0.6)
62
+ database_cleaner (2.1.0)
63
+ database_cleaner-active_record (>= 2, < 3)
64
+ database_cleaner-active_record (2.2.0)
65
+ activerecord (>= 5.a)
66
+ database_cleaner-core (~> 2.0.0)
67
+ database_cleaner-core (2.0.1)
68
+ diff-lcs (1.5.1)
69
+ docile (1.4.1)
70
+ drb (2.2.1)
71
+ erubi (1.13.0)
72
+ i18n (1.14.6)
73
+ concurrent-ruby (~> 1.0)
74
+ io-console (0.7.2)
75
+ irb (1.14.1)
76
+ rdoc (>= 4.0.0)
77
+ reline (>= 0.4.2)
78
+ json (2.8.1)
79
+ language_server-protocol (3.17.0.3)
80
+ logger (1.6.1)
81
+ loofah (2.23.1)
82
+ crass (~> 1.0.2)
83
+ nokogiri (>= 1.12.0)
84
+ method_source (1.1.0)
85
+ mini_portile2 (2.8.7)
86
+ minitest (5.25.1)
87
+ nokogiri (1.16.7)
88
+ mini_portile2 (~> 2.8.2)
89
+ racc (~> 1.4)
90
+ ostruct (0.6.1)
91
+ parallel (1.26.3)
92
+ parser (3.3.6.0)
93
+ ast (~> 2.4.1)
94
+ racc
95
+ pg (1.5.9)
96
+ pry (0.14.2)
97
+ coderay (~> 1.1)
98
+ method_source (~> 1.0)
99
+ psych (5.2.0)
100
+ stringio
101
+ racc (1.8.1)
102
+ rack (3.1.8)
103
+ rack-session (2.0.0)
104
+ rack (>= 3.0.0)
105
+ rack-test (2.1.0)
106
+ rack (>= 1.3)
107
+ rackup (2.2.0)
108
+ rack (>= 3)
109
+ rails-dom-testing (2.2.0)
110
+ activesupport (>= 5.0.0)
111
+ minitest
112
+ nokogiri (>= 1.6)
113
+ rails-html-sanitizer (1.6.0)
114
+ loofah (~> 2.21)
115
+ nokogiri (~> 1.14)
116
+ railties (7.2.2)
117
+ actionpack (= 7.2.2)
118
+ activesupport (= 7.2.2)
119
+ irb (~> 1.13)
120
+ rackup (>= 1.0.0)
121
+ rake (>= 12.2)
122
+ thor (~> 1.0, >= 1.2.2)
123
+ zeitwerk (~> 2.6)
124
+ rainbow (3.1.1)
125
+ rake (13.2.1)
126
+ rdoc (6.7.0)
127
+ psych (>= 4.0.0)
128
+ regexp_parser (2.9.2)
129
+ reline (0.5.11)
130
+ io-console (~> 0.5)
131
+ rspec-core (3.13.2)
132
+ rspec-support (~> 3.13.0)
133
+ rspec-expectations (3.13.3)
134
+ diff-lcs (>= 1.2.0, < 2.0)
135
+ rspec-support (~> 3.13.0)
136
+ rspec-mocks (3.13.2)
137
+ diff-lcs (>= 1.2.0, < 2.0)
138
+ rspec-support (~> 3.13.0)
139
+ rspec-rails (7.0.1)
140
+ actionpack (>= 7.0)
141
+ activesupport (>= 7.0)
142
+ railties (>= 7.0)
143
+ rspec-core (~> 3.13)
144
+ rspec-expectations (~> 3.13)
145
+ rspec-mocks (~> 3.13)
146
+ rspec-support (~> 3.13)
147
+ rspec-support (3.13.1)
148
+ rubocop (1.68.0)
149
+ json (~> 2.3)
150
+ language_server-protocol (>= 3.17.0)
151
+ parallel (~> 1.10)
152
+ parser (>= 3.3.0.2)
153
+ rainbow (>= 2.2.2, < 4.0)
154
+ regexp_parser (>= 2.4, < 3.0)
155
+ rubocop-ast (>= 1.32.2, < 2.0)
156
+ ruby-progressbar (~> 1.7)
157
+ unicode-display_width (>= 2.4.0, < 3.0)
158
+ rubocop-ast (1.34.1)
159
+ parser (>= 3.3.1.0)
160
+ rubocop-rspec (3.2.0)
161
+ rubocop (~> 1.61)
162
+ ruby-progressbar (1.13.0)
163
+ securerandom (0.3.1)
164
+ simplecov (0.22.0)
165
+ docile (~> 1.1)
166
+ simplecov-html (~> 0.11)
167
+ simplecov_json_formatter (~> 0.1)
168
+ simplecov-html (0.13.1)
169
+ simplecov_json_formatter (0.1.4)
170
+ stringio (3.1.2)
171
+ thor (1.3.2)
172
+ timeout (0.4.2)
173
+ tzinfo (2.0.6)
174
+ concurrent-ruby (~> 1.0)
175
+ unicode-display_width (2.6.0)
176
+ useragent (0.16.10)
177
+ zeitwerk (2.6.18)
178
+
179
+ PLATFORMS
180
+ ruby
181
+
182
+ DEPENDENCIES
183
+ activerecord (~> 7.2, < 8)
184
+ appraisal
185
+ bundler
186
+ combustion
187
+ database_cleaner (~> 2)
188
+ ostruct
189
+ parentry!
190
+ pg (~> 1.5)
191
+ pry
192
+ rake
193
+ rspec-rails
194
+ rubocop-rspec
195
+ simplecov (~> 0.20)
196
+ zeitwerk (~> 2.6.0)
197
+
198
+ BUNDLED WITH
199
+ 2.5.17
@@ -0,0 +1,19 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "bundler"
7
+ gem "combustion"
8
+ gem "database_cleaner", "~> 2"
9
+ gem "ostruct"
10
+ gem "pg", "~> 1.5"
11
+ gem "pry"
12
+ gem "rake"
13
+ gem "rspec-rails"
14
+ gem "rubocop-rspec"
15
+ gem "simplecov", "~> 0.20"
16
+ gem "zeitwerk", "~> 2.6.0"
17
+ gem "activerecord", "8.0.0", "< 8.1"
18
+
19
+ gemspec path: "../"
@@ -0,0 +1,200 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ parentry (1.8.0)
5
+ activerecord (>= 6.1, < 8.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionpack (8.0.0)
11
+ actionview (= 8.0.0)
12
+ activesupport (= 8.0.0)
13
+ nokogiri (>= 1.8.5)
14
+ rack (>= 2.2.4)
15
+ rack-session (>= 1.0.1)
16
+ rack-test (>= 0.6.3)
17
+ rails-dom-testing (~> 2.2)
18
+ rails-html-sanitizer (~> 1.6)
19
+ useragent (~> 0.16)
20
+ actionview (8.0.0)
21
+ activesupport (= 8.0.0)
22
+ builder (~> 3.1)
23
+ erubi (~> 1.11)
24
+ rails-dom-testing (~> 2.2)
25
+ rails-html-sanitizer (~> 1.6)
26
+ activemodel (8.0.0)
27
+ activesupport (= 8.0.0)
28
+ activerecord (8.0.0)
29
+ activemodel (= 8.0.0)
30
+ activesupport (= 8.0.0)
31
+ timeout (>= 0.4.0)
32
+ activesupport (8.0.0)
33
+ base64
34
+ benchmark (>= 0.3)
35
+ bigdecimal
36
+ concurrent-ruby (~> 1.0, >= 1.3.1)
37
+ connection_pool (>= 2.2.5)
38
+ drb
39
+ i18n (>= 1.6, < 2)
40
+ logger (>= 1.4.2)
41
+ minitest (>= 5.1)
42
+ securerandom (>= 0.3)
43
+ tzinfo (~> 2.0, >= 2.0.5)
44
+ uri (>= 0.13.1)
45
+ appraisal (2.5.0)
46
+ bundler
47
+ rake
48
+ thor (>= 0.14.0)
49
+ ast (2.4.2)
50
+ base64 (0.2.0)
51
+ benchmark (0.4.0)
52
+ bigdecimal (3.1.8)
53
+ builder (3.3.0)
54
+ coderay (1.1.3)
55
+ combustion (1.5.0)
56
+ activesupport (>= 3.0.0)
57
+ railties (>= 3.0.0)
58
+ thor (>= 0.14.6)
59
+ concurrent-ruby (1.3.4)
60
+ connection_pool (2.4.1)
61
+ crass (1.0.6)
62
+ database_cleaner (2.1.0)
63
+ database_cleaner-active_record (>= 2, < 3)
64
+ database_cleaner-active_record (2.2.0)
65
+ activerecord (>= 5.a)
66
+ database_cleaner-core (~> 2.0.0)
67
+ database_cleaner-core (2.0.1)
68
+ diff-lcs (1.5.1)
69
+ docile (1.4.1)
70
+ drb (2.2.1)
71
+ erubi (1.13.0)
72
+ i18n (1.14.6)
73
+ concurrent-ruby (~> 1.0)
74
+ io-console (0.7.2)
75
+ irb (1.14.1)
76
+ rdoc (>= 4.0.0)
77
+ reline (>= 0.4.2)
78
+ json (2.8.1)
79
+ language_server-protocol (3.17.0.3)
80
+ logger (1.6.1)
81
+ loofah (2.23.1)
82
+ crass (~> 1.0.2)
83
+ nokogiri (>= 1.12.0)
84
+ method_source (1.1.0)
85
+ mini_portile2 (2.8.7)
86
+ minitest (5.25.1)
87
+ nokogiri (1.16.7)
88
+ mini_portile2 (~> 2.8.2)
89
+ racc (~> 1.4)
90
+ ostruct (0.6.1)
91
+ parallel (1.26.3)
92
+ parser (3.3.6.0)
93
+ ast (~> 2.4.1)
94
+ racc
95
+ pg (1.5.9)
96
+ pry (0.14.2)
97
+ coderay (~> 1.1)
98
+ method_source (~> 1.0)
99
+ psych (5.2.0)
100
+ stringio
101
+ racc (1.8.1)
102
+ rack (3.1.8)
103
+ rack-session (2.0.0)
104
+ rack (>= 3.0.0)
105
+ rack-test (2.1.0)
106
+ rack (>= 1.3)
107
+ rackup (2.2.0)
108
+ rack (>= 3)
109
+ rails-dom-testing (2.2.0)
110
+ activesupport (>= 5.0.0)
111
+ minitest
112
+ nokogiri (>= 1.6)
113
+ rails-html-sanitizer (1.6.0)
114
+ loofah (~> 2.21)
115
+ nokogiri (~> 1.14)
116
+ railties (8.0.0)
117
+ actionpack (= 8.0.0)
118
+ activesupport (= 8.0.0)
119
+ irb (~> 1.13)
120
+ rackup (>= 1.0.0)
121
+ rake (>= 12.2)
122
+ thor (~> 1.0, >= 1.2.2)
123
+ zeitwerk (~> 2.6)
124
+ rainbow (3.1.1)
125
+ rake (13.2.1)
126
+ rdoc (6.7.0)
127
+ psych (>= 4.0.0)
128
+ regexp_parser (2.9.2)
129
+ reline (0.5.11)
130
+ io-console (~> 0.5)
131
+ rspec-core (3.13.2)
132
+ rspec-support (~> 3.13.0)
133
+ rspec-expectations (3.13.3)
134
+ diff-lcs (>= 1.2.0, < 2.0)
135
+ rspec-support (~> 3.13.0)
136
+ rspec-mocks (3.13.2)
137
+ diff-lcs (>= 1.2.0, < 2.0)
138
+ rspec-support (~> 3.13.0)
139
+ rspec-rails (7.0.1)
140
+ actionpack (>= 7.0)
141
+ activesupport (>= 7.0)
142
+ railties (>= 7.0)
143
+ rspec-core (~> 3.13)
144
+ rspec-expectations (~> 3.13)
145
+ rspec-mocks (~> 3.13)
146
+ rspec-support (~> 3.13)
147
+ rspec-support (3.13.1)
148
+ rubocop (1.68.0)
149
+ json (~> 2.3)
150
+ language_server-protocol (>= 3.17.0)
151
+ parallel (~> 1.10)
152
+ parser (>= 3.3.0.2)
153
+ rainbow (>= 2.2.2, < 4.0)
154
+ regexp_parser (>= 2.4, < 3.0)
155
+ rubocop-ast (>= 1.32.2, < 2.0)
156
+ ruby-progressbar (~> 1.7)
157
+ unicode-display_width (>= 2.4.0, < 3.0)
158
+ rubocop-ast (1.34.1)
159
+ parser (>= 3.3.1.0)
160
+ rubocop-rspec (3.2.0)
161
+ rubocop (~> 1.61)
162
+ ruby-progressbar (1.13.0)
163
+ securerandom (0.3.1)
164
+ simplecov (0.22.0)
165
+ docile (~> 1.1)
166
+ simplecov-html (~> 0.11)
167
+ simplecov_json_formatter (~> 0.1)
168
+ simplecov-html (0.13.1)
169
+ simplecov_json_formatter (0.1.4)
170
+ stringio (3.1.2)
171
+ thor (1.3.2)
172
+ timeout (0.4.2)
173
+ tzinfo (2.0.6)
174
+ concurrent-ruby (~> 1.0)
175
+ unicode-display_width (2.6.0)
176
+ uri (1.0.1)
177
+ useragent (0.16.10)
178
+ zeitwerk (2.6.18)
179
+
180
+ PLATFORMS
181
+ ruby
182
+
183
+ DEPENDENCIES
184
+ activerecord (= 8.0.0, < 8.1)
185
+ appraisal
186
+ bundler
187
+ combustion
188
+ database_cleaner (~> 2)
189
+ ostruct
190
+ parentry!
191
+ pg (~> 1.5)
192
+ pry
193
+ rake
194
+ rspec-rails
195
+ rubocop-rspec
196
+ simplecov (~> 0.20)
197
+ zeitwerk (~> 2.6.0)
198
+
199
+ BUNDLED WITH
200
+ 2.5.20
@@ -33,7 +33,7 @@ module Parentry
33
33
  end
34
34
 
35
35
  def leaf?
36
- children.size.zero?
36
+ children.empty?
37
37
  end
38
38
  alias childless? leaf?
39
39
 
@@ -46,7 +46,7 @@ module Parentry
46
46
  end
47
47
 
48
48
  def siblings
49
- parentry_scope.where.not(id: id).where.not(parent_id: nil).where(parent_id: parent_id)
49
+ parentry_scope.where.not(id:).where.not(parent_id: nil).where(parent_id:)
50
50
  end
51
51
 
52
52
  def siblings?
@@ -73,7 +73,7 @@ module Parentry
73
73
 
74
74
  def descendants(scopes = {})
75
75
  with_depth_scopes(scopes) do
76
- subtree.where.not(id: id)
76
+ subtree.where.not(id:)
77
77
  end
78
78
  end
79
79
 
@@ -15,7 +15,7 @@ module Parentry
15
15
  def cascade_parentry
16
16
  old_path, new_path = saved_changes[parentry_column]
17
17
  parentry_scope.where(
18
- ["#{parentry_column} @> ARRAY[:tree] AND id != :id", { tree: old_path, id: id }]
18
+ ["#{parentry_column} @> ARRAY[:tree]::integer[] AND id != :id", { tree: old_path, id: }]
19
19
  ).update_all(
20
20
  [
21
21
  "#{parentry_column} = array_cat(ARRAY[?], #{parentry_column}[?:array_length(#{parentry_column}, 1)])",
@@ -25,11 +25,11 @@ module Parentry
25
25
  end
26
26
 
27
27
  def subtree_conditions
28
- ["#{parentry_column} @> ARRAY[?]", parentry]
28
+ ["#{parentry_column} @> ARRAY[?]::integer[]", parentry]
29
29
  end
30
30
 
31
31
  def ancestor_conditions
32
- ["#{parentry_column} <@ ARRAY[?]", parentry]
32
+ ["#{parentry_column} <@ ARRAY[?]::integer[]", parentry]
33
33
  end
34
34
  end
35
35
  end
@@ -13,11 +13,11 @@ module Parentry
13
13
  def cascade_parentry
14
14
  old_path, new_path = saved_changes[parentry_column]
15
15
  parentry_scope.where(
16
- ["#{parentry_column} <@ :tree AND id != :id", { tree: old_path, id: id }]
16
+ ["#{parentry_column} <@ :tree AND id != :id", { tree: old_path, id: }]
17
17
  ).update_all(
18
18
  [
19
19
  "#{parentry_column} = :new_path || subpath(#{parentry_column}, nlevel(:old_path))",
20
- { new_path: new_path, old_path: old_path }
20
+ { new_path:, old_path: }
21
21
  ]
22
22
  )
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Parentry
2
- VERSION = '1.6.0'.freeze
2
+ VERSION = '1.8.0'.freeze
3
3
  end
data/parentry.gemspec CHANGED
@@ -15,17 +15,8 @@ Gem::Specification.new do |spec|
15
15
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
16
  spec.require_paths = ['lib']
17
17
 
18
- spec.required_ruby_version = '>= 2.5'
18
+ spec.required_ruby_version = '>= 3.1'
19
+ spec.metadata['rubygems_mfa_required'] = 'true'
19
20
 
20
- spec.add_dependency 'activerecord', '>= 5.1', '< 7.1'
21
-
22
- spec.add_development_dependency 'bundler', '~> 2'
23
- spec.add_development_dependency 'combustion', '~> 1.1'
24
- spec.add_development_dependency 'database_cleaner', '~> 1.6'
25
- spec.add_development_dependency 'pg', '~> 1.2'
26
- spec.add_development_dependency 'pry', '~> 0.13'
27
- spec.add_development_dependency 'rake', '~> 13'
28
- spec.add_development_dependency 'rspec-rails', '~> 4.0'
29
- spec.add_development_dependency 'rubocop-rspec', '~> 2.1'
30
- spec.add_development_dependency 'simplecov', '~> 0.20'
21
+ spec.add_dependency 'activerecord', '>= 6.1', '< 8.1'
31
22
  end