parentry 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +18 -5
- data/Appraisals +4 -0
- data/README.md +19 -2
- data/gemfiles/activerecord_5.1.5.gemfile.lock +12 -4
- data/gemfiles/activerecord_5.2.0.gemfile.lock +12 -4
- data/gemfiles/activerecord_6.0.0.gemfile +8 -0
- data/gemfiles/activerecord_6.0.0.gemfile.lock +125 -0
- data/lib/parentry/version.rb +1 -1
- data/parentry.gemspec +3 -2
- metadata +25 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 150d028e7c67a5ba486cc8cb1ce84dc0ca3eaf44aca39574aadac17e4547538e
|
4
|
+
data.tar.gz: 57b4a9473187ae9f9f207ad6fb2e09eab953db324eaddbb32f33265ace8b4cdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a3de9008810d9930a6f7243a6dcb1533af06df80c864c9bf3c81ba1d4a0b6330c693122e139cb441811c7be14f9506468657d44c3888234ce77df2faf2f3e62
|
7
|
+
data.tar.gz: b95e3f69a71e6d4151d093dcf7395e641a9e02089c298681e85c60d09e5a1e179affeb383359b585fc521876832ef091036bd67474a062d885bab3e20329543f
|
data/.travis.yml
CHANGED
@@ -1,12 +1,25 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.3
|
5
|
-
- 2.4.1
|
3
|
+
- 2.5.3
|
4
|
+
- 2.6.3
|
6
5
|
env:
|
7
|
-
|
8
|
-
|
6
|
+
global:
|
7
|
+
- CC_TEST_REPORTER_ID=4a8875ec1a4bd9cc55d9fe48779be866f90ac331155d039fa3d13b2a61b4fa9f
|
8
|
+
matrix:
|
9
|
+
- STRATEGY=array
|
10
|
+
- STRATEGY=ltree
|
11
|
+
before_script:
|
12
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
13
|
+
- chmod +x ./cc-test-reporter
|
14
|
+
- ./cc-test-reporter before-build
|
9
15
|
gemfile:
|
10
16
|
- gemfiles/activerecord_5.1.5.gemfile
|
11
17
|
- gemfiles/activerecord_5.2.0.gemfile
|
18
|
+
- gemfiles/activerecord_6.0.0.gemfile
|
12
19
|
before_install: gem install bundler -v 1.10.6
|
20
|
+
after_script:
|
21
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
22
|
+
addons:
|
23
|
+
postgresql: "9.6"
|
24
|
+
services:
|
25
|
+
- postgresql
|
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/hasghari/parentry.svg?branch=master)](https://travis-ci.org/hasghari/parentry)
|
2
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/cc7180328fffcbdea2bb/maintainability)](https://codeclimate.com/github/hasghari/parentry/maintainability)
|
3
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/cc7180328fffcbdea2bb/test_coverage)](https://codeclimate.com/github/hasghari/parentry/test_coverage)
|
2
4
|
|
3
5
|
# Parentry
|
4
6
|
|
@@ -24,11 +26,26 @@ Or install it yourself as:
|
|
24
26
|
|
25
27
|
## Usage
|
26
28
|
|
27
|
-
This gem requires 2 columns for each table: `parentry` and `parent_id
|
29
|
+
This gem requires 2 columns for each table: `parentry` and `parent_id`, and can leverage either the `ltree` postgresql extension, or else postgres `array` columns. A sample migration would look like:
|
28
30
|
|
29
31
|
```ruby
|
30
|
-
|
32
|
+
enable_extension 'ltree' # ltree is not turned on by default; skip if you use the array strategy
|
33
|
+
|
31
34
|
add_column :my_table, :parent_id, :integer
|
35
|
+
|
36
|
+
add_column :my_table, :parentry, :ltree
|
37
|
+
add_column :my_table, :parentry_depth, :integer, default: 0 # optional
|
38
|
+
|
39
|
+
add_index :my_table, :parentry, using: :gist
|
40
|
+
```
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
class MyTable < ApplicationRecord
|
44
|
+
include Parentry
|
45
|
+
parentry cache_depth: true
|
46
|
+
# to change strategy to array, and avoid dependency on ltree
|
47
|
+
# parentry strategy: :array
|
48
|
+
end
|
32
49
|
```
|
33
50
|
|
34
51
|
## Contributing
|
@@ -2,7 +2,7 @@ PATH
|
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
4
|
parentry (1.2.0)
|
5
|
-
activerecord (>= 5.1, < 6.
|
5
|
+
activerecord (>= 5.1, < 6.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
arel (8.0.0)
|
39
39
|
builder (3.2.3)
|
40
40
|
coderay (1.1.2)
|
41
|
-
combustion (
|
41
|
+
combustion (1.1.1)
|
42
42
|
activesupport (>= 3.0.0)
|
43
43
|
railties (>= 3.0.0)
|
44
44
|
thor (>= 0.14.6)
|
@@ -46,9 +46,11 @@ GEM
|
|
46
46
|
crass (1.0.3)
|
47
47
|
database_cleaner (1.6.2)
|
48
48
|
diff-lcs (1.3)
|
49
|
+
docile (1.3.0)
|
49
50
|
erubi (1.7.1)
|
50
51
|
i18n (0.9.5)
|
51
52
|
concurrent-ruby (~> 1.0)
|
53
|
+
json (2.1.0)
|
52
54
|
loofah (2.2.2)
|
53
55
|
crass (~> 1.0.2)
|
54
56
|
nokogiri (>= 1.5.9)
|
@@ -93,6 +95,11 @@ GEM
|
|
93
95
|
rspec-mocks (~> 3.7.0)
|
94
96
|
rspec-support (~> 3.7.0)
|
95
97
|
rspec-support (3.7.1)
|
98
|
+
simplecov (0.16.1)
|
99
|
+
docile (~> 1.1)
|
100
|
+
json (>= 1.8, < 3)
|
101
|
+
simplecov-html (~> 0.10.0)
|
102
|
+
simplecov-html (0.10.2)
|
96
103
|
thor (0.20.0)
|
97
104
|
thread_safe (0.3.6)
|
98
105
|
tzinfo (1.2.5)
|
@@ -105,13 +112,14 @@ DEPENDENCIES
|
|
105
112
|
activerecord (= 5.1.5)
|
106
113
|
appraisal
|
107
114
|
bundler (~> 1.10)
|
108
|
-
combustion (
|
115
|
+
combustion (~> 1.1)
|
109
116
|
database_cleaner (~> 1.6)
|
110
117
|
parentry!
|
111
118
|
pg (~> 0.21)
|
112
119
|
pry (~> 0.10)
|
113
120
|
rake (~> 10.0)
|
114
121
|
rspec-rails (~> 3.7)
|
122
|
+
simplecov (~> 0.16)
|
115
123
|
|
116
124
|
BUNDLED WITH
|
117
|
-
1.
|
125
|
+
1.17.2
|
@@ -2,7 +2,7 @@ PATH
|
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
4
|
parentry (1.2.0)
|
5
|
-
activerecord (>= 5.1, < 6.
|
5
|
+
activerecord (>= 5.1, < 6.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
arel (9.0.0)
|
39
39
|
builder (3.2.3)
|
40
40
|
coderay (1.1.2)
|
41
|
-
combustion (
|
41
|
+
combustion (1.1.1)
|
42
42
|
activesupport (>= 3.0.0)
|
43
43
|
railties (>= 3.0.0)
|
44
44
|
thor (>= 0.14.6)
|
@@ -46,9 +46,11 @@ GEM
|
|
46
46
|
crass (1.0.4)
|
47
47
|
database_cleaner (1.6.2)
|
48
48
|
diff-lcs (1.3)
|
49
|
+
docile (1.3.0)
|
49
50
|
erubi (1.7.1)
|
50
51
|
i18n (1.0.0)
|
51
52
|
concurrent-ruby (~> 1.0)
|
53
|
+
json (2.1.0)
|
52
54
|
loofah (2.2.2)
|
53
55
|
crass (~> 1.0.2)
|
54
56
|
nokogiri (>= 1.5.9)
|
@@ -93,6 +95,11 @@ GEM
|
|
93
95
|
rspec-mocks (~> 3.7.0)
|
94
96
|
rspec-support (~> 3.7.0)
|
95
97
|
rspec-support (3.7.1)
|
98
|
+
simplecov (0.16.1)
|
99
|
+
docile (~> 1.1)
|
100
|
+
json (>= 1.8, < 3)
|
101
|
+
simplecov-html (~> 0.10.0)
|
102
|
+
simplecov-html (0.10.2)
|
96
103
|
thor (0.20.0)
|
97
104
|
thread_safe (0.3.6)
|
98
105
|
tzinfo (1.2.5)
|
@@ -105,13 +112,14 @@ DEPENDENCIES
|
|
105
112
|
activerecord (= 5.2.0)
|
106
113
|
appraisal
|
107
114
|
bundler (~> 1.10)
|
108
|
-
combustion (
|
115
|
+
combustion (~> 1.1)
|
109
116
|
database_cleaner (~> 1.6)
|
110
117
|
parentry!
|
111
118
|
pg (~> 0.21)
|
112
119
|
pry (~> 0.10)
|
113
120
|
rake (~> 10.0)
|
114
121
|
rspec-rails (~> 3.7)
|
122
|
+
simplecov (~> 0.16)
|
115
123
|
|
116
124
|
BUNDLED WITH
|
117
|
-
1.
|
125
|
+
1.17.2
|
@@ -0,0 +1,125 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
parentry (1.2.0)
|
5
|
+
activerecord (>= 5.1, < 6.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionpack (6.0.0)
|
11
|
+
actionview (= 6.0.0)
|
12
|
+
activesupport (= 6.0.0)
|
13
|
+
rack (~> 2.0)
|
14
|
+
rack-test (>= 0.6.3)
|
15
|
+
rails-dom-testing (~> 2.0)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
+
actionview (6.0.0)
|
18
|
+
activesupport (= 6.0.0)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubi (~> 1.4)
|
21
|
+
rails-dom-testing (~> 2.0)
|
22
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
+
activemodel (6.0.0)
|
24
|
+
activesupport (= 6.0.0)
|
25
|
+
activerecord (6.0.0)
|
26
|
+
activemodel (= 6.0.0)
|
27
|
+
activesupport (= 6.0.0)
|
28
|
+
activesupport (6.0.0)
|
29
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
30
|
+
i18n (>= 0.7, < 2)
|
31
|
+
minitest (~> 5.1)
|
32
|
+
tzinfo (~> 1.1)
|
33
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
34
|
+
appraisal (2.2.0)
|
35
|
+
bundler
|
36
|
+
rake
|
37
|
+
thor (>= 0.14.0)
|
38
|
+
builder (3.2.3)
|
39
|
+
coderay (1.1.2)
|
40
|
+
combustion (1.1.1)
|
41
|
+
activesupport (>= 3.0.0)
|
42
|
+
railties (>= 3.0.0)
|
43
|
+
thor (>= 0.14.6)
|
44
|
+
concurrent-ruby (1.1.5)
|
45
|
+
crass (1.0.4)
|
46
|
+
database_cleaner (1.7.0)
|
47
|
+
diff-lcs (1.3)
|
48
|
+
docile (1.3.2)
|
49
|
+
erubi (1.8.0)
|
50
|
+
i18n (1.6.0)
|
51
|
+
concurrent-ruby (~> 1.0)
|
52
|
+
json (2.2.0)
|
53
|
+
loofah (2.2.3)
|
54
|
+
crass (~> 1.0.2)
|
55
|
+
nokogiri (>= 1.5.9)
|
56
|
+
method_source (0.9.2)
|
57
|
+
mini_portile2 (2.4.0)
|
58
|
+
minitest (5.11.3)
|
59
|
+
nokogiri (1.10.4)
|
60
|
+
mini_portile2 (~> 2.4.0)
|
61
|
+
pg (0.21.0)
|
62
|
+
pry (0.12.2)
|
63
|
+
coderay (~> 1.1.0)
|
64
|
+
method_source (~> 0.9.0)
|
65
|
+
rack (2.0.7)
|
66
|
+
rack-test (1.1.0)
|
67
|
+
rack (>= 1.0, < 3)
|
68
|
+
rails-dom-testing (2.0.3)
|
69
|
+
activesupport (>= 4.2.0)
|
70
|
+
nokogiri (>= 1.6)
|
71
|
+
rails-html-sanitizer (1.2.0)
|
72
|
+
loofah (~> 2.2, >= 2.2.2)
|
73
|
+
railties (6.0.0)
|
74
|
+
actionpack (= 6.0.0)
|
75
|
+
activesupport (= 6.0.0)
|
76
|
+
method_source
|
77
|
+
rake (>= 0.8.7)
|
78
|
+
thor (>= 0.20.3, < 2.0)
|
79
|
+
rake (10.5.0)
|
80
|
+
rspec-core (3.8.2)
|
81
|
+
rspec-support (~> 3.8.0)
|
82
|
+
rspec-expectations (3.8.4)
|
83
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
+
rspec-support (~> 3.8.0)
|
85
|
+
rspec-mocks (3.8.1)
|
86
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
87
|
+
rspec-support (~> 3.8.0)
|
88
|
+
rspec-rails (3.8.2)
|
89
|
+
actionpack (>= 3.0)
|
90
|
+
activesupport (>= 3.0)
|
91
|
+
railties (>= 3.0)
|
92
|
+
rspec-core (~> 3.8.0)
|
93
|
+
rspec-expectations (~> 3.8.0)
|
94
|
+
rspec-mocks (~> 3.8.0)
|
95
|
+
rspec-support (~> 3.8.0)
|
96
|
+
rspec-support (3.8.2)
|
97
|
+
simplecov (0.17.0)
|
98
|
+
docile (~> 1.1)
|
99
|
+
json (>= 1.8, < 3)
|
100
|
+
simplecov-html (~> 0.10.0)
|
101
|
+
simplecov-html (0.10.2)
|
102
|
+
thor (0.20.3)
|
103
|
+
thread_safe (0.3.6)
|
104
|
+
tzinfo (1.2.5)
|
105
|
+
thread_safe (~> 0.1)
|
106
|
+
zeitwerk (2.1.9)
|
107
|
+
|
108
|
+
PLATFORMS
|
109
|
+
ruby
|
110
|
+
|
111
|
+
DEPENDENCIES
|
112
|
+
activerecord (= 6.0.0)
|
113
|
+
appraisal
|
114
|
+
bundler (~> 1.10)
|
115
|
+
combustion (~> 1.1)
|
116
|
+
database_cleaner (~> 1.6)
|
117
|
+
parentry!
|
118
|
+
pg (~> 0.21)
|
119
|
+
pry (~> 0.10)
|
120
|
+
rake (~> 10.0)
|
121
|
+
rspec-rails (~> 3.7)
|
122
|
+
simplecov (~> 0.16)
|
123
|
+
|
124
|
+
BUNDLED WITH
|
125
|
+
1.17.2
|
data/lib/parentry/version.rb
CHANGED
data/parentry.gemspec
CHANGED
@@ -16,13 +16,14 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
17
|
spec.require_paths = ['lib']
|
18
18
|
|
19
|
-
spec.add_dependency 'activerecord', '>= 5.1', '< 6.
|
19
|
+
spec.add_dependency 'activerecord', '>= 5.1', '< 6.1'
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
23
|
spec.add_development_dependency 'rspec-rails', '~> 3.7'
|
24
24
|
spec.add_development_dependency 'pg', '~> 0.21'
|
25
|
-
spec.add_development_dependency 'combustion', '
|
25
|
+
spec.add_development_dependency 'combustion', '~> 1.1'
|
26
26
|
spec.add_development_dependency 'database_cleaner', '~> 1.6'
|
27
27
|
spec.add_development_dependency 'pry', '~> 0.10'
|
28
|
+
spec.add_development_dependency 'simplecov', '~> 0.16'
|
28
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parentry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hamed Asghari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '6.
|
22
|
+
version: '6.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '6.
|
32
|
+
version: '6.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,16 +90,16 @@ dependencies:
|
|
90
90
|
name: combustion
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: '1.1'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: '1.1'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: database_cleaner
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,6 +128,20 @@ dependencies:
|
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0.10'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: simplecov
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0.16'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0.16'
|
131
145
|
description:
|
132
146
|
email:
|
133
147
|
- hasghari@gmail.com
|
@@ -150,6 +164,8 @@ files:
|
|
150
164
|
- gemfiles/activerecord_5.1.5.gemfile.lock
|
151
165
|
- gemfiles/activerecord_5.2.0.gemfile
|
152
166
|
- gemfiles/activerecord_5.2.0.gemfile.lock
|
167
|
+
- gemfiles/activerecord_6.0.0.gemfile
|
168
|
+
- gemfiles/activerecord_6.0.0.gemfile.lock
|
153
169
|
- lib/parentry.rb
|
154
170
|
- lib/parentry/class_methods.rb
|
155
171
|
- lib/parentry/instance_methods.rb
|
@@ -182,8 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
198
|
- !ruby/object:Gem::Version
|
183
199
|
version: '0'
|
184
200
|
requirements: []
|
185
|
-
|
186
|
-
rubygems_version: 2.6.13
|
201
|
+
rubygems_version: 3.0.3
|
187
202
|
signing_key:
|
188
203
|
specification_version: 4
|
189
204
|
summary: ActiveRecord adapter for the Postgres ltree module
|