hierarchable 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -3
- data/.github/dependabot.yml +12 -0
- data/.rubocop.yml +5 -5
- data/.ruby-version +1 -1
- data/Gemfile +2 -2
- data/Gemfile.lock +90 -69
- data/hierarchable.gemspec +3 -3
- data/lib/hierarchable/hierarchable.rb +9 -9
- data/lib/hierarchable/version.rb +1 -1
- metadata +5 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 212394909f52a4008f0e9d3839863e5a994d12f2ce98b286a771f479fcd77eef
|
|
4
|
+
data.tar.gz: 1835a21af0559ddb4103cbff8719afe02e1993eca6d92d8b1c33d15fe59bc6bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ec771edaa1e87e467d4322d96847fd055c32145ee5fe42a1d9b8c309d10ca30a4ff4b9aca43e2828edcfd927b71210495a8b65027cef80462bebb63cdaf1f52
|
|
7
|
+
data.tar.gz: f4196efc4b368e881e3e5607894e49b1b57ee901315001c37e45652a0d6936cde33841b5e9305fd48df52a3cd076f735b0b0e66aacf95314413f8500aef98d4a
|
data/.circleci/config.yml
CHANGED
|
@@ -13,7 +13,7 @@ commands:
|
|
|
13
13
|
- run:
|
|
14
14
|
name: Set up bundler
|
|
15
15
|
command: |
|
|
16
|
-
gem install bundler:2.
|
|
16
|
+
gem install bundler:2.6.9
|
|
17
17
|
- run:
|
|
18
18
|
name: Bundle Install
|
|
19
19
|
command: |
|
|
@@ -46,7 +46,7 @@ jobs:
|
|
|
46
46
|
resource_class: small
|
|
47
47
|
|
|
48
48
|
docker:
|
|
49
|
-
- image: cimg/ruby:3.
|
|
49
|
+
- image: cimg/ruby:3.4.8
|
|
50
50
|
|
|
51
51
|
steps:
|
|
52
52
|
# --------- SETUP ---------
|
|
@@ -73,7 +73,7 @@ jobs:
|
|
|
73
73
|
resource_class: small
|
|
74
74
|
|
|
75
75
|
docker:
|
|
76
|
-
- image: cimg/ruby:3.
|
|
76
|
+
- image: cimg/ruby:3.4.8
|
|
77
77
|
|
|
78
78
|
steps:
|
|
79
79
|
# --------- SETUP ---------
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby-3.
|
|
1
|
+
ruby-3.4.8
|
data/Gemfile
CHANGED
|
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
|
|
|
5
5
|
# Specify your gem's dependencies in hierarchable.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem 'bundler', '~> 2.
|
|
8
|
+
gem 'bundler', '~> 2.6'
|
|
9
9
|
gem 'bundler-audit', '>= 0'
|
|
10
10
|
gem 'minitest', '~> 5.0'
|
|
11
11
|
gem 'rake', '~> 13.0'
|
|
@@ -15,5 +15,5 @@ gem 'rubocop-performance', '>= 0'
|
|
|
15
15
|
gem 'rubocop-rails', '>= 0'
|
|
16
16
|
gem 'rubocop-rake', '>= 0'
|
|
17
17
|
gem 'ruby_audit', '>= 0'
|
|
18
|
-
gem 'sqlite3', '>= 0'
|
|
18
|
+
gem 'sqlite3', '~> 2.0', '>= 2.0.2'
|
|
19
19
|
gem 'temping', '~> 4.0'
|
data/Gemfile.lock
CHANGED
|
@@ -1,108 +1,129 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
hierarchable (0.4.
|
|
4
|
+
hierarchable (0.4.1)
|
|
5
5
|
activerecord (> 4.2.0)
|
|
6
6
|
activesupport (> 4.2.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
activemodel (
|
|
12
|
-
activesupport (=
|
|
13
|
-
activerecord (
|
|
14
|
-
activemodel (=
|
|
15
|
-
activesupport (=
|
|
11
|
+
activemodel (8.1.2)
|
|
12
|
+
activesupport (= 8.1.2)
|
|
13
|
+
activerecord (8.1.2)
|
|
14
|
+
activemodel (= 8.1.2)
|
|
15
|
+
activesupport (= 8.1.2)
|
|
16
16
|
timeout (>= 0.4.0)
|
|
17
|
-
activesupport (
|
|
17
|
+
activesupport (8.1.2)
|
|
18
18
|
base64
|
|
19
19
|
bigdecimal
|
|
20
|
-
concurrent-ruby (~> 1.0, >= 1.
|
|
20
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
21
21
|
connection_pool (>= 2.2.5)
|
|
22
22
|
drb
|
|
23
23
|
i18n (>= 1.6, < 2)
|
|
24
|
+
json
|
|
25
|
+
logger (>= 1.4.2)
|
|
24
26
|
minitest (>= 5.1)
|
|
25
|
-
|
|
26
|
-
tzinfo (~> 2.0)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
securerandom (>= 0.3)
|
|
28
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
29
|
+
uri (>= 0.13.1)
|
|
30
|
+
ast (2.4.3)
|
|
31
|
+
base64 (0.3.0)
|
|
32
|
+
bigdecimal (4.0.1)
|
|
33
|
+
bundler-audit (0.9.3)
|
|
34
|
+
bundler (>= 1.2.0)
|
|
32
35
|
thor (~> 1.0)
|
|
33
|
-
concurrent-ruby (1.
|
|
34
|
-
connection_pool (
|
|
35
|
-
drb (2.2.
|
|
36
|
-
i18n (1.14.
|
|
36
|
+
concurrent-ruby (1.3.6)
|
|
37
|
+
connection_pool (3.0.2)
|
|
38
|
+
drb (2.2.3)
|
|
39
|
+
i18n (1.14.8)
|
|
37
40
|
concurrent-ruby (~> 1.0)
|
|
38
|
-
json (2.
|
|
39
|
-
language_server-protocol (3.17.0.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
json (2.18.0)
|
|
42
|
+
language_server-protocol (3.17.0.5)
|
|
43
|
+
lint_roller (1.1.0)
|
|
44
|
+
logger (1.7.0)
|
|
45
|
+
minitest (5.27.0)
|
|
46
|
+
parallel (1.27.0)
|
|
47
|
+
parser (3.3.10.1)
|
|
44
48
|
ast (~> 2.4.1)
|
|
45
49
|
racc
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
prism (1.8.0)
|
|
51
|
+
racc (1.8.1)
|
|
52
|
+
rack (3.2.4)
|
|
48
53
|
rainbow (3.1.1)
|
|
49
|
-
rake (13.1
|
|
50
|
-
regexp_parser (2.
|
|
51
|
-
|
|
52
|
-
rubocop (1.62.1)
|
|
54
|
+
rake (13.3.1)
|
|
55
|
+
regexp_parser (2.11.3)
|
|
56
|
+
rubocop (1.82.1)
|
|
53
57
|
json (~> 2.3)
|
|
54
|
-
language_server-protocol (
|
|
58
|
+
language_server-protocol (~> 3.17.0.2)
|
|
59
|
+
lint_roller (~> 1.1.0)
|
|
55
60
|
parallel (~> 1.10)
|
|
56
61
|
parser (>= 3.3.0.2)
|
|
57
62
|
rainbow (>= 2.2.2, < 4.0)
|
|
58
|
-
regexp_parser (>=
|
|
59
|
-
|
|
60
|
-
rubocop-ast (>= 1.31.1, < 2.0)
|
|
63
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
64
|
+
rubocop-ast (>= 1.48.0, < 2.0)
|
|
61
65
|
ruby-progressbar (~> 1.7)
|
|
62
|
-
unicode-display_width (>= 2.4.0, <
|
|
63
|
-
rubocop-ast (1.
|
|
64
|
-
parser (>= 3.3.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
rubocop (>= 1.
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
67
|
+
rubocop-ast (1.49.0)
|
|
68
|
+
parser (>= 3.3.7.2)
|
|
69
|
+
prism (~> 1.7)
|
|
70
|
+
rubocop-minitest (0.38.2)
|
|
71
|
+
lint_roller (~> 1.1)
|
|
72
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
73
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
|
74
|
+
rubocop-performance (1.26.1)
|
|
75
|
+
lint_roller (~> 1.1)
|
|
76
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
77
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
78
|
+
rubocop-rails (2.34.3)
|
|
72
79
|
activesupport (>= 4.2.0)
|
|
80
|
+
lint_roller (~> 1.1)
|
|
73
81
|
rack (>= 1.1)
|
|
74
|
-
rubocop (>= 1.
|
|
75
|
-
rubocop-ast (>= 1.
|
|
76
|
-
rubocop-rake (0.
|
|
77
|
-
|
|
82
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
83
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
|
84
|
+
rubocop-rake (0.7.1)
|
|
85
|
+
lint_roller (~> 1.1)
|
|
86
|
+
rubocop (>= 1.72.1)
|
|
78
87
|
ruby-progressbar (1.13.0)
|
|
79
|
-
ruby_audit (
|
|
88
|
+
ruby_audit (3.1.0)
|
|
80
89
|
bundler-audit (~> 0.9.0)
|
|
81
|
-
|
|
82
|
-
sqlite3 (
|
|
83
|
-
sqlite3 (
|
|
84
|
-
sqlite3 (
|
|
85
|
-
sqlite3 (
|
|
86
|
-
sqlite3 (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
securerandom (0.4.1)
|
|
91
|
+
sqlite3 (2.9.0-aarch64-linux-gnu)
|
|
92
|
+
sqlite3 (2.9.0-aarch64-linux-musl)
|
|
93
|
+
sqlite3 (2.9.0-arm-linux-gnu)
|
|
94
|
+
sqlite3 (2.9.0-arm-linux-musl)
|
|
95
|
+
sqlite3 (2.9.0-arm64-darwin)
|
|
96
|
+
sqlite3 (2.9.0-x86-linux-gnu)
|
|
97
|
+
sqlite3 (2.9.0-x86-linux-musl)
|
|
98
|
+
sqlite3 (2.9.0-x86_64-darwin)
|
|
99
|
+
sqlite3 (2.9.0-x86_64-linux-gnu)
|
|
100
|
+
sqlite3 (2.9.0-x86_64-linux-musl)
|
|
101
|
+
temping (4.4.0)
|
|
102
|
+
activerecord (>= 6.0, < 8.2)
|
|
103
|
+
activesupport (>= 6.0, < 8.2)
|
|
104
|
+
thor (1.5.0)
|
|
105
|
+
timeout (0.6.0)
|
|
92
106
|
tzinfo (2.0.6)
|
|
93
107
|
concurrent-ruby (~> 1.0)
|
|
94
|
-
unicode-display_width (2.
|
|
108
|
+
unicode-display_width (3.2.0)
|
|
109
|
+
unicode-emoji (~> 4.1)
|
|
110
|
+
unicode-emoji (4.2.0)
|
|
111
|
+
uri (1.1.1)
|
|
95
112
|
|
|
96
113
|
PLATFORMS
|
|
97
|
-
aarch64-linux
|
|
98
|
-
|
|
114
|
+
aarch64-linux-gnu
|
|
115
|
+
aarch64-linux-musl
|
|
116
|
+
arm-linux-gnu
|
|
117
|
+
arm-linux-musl
|
|
99
118
|
arm64-darwin
|
|
100
|
-
x86-linux
|
|
119
|
+
x86-linux-gnu
|
|
120
|
+
x86-linux-musl
|
|
101
121
|
x86_64-darwin
|
|
102
|
-
x86_64-linux
|
|
122
|
+
x86_64-linux-gnu
|
|
123
|
+
x86_64-linux-musl
|
|
103
124
|
|
|
104
125
|
DEPENDENCIES
|
|
105
|
-
bundler (~> 2.
|
|
126
|
+
bundler (~> 2.6)
|
|
106
127
|
bundler-audit
|
|
107
128
|
hierarchable!
|
|
108
129
|
minitest (~> 5.0)
|
|
@@ -113,8 +134,8 @@ DEPENDENCIES
|
|
|
113
134
|
rubocop-rails
|
|
114
135
|
rubocop-rake
|
|
115
136
|
ruby_audit
|
|
116
|
-
sqlite3
|
|
137
|
+
sqlite3 (~> 2.0, >= 2.0.2)
|
|
117
138
|
temping (~> 4.0)
|
|
118
139
|
|
|
119
140
|
BUNDLED WITH
|
|
120
|
-
2.
|
|
141
|
+
2.6.9
|
data/hierarchable.gemspec
CHANGED
|
@@ -41,9 +41,9 @@ Gem::Specification.new do |spec|
|
|
|
41
41
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
42
42
|
spec.require_paths = ['lib']
|
|
43
43
|
|
|
44
|
-
spec.required_ruby_version = '>= 3.
|
|
44
|
+
spec.required_ruby_version = '>= 3.4'
|
|
45
45
|
|
|
46
|
-
spec.
|
|
47
|
-
spec.
|
|
46
|
+
spec.add_dependency('activerecord', '> 4.2.0')
|
|
47
|
+
spec.add_dependency('activesupport', '> 4.2.0')
|
|
48
48
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
49
49
|
end
|
|
@@ -351,8 +351,8 @@ module Hierarchable
|
|
|
351
351
|
models.each do |model|
|
|
352
352
|
model = model.safe_constantize if model.is_a?(String)
|
|
353
353
|
query = model.where(
|
|
354
|
-
hierarchy_parent_type
|
|
355
|
-
hierarchy_parent_id:
|
|
354
|
+
hierarchy_parent_type:,
|
|
355
|
+
hierarchy_parent_id:
|
|
356
356
|
)
|
|
357
357
|
query = query.where.not(id:) if model == self.class && !include_self
|
|
358
358
|
result[model.to_s] = query
|
|
@@ -455,7 +455,7 @@ module Hierarchable
|
|
|
455
455
|
hierarchy_root_id: id
|
|
456
456
|
)
|
|
457
457
|
else
|
|
458
|
-
path =
|
|
458
|
+
path = hierarchy_full_path
|
|
459
459
|
model.where(
|
|
460
460
|
'hierarchy_ancestors_path LIKE ?',
|
|
461
461
|
"#{model.sanitize_sql_like(path)}%"
|
|
@@ -607,12 +607,12 @@ module Hierarchable
|
|
|
607
607
|
path = []
|
|
608
608
|
hierarchy_full_path.split(hierarchable_config[:path_separator])
|
|
609
609
|
.each do |record|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
610
|
+
ancestor_class_name, ancestor_id = record.split(
|
|
611
|
+
hierarchable_config[:record_separator]
|
|
612
|
+
)
|
|
613
|
+
ancestor_class = ancestor_class_name.safe_constantize
|
|
614
|
+
path << ancestor_class
|
|
615
|
+
path << ancestor_class.find(ancestor_id)
|
|
616
616
|
end
|
|
617
617
|
path
|
|
618
618
|
end
|
data/lib/hierarchable/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hierarchable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Patrick R. Schmid
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activerecord
|
|
@@ -47,6 +46,7 @@ extensions: []
|
|
|
47
46
|
extra_rdoc_files: []
|
|
48
47
|
files:
|
|
49
48
|
- ".circleci/config.yml"
|
|
49
|
+
- ".github/dependabot.yml"
|
|
50
50
|
- ".gitignore"
|
|
51
51
|
- ".rubocop.yml"
|
|
52
52
|
- ".ruby-gemset"
|
|
@@ -70,7 +70,6 @@ metadata:
|
|
|
70
70
|
source_code_uri: https://github.com/prschmid/hierarchable
|
|
71
71
|
changelog_uri: https://github.com/prschmid/hierarchable
|
|
72
72
|
rubygems_mfa_required: 'true'
|
|
73
|
-
post_install_message:
|
|
74
73
|
rdoc_options: []
|
|
75
74
|
require_paths:
|
|
76
75
|
- lib
|
|
@@ -78,15 +77,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
78
77
|
requirements:
|
|
79
78
|
- - ">="
|
|
80
79
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '3.
|
|
80
|
+
version: '3.4'
|
|
82
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
82
|
requirements:
|
|
84
83
|
- - ">="
|
|
85
84
|
- !ruby/object:Gem::Version
|
|
86
85
|
version: '0'
|
|
87
86
|
requirements: []
|
|
88
|
-
rubygems_version: 3.
|
|
89
|
-
signing_key:
|
|
87
|
+
rubygems_version: 3.6.9
|
|
90
88
|
specification_version: 4
|
|
91
89
|
summary: Cross model hierarchical (parent, child, sibling) relationship between ActiveRecord
|
|
92
90
|
models.
|