parentry 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 150d028e7c67a5ba486cc8cb1ce84dc0ca3eaf44aca39574aadac17e4547538e
4
- data.tar.gz: 57b4a9473187ae9f9f207ad6fb2e09eab953db324eaddbb32f33265ace8b4cdc
3
+ metadata.gz: 66be4e773ca40d1773b87815cf33bd8d6f8cb4796718d64e4bec62ddeb53b3e5
4
+ data.tar.gz: 45039c18a5c69ebc0277cf38a48e46d3f17520be92e0409e6d1a4d5872f0b120
5
5
  SHA512:
6
- metadata.gz: 6a3de9008810d9930a6f7243a6dcb1533af06df80c864c9bf3c81ba1d4a0b6330c693122e139cb441811c7be14f9506468657d44c3888234ce77df2faf2f3e62
7
- data.tar.gz: b95e3f69a71e6d4151d093dcf7395e641a9e02089c298681e85c60d09e5a1e179affeb383359b585fc521876832ef091036bd67474a062d885bab3e20329543f
6
+ metadata.gz: '000976a1fecf1bf1b004f44a1943d8f85e6d80b5835a3bb6a50efebd3735e6ee1cd116e8789759fce424130bab1b796a5992526112cf165f1556621c67c2b33f'
7
+ data.tar.gz: 136945945ecb766008a7545cadbd68b3d68a7d5bf151168991457831c0ddc1185dd87f89f1f5a78a1711afc046de60d08dd84452999eaec08acbbe30e5c53cb5
@@ -0,0 +1,72 @@
1
+ name: Ruby
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ strategy:
11
+ matrix:
12
+ ruby:
13
+ - 2.5.x
14
+ - 2.6.x
15
+ - 2.7.x
16
+ activerecord:
17
+ - 5.1.5
18
+ - 5.2.0
19
+ - 6.0.0
20
+ - 6.1.0
21
+ strategy:
22
+ - array
23
+ - ltree
24
+
25
+ env:
26
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/activerecord_${{ matrix.activerecord }}.gemfile
27
+
28
+ services:
29
+ postgres:
30
+ image: postgres:12.4
31
+ env:
32
+ POSTGRES_USER: postgres
33
+ POSTGRES_PASSWORD: postgres
34
+ POSTGRES_DB: parentry_test
35
+ ports:
36
+ - 5432:5432
37
+ # needed because the postgres container does not provide a healthcheck
38
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
39
+
40
+ steps:
41
+ - uses: actions/checkout@v2
42
+
43
+ - name: Set up Ruby
44
+ uses: actions/setup-ruby@v1
45
+ with:
46
+ ruby-version: ${{ matrix.ruby }}
47
+
48
+ - uses: actions/cache@v1
49
+ with:
50
+ path: vendor/bundle
51
+ key: ${{ runner.os }}-gems-${{ hashFiles(format('gemfiles/activerecord_{0}.gemfile.lock', matrix.activerecord)) }}
52
+ restore-keys: |
53
+ ${{ runner.os }}-gems-
54
+
55
+ - name: Install PostgreSQL client
56
+ run: |
57
+ sudo apt-get -yqq install libpq-dev
58
+
59
+ - name: Configure Bundler
60
+ run: |
61
+ gem install bundler:2.1.4 --no-document
62
+ bundle config set path 'vendor/bundle'
63
+ bundle install --jobs 4 --retry 3
64
+
65
+ - name: Run tests with RSpec
66
+ uses: paambaati/codeclimate-action@v2.5.4
67
+ env:
68
+ CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
69
+ STRATEGY: ${{ matrix.strategy }}
70
+ with:
71
+ coverageCommand: bundle exec rspec
72
+ debug: false
@@ -0,0 +1,38 @@
1
+ inherit_mode:
2
+ merge:
3
+ - Exclude
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.6
7
+ Exclude:
8
+ - gemfiles/**
9
+
10
+ Layout/LineLength:
11
+ Max: 120
12
+
13
+ Layout/MultilineMethodCallIndentation:
14
+ EnforcedStyle: indented_relative_to_receiver
15
+
16
+ Naming/PredicateName:
17
+ AllowedMethods:
18
+ - has_many
19
+
20
+ Style/Documentation:
21
+ Enabled: false
22
+
23
+ Style/EmptyMethod:
24
+ EnforcedStyle: expanded
25
+
26
+ Style/FormatStringToken:
27
+ EnforcedStyle: template
28
+
29
+ Style/FrozenStringLiteralComment:
30
+ Enabled: false
31
+
32
+ Style/PercentLiteralDelimiters:
33
+ PreferredDelimiters:
34
+ default: ()
35
+ '%w': '()'
36
+ '%W': '()'
37
+ '%i': '()'
38
+ '%I': '()'
@@ -0,0 +1 @@
1
+ ruby 2.7.2
data/Appraisals CHANGED
@@ -9,3 +9,7 @@ end
9
9
  appraise 'activerecord-6.0.0' do
10
10
  gem 'activerecord', '6.0.0'
11
11
  end
12
+
13
+ appraise 'activerecord-6.1.0' do
14
+ gem 'activerecord', '6.0.0'
15
+ end
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
- [![Build Status](https://travis-ci.org/hasghari/parentry.svg?branch=master)](https://travis-ci.org/hasghari/parentry)
1
+ ![](https://github.com/hasghari/parentry/workflows/Ruby/badge.svg)
2
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)
4
3
 
5
4
  # Parentry
6
5
 
data/Rakefile CHANGED
@@ -6,4 +6,4 @@ require 'rspec/core/rake_task'
6
6
 
7
7
  RSpec::Core::RakeTask.new(:spec)
8
8
 
9
- task :default => :spec
9
+ task default: :spec
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- parentry (1.2.0)
5
- activerecord (>= 5.1, < 6.1)
4
+ parentry (1.3.0)
5
+ activerecord (>= 5.1, < 6.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -36,6 +36,7 @@ GEM
36
36
  rake
37
37
  thor (>= 0.14.0)
38
38
  arel (8.0.0)
39
+ ast (2.4.0)
39
40
  builder (3.2.3)
40
41
  coderay (1.1.2)
41
42
  combustion (1.1.1)
@@ -50,16 +51,20 @@ GEM
50
51
  erubi (1.7.1)
51
52
  i18n (0.9.5)
52
53
  concurrent-ruby (~> 1.0)
53
- json (2.1.0)
54
+ jaro_winkler (1.5.4)
55
+ json (2.3.1)
54
56
  loofah (2.2.2)
55
57
  crass (~> 1.0.2)
56
58
  nokogiri (>= 1.5.9)
57
59
  method_source (0.9.0)
58
- mini_portile2 (2.3.0)
60
+ mini_portile2 (2.4.0)
59
61
  minitest (5.11.3)
60
- nokogiri (1.8.2)
61
- mini_portile2 (~> 2.3.0)
62
- pg (0.21.0)
62
+ nokogiri (1.10.7)
63
+ mini_portile2 (~> 2.4.0)
64
+ parallel (1.19.1)
65
+ parser (2.7.0.2)
66
+ ast (~> 2.4.0)
67
+ pg (1.2.2)
63
68
  pry (0.11.3)
64
69
  coderay (~> 1.1.0)
65
70
  method_source (~> 0.9.0)
@@ -77,7 +82,8 @@ GEM
77
82
  method_source
78
83
  rake (>= 0.8.7)
79
84
  thor (>= 0.18.1, < 2.0)
80
- rake (10.5.0)
85
+ rainbow (3.0.0)
86
+ rake (12.3.3)
81
87
  rspec-core (3.7.1)
82
88
  rspec-support (~> 3.7.0)
83
89
  rspec-expectations (3.7.0)
@@ -95,6 +101,16 @@ GEM
95
101
  rspec-mocks (~> 3.7.0)
96
102
  rspec-support (~> 3.7.0)
97
103
  rspec-support (3.7.1)
104
+ rubocop (0.79.0)
105
+ jaro_winkler (~> 1.5.1)
106
+ parallel (~> 1.10)
107
+ parser (>= 2.7.0.1)
108
+ rainbow (>= 2.2.2, < 4.0)
109
+ ruby-progressbar (~> 1.7)
110
+ unicode-display_width (>= 1.4.0, < 1.7)
111
+ rubocop-rspec (1.37.1)
112
+ rubocop (>= 0.68.1)
113
+ ruby-progressbar (1.10.1)
98
114
  simplecov (0.16.1)
99
115
  docile (~> 1.1)
100
116
  json (>= 1.8, < 3)
@@ -102,8 +118,9 @@ GEM
102
118
  simplecov-html (0.10.2)
103
119
  thor (0.20.0)
104
120
  thread_safe (0.3.6)
105
- tzinfo (1.2.5)
121
+ tzinfo (1.2.8)
106
122
  thread_safe (~> 0.1)
123
+ unicode-display_width (1.6.1)
107
124
 
108
125
  PLATFORMS
109
126
  ruby
@@ -111,15 +128,16 @@ PLATFORMS
111
128
  DEPENDENCIES
112
129
  activerecord (= 5.1.5)
113
130
  appraisal
114
- bundler (~> 1.10)
131
+ bundler (~> 2.1)
115
132
  combustion (~> 1.1)
116
133
  database_cleaner (~> 1.6)
117
134
  parentry!
118
- pg (~> 0.21)
135
+ pg (~> 1.2)
119
136
  pry (~> 0.10)
120
- rake (~> 10.0)
137
+ rake (~> 12.3)
121
138
  rspec-rails (~> 3.7)
139
+ rubocop-rspec (~> 1.37)
122
140
  simplecov (~> 0.16)
123
141
 
124
142
  BUNDLED WITH
125
- 1.17.2
143
+ 2.1.4
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- parentry (1.2.0)
5
- activerecord (>= 5.1, < 6.1)
4
+ parentry (1.3.0)
5
+ activerecord (>= 5.1, < 6.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -36,6 +36,7 @@ GEM
36
36
  rake
37
37
  thor (>= 0.14.0)
38
38
  arel (9.0.0)
39
+ ast (2.4.0)
39
40
  builder (3.2.3)
40
41
  coderay (1.1.2)
41
42
  combustion (1.1.1)
@@ -50,16 +51,20 @@ GEM
50
51
  erubi (1.7.1)
51
52
  i18n (1.0.0)
52
53
  concurrent-ruby (~> 1.0)
53
- json (2.1.0)
54
+ jaro_winkler (1.5.4)
55
+ json (2.3.1)
54
56
  loofah (2.2.2)
55
57
  crass (~> 1.0.2)
56
58
  nokogiri (>= 1.5.9)
57
59
  method_source (0.9.0)
58
- mini_portile2 (2.3.0)
60
+ mini_portile2 (2.4.0)
59
61
  minitest (5.11.3)
60
- nokogiri (1.8.2)
61
- mini_portile2 (~> 2.3.0)
62
- pg (0.21.0)
62
+ nokogiri (1.10.7)
63
+ mini_portile2 (~> 2.4.0)
64
+ parallel (1.19.1)
65
+ parser (2.7.0.2)
66
+ ast (~> 2.4.0)
67
+ pg (1.2.2)
63
68
  pry (0.11.3)
64
69
  coderay (~> 1.1.0)
65
70
  method_source (~> 0.9.0)
@@ -77,7 +82,8 @@ GEM
77
82
  method_source
78
83
  rake (>= 0.8.7)
79
84
  thor (>= 0.18.1, < 2.0)
80
- rake (10.5.0)
85
+ rainbow (3.0.0)
86
+ rake (12.3.3)
81
87
  rspec-core (3.7.1)
82
88
  rspec-support (~> 3.7.0)
83
89
  rspec-expectations (3.7.0)
@@ -95,6 +101,16 @@ GEM
95
101
  rspec-mocks (~> 3.7.0)
96
102
  rspec-support (~> 3.7.0)
97
103
  rspec-support (3.7.1)
104
+ rubocop (0.79.0)
105
+ jaro_winkler (~> 1.5.1)
106
+ parallel (~> 1.10)
107
+ parser (>= 2.7.0.1)
108
+ rainbow (>= 2.2.2, < 4.0)
109
+ ruby-progressbar (~> 1.7)
110
+ unicode-display_width (>= 1.4.0, < 1.7)
111
+ rubocop-rspec (1.37.1)
112
+ rubocop (>= 0.68.1)
113
+ ruby-progressbar (1.10.1)
98
114
  simplecov (0.16.1)
99
115
  docile (~> 1.1)
100
116
  json (>= 1.8, < 3)
@@ -102,8 +118,9 @@ GEM
102
118
  simplecov-html (0.10.2)
103
119
  thor (0.20.0)
104
120
  thread_safe (0.3.6)
105
- tzinfo (1.2.5)
121
+ tzinfo (1.2.8)
106
122
  thread_safe (~> 0.1)
123
+ unicode-display_width (1.6.1)
107
124
 
108
125
  PLATFORMS
109
126
  ruby
@@ -111,15 +128,16 @@ PLATFORMS
111
128
  DEPENDENCIES
112
129
  activerecord (= 5.2.0)
113
130
  appraisal
114
- bundler (~> 1.10)
131
+ bundler (~> 2.1)
115
132
  combustion (~> 1.1)
116
133
  database_cleaner (~> 1.6)
117
134
  parentry!
118
- pg (~> 0.21)
135
+ pg (~> 1.2)
119
136
  pry (~> 0.10)
120
- rake (~> 10.0)
137
+ rake (~> 12.3)
121
138
  rspec-rails (~> 3.7)
139
+ rubocop-rspec (~> 1.37)
122
140
  simplecov (~> 0.16)
123
141
 
124
142
  BUNDLED WITH
125
- 1.17.2
143
+ 2.1.4
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- parentry (1.2.0)
5
- activerecord (>= 5.1, < 6.1)
4
+ parentry (1.3.0)
5
+ activerecord (>= 5.1, < 6.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -35,6 +35,7 @@ GEM
35
35
  bundler
36
36
  rake
37
37
  thor (>= 0.14.0)
38
+ ast (2.4.0)
38
39
  builder (3.2.3)
39
40
  coderay (1.1.2)
40
41
  combustion (1.1.1)
@@ -49,16 +50,20 @@ GEM
49
50
  erubi (1.8.0)
50
51
  i18n (1.6.0)
51
52
  concurrent-ruby (~> 1.0)
52
- json (2.2.0)
53
+ jaro_winkler (1.5.4)
54
+ json (2.3.1)
53
55
  loofah (2.2.3)
54
56
  crass (~> 1.0.2)
55
57
  nokogiri (>= 1.5.9)
56
58
  method_source (0.9.2)
57
59
  mini_portile2 (2.4.0)
58
60
  minitest (5.11.3)
59
- nokogiri (1.10.4)
61
+ nokogiri (1.10.7)
60
62
  mini_portile2 (~> 2.4.0)
61
- pg (0.21.0)
63
+ parallel (1.19.1)
64
+ parser (2.7.0.2)
65
+ ast (~> 2.4.0)
66
+ pg (1.2.2)
62
67
  pry (0.12.2)
63
68
  coderay (~> 1.1.0)
64
69
  method_source (~> 0.9.0)
@@ -76,7 +81,8 @@ GEM
76
81
  method_source
77
82
  rake (>= 0.8.7)
78
83
  thor (>= 0.20.3, < 2.0)
79
- rake (10.5.0)
84
+ rainbow (3.0.0)
85
+ rake (12.3.3)
80
86
  rspec-core (3.8.2)
81
87
  rspec-support (~> 3.8.0)
82
88
  rspec-expectations (3.8.4)
@@ -94,6 +100,16 @@ GEM
94
100
  rspec-mocks (~> 3.8.0)
95
101
  rspec-support (~> 3.8.0)
96
102
  rspec-support (3.8.2)
103
+ rubocop (0.79.0)
104
+ jaro_winkler (~> 1.5.1)
105
+ parallel (~> 1.10)
106
+ parser (>= 2.7.0.1)
107
+ rainbow (>= 2.2.2, < 4.0)
108
+ ruby-progressbar (~> 1.7)
109
+ unicode-display_width (>= 1.4.0, < 1.7)
110
+ rubocop-rspec (1.37.1)
111
+ rubocop (>= 0.68.1)
112
+ ruby-progressbar (1.10.1)
97
113
  simplecov (0.17.0)
98
114
  docile (~> 1.1)
99
115
  json (>= 1.8, < 3)
@@ -101,8 +117,9 @@ GEM
101
117
  simplecov-html (0.10.2)
102
118
  thor (0.20.3)
103
119
  thread_safe (0.3.6)
104
- tzinfo (1.2.5)
120
+ tzinfo (1.2.8)
105
121
  thread_safe (~> 0.1)
122
+ unicode-display_width (1.6.1)
106
123
  zeitwerk (2.1.9)
107
124
 
108
125
  PLATFORMS
@@ -111,15 +128,16 @@ PLATFORMS
111
128
  DEPENDENCIES
112
129
  activerecord (= 6.0.0)
113
130
  appraisal
114
- bundler (~> 1.10)
131
+ bundler (~> 2.1)
115
132
  combustion (~> 1.1)
116
133
  database_cleaner (~> 1.6)
117
134
  parentry!
118
- pg (~> 0.21)
135
+ pg (~> 1.2)
119
136
  pry (~> 0.10)
120
- rake (~> 10.0)
137
+ rake (~> 12.3)
121
138
  rspec-rails (~> 3.7)
139
+ rubocop-rspec (~> 1.37)
122
140
  simplecov (~> 0.16)
123
141
 
124
142
  BUNDLED WITH
125
- 1.17.2
143
+ 2.1.4
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "activerecord", "6.0.0"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,147 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ parentry (1.3.0)
5
+ activerecord (>= 5.1, < 6.2)
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.3.0)
35
+ bundler
36
+ rake
37
+ thor (>= 0.14.0)
38
+ ast (2.4.1)
39
+ builder (3.2.4)
40
+ coderay (1.1.3)
41
+ combustion (1.3.1)
42
+ activesupport (>= 3.0.0)
43
+ railties (>= 3.0.0)
44
+ thor (>= 0.14.6)
45
+ concurrent-ruby (1.1.7)
46
+ crass (1.0.6)
47
+ database_cleaner (1.8.5)
48
+ diff-lcs (1.4.4)
49
+ docile (1.3.2)
50
+ erubi (1.10.0)
51
+ i18n (1.8.5)
52
+ concurrent-ruby (~> 1.0)
53
+ loofah (2.7.0)
54
+ crass (~> 1.0.2)
55
+ nokogiri (>= 1.5.9)
56
+ method_source (1.0.0)
57
+ mini_portile2 (2.4.0)
58
+ minitest (5.14.2)
59
+ nokogiri (1.10.10)
60
+ mini_portile2 (~> 2.4.0)
61
+ parallel (1.20.0)
62
+ parser (2.7.2.0)
63
+ ast (~> 2.4.1)
64
+ pg (1.2.3)
65
+ pry (0.13.1)
66
+ coderay (~> 1.1)
67
+ method_source (~> 1.0)
68
+ rack (2.2.3)
69
+ rack-test (1.1.0)
70
+ rack (>= 1.0, < 3)
71
+ rails-dom-testing (2.0.3)
72
+ activesupport (>= 4.2.0)
73
+ nokogiri (>= 1.6)
74
+ rails-html-sanitizer (1.3.0)
75
+ loofah (~> 2.3)
76
+ railties (6.0.0)
77
+ actionpack (= 6.0.0)
78
+ activesupport (= 6.0.0)
79
+ method_source
80
+ rake (>= 0.8.7)
81
+ thor (>= 0.20.3, < 2.0)
82
+ rainbow (3.0.0)
83
+ rake (12.3.3)
84
+ regexp_parser (1.8.2)
85
+ rexml (3.2.4)
86
+ rspec-core (3.9.3)
87
+ rspec-support (~> 3.9.3)
88
+ rspec-expectations (3.9.3)
89
+ diff-lcs (>= 1.2.0, < 2.0)
90
+ rspec-support (~> 3.9.0)
91
+ rspec-mocks (3.9.1)
92
+ diff-lcs (>= 1.2.0, < 2.0)
93
+ rspec-support (~> 3.9.0)
94
+ rspec-rails (3.9.1)
95
+ actionpack (>= 3.0)
96
+ activesupport (>= 3.0)
97
+ railties (>= 3.0)
98
+ rspec-core (~> 3.9.0)
99
+ rspec-expectations (~> 3.9.0)
100
+ rspec-mocks (~> 3.9.0)
101
+ rspec-support (~> 3.9.0)
102
+ rspec-support (3.9.4)
103
+ rubocop (0.93.1)
104
+ parallel (~> 1.10)
105
+ parser (>= 2.7.1.5)
106
+ rainbow (>= 2.2.2, < 4.0)
107
+ regexp_parser (>= 1.8)
108
+ rexml
109
+ rubocop-ast (>= 0.6.0)
110
+ ruby-progressbar (~> 1.7)
111
+ unicode-display_width (>= 1.4.0, < 2.0)
112
+ rubocop-ast (1.1.1)
113
+ parser (>= 2.7.1.5)
114
+ rubocop-rspec (1.44.1)
115
+ rubocop (~> 0.87)
116
+ rubocop-ast (>= 0.7.1)
117
+ ruby-progressbar (1.10.1)
118
+ simplecov (0.19.1)
119
+ docile (~> 1.1)
120
+ simplecov-html (~> 0.11)
121
+ simplecov-html (0.12.3)
122
+ thor (1.0.1)
123
+ thread_safe (0.3.6)
124
+ tzinfo (1.2.8)
125
+ thread_safe (~> 0.1)
126
+ unicode-display_width (1.7.0)
127
+ zeitwerk (2.4.2)
128
+
129
+ PLATFORMS
130
+ ruby
131
+
132
+ DEPENDENCIES
133
+ activerecord (= 6.0.0)
134
+ appraisal
135
+ bundler (~> 2.1)
136
+ combustion (~> 1.1)
137
+ database_cleaner (~> 1.6)
138
+ parentry!
139
+ pg (~> 1.2)
140
+ pry (~> 0.10)
141
+ rake (~> 12.3)
142
+ rspec-rails (~> 3.7)
143
+ rubocop-rspec (~> 1.37)
144
+ simplecov (~> 0.16)
145
+
146
+ BUNDLED WITH
147
+ 2.1.4
@@ -6,50 +6,49 @@ module Parentry
6
6
  autoload :Navigation, 'parentry/navigation'
7
7
  autoload :ClassMethods, 'parentry/class_methods'
8
8
 
9
- def self.included(base)
10
- base.class_eval do
11
- mattr_accessor :parentry_strategy, :parentry_column, :depth_offset, :cache_depth, :touch_ancestors
12
-
13
- belongs_to :parent, class_name: base_class.name, optional: true
14
- has_many :children, class_name: base_class.name, foreign_key: :parent_id, dependent: :destroy
15
-
16
- validate do
17
- unless parent.blank? || parent.persisted?
18
- errors.add(:parent, 'must be persisted')
19
- end
20
- end
21
-
22
- validate :prevent_circular_parentry
23
-
24
- after_create :commit_parentry
25
- before_update :assign_parentry, if: proc { changes[:parent_id].present? }
26
- after_update :cascade_parentry, if: proc { saved_changes[parentry_column].present? }
27
-
28
- before_validation :cache_parentry_depth, if: proc { cache_depth }
29
- before_save :cache_parentry_depth, if: proc { cache_depth }
30
-
31
- after_save :touch_ancestors_callback
32
- after_touch :touch_ancestors_callback
33
- after_destroy :touch_ancestors_callback
34
-
35
- scope :order_by_parentry, -> { order(parentry_depth_function) }
36
-
37
- scope :before_depth, ->(depth) { where("#{parentry_depth_function} - 1 < ?", depth + depth_offset) }
38
- scope :to_depth, ->(depth) { where("#{parentry_depth_function} - 1 <= ?", depth + depth_offset) }
39
- scope :at_depth, ->(depth) { where("#{parentry_depth_function} - 1 = ?", depth + depth_offset) }
40
- scope :from_depth, ->(depth) { where("#{parentry_depth_function} - 1 >= ?", depth + depth_offset) }
41
- scope :after_depth, ->(depth) { where("#{parentry_depth_function} - 1 > ?", depth + depth_offset) }
42
-
43
- scope :roots, -> { where("#{parentry_depth_function} = 1") }
44
- scope :ancestors_of, ->(node) { where(node.ancestor_conditions).where.not(id: node.id) }
45
- scope :children_of, ->(node) { where(parent_id: node.id) }
46
- scope :descendants_of, ->(node) { subtree_of(node).where.not(id: node.id) }
47
- scope :subtree_of, ->(node) { where(node.subtree_conditions) }
48
- scope :siblings_of, ->(node) { where(parent_id: node.parent_id).where.not(id: node.id) }
9
+ extend ActiveSupport::Concern
10
+
11
+ # rubocop:disable Metrics/BlockLength
12
+ included do
13
+ include Navigation
14
+ include InstanceMethods
15
+
16
+ mattr_accessor :parentry_strategy, :parentry_column, :depth_offset, :cache_depth, :touch_ancestors
17
+
18
+ belongs_to :parent, class_name: base_class.name, optional: true
19
+ has_many :children, class_name: base_class.name, foreign_key: :parent_id, dependent: :destroy
20
+
21
+ validate do
22
+ errors.add(:parent, 'must be persisted') unless parent.blank? || parent.persisted?
49
23
  end
50
24
 
51
- base.send :include, Navigation
52
- base.send :include, InstanceMethods
53
- base.extend ClassMethods
25
+ validate :prevent_circular_parentry
26
+
27
+ after_create :commit_parentry
28
+ before_update :assign_parentry, if: proc { changes[:parent_id].present? }
29
+ after_update :cascade_parentry, if: proc { saved_changes[parentry_column].present? }
30
+
31
+ before_validation :cache_parentry_depth, if: proc { cache_depth }
32
+ before_save :cache_parentry_depth, if: proc { cache_depth }
33
+
34
+ after_save :touch_ancestors_callback
35
+ after_touch :touch_ancestors_callback
36
+ after_destroy :touch_ancestors_callback
37
+
38
+ scope :order_by_parentry, -> { order(parentry_depth_function) }
39
+
40
+ scope :before_depth, ->(depth) { where("#{parentry_depth_function} - 1 < ?", depth + depth_offset) }
41
+ scope :to_depth, ->(depth) { where("#{parentry_depth_function} - 1 <= ?", depth + depth_offset) }
42
+ scope :at_depth, ->(depth) { where("#{parentry_depth_function} - 1 = ?", depth + depth_offset) }
43
+ scope :from_depth, ->(depth) { where("#{parentry_depth_function} - 1 >= ?", depth + depth_offset) }
44
+ scope :after_depth, ->(depth) { where("#{parentry_depth_function} - 1 > ?", depth + depth_offset) }
45
+
46
+ scope :roots, -> { where("#{parentry_depth_function} = 1") }
47
+ scope :ancestors_of, ->(node) { where(node.ancestor_conditions).where.not(id: node.id) }
48
+ scope :children_of, ->(node) { where(parent_id: node.id) }
49
+ scope :descendants_of, ->(node) { subtree_of(node).where.not(id: node.id) }
50
+ scope :subtree_of, ->(node) { where(node.subtree_conditions) }
51
+ scope :siblings_of, ->(node) { where(parent_id: node.parent_id).where.not(id: node.id) }
54
52
  end
53
+ # rubocop:enable Metrics/BlockLength
55
54
  end
@@ -11,12 +11,13 @@ module Parentry
11
11
  include Strategy::Array if parentry_strategy == 'array'
12
12
  end
13
13
 
14
+ # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
14
15
  def arrange(options = {})
15
16
  scope =
16
17
  if (order = options.delete(:order))
17
- self.base_class.order_by_parentry.order(order)
18
+ base_class.order_by_parentry.order(order)
18
19
  else
19
- self.base_class.order_by_parentry
20
+ base_class.order_by_parentry
20
21
  end
21
22
 
22
23
  scope.where(options).each_with_object(Hash.new { |h, k| h[k] = {} }) do |node, memo|
@@ -27,5 +28,6 @@ module Parentry
27
28
  insert_node[node] = {}
28
29
  end
29
30
  end
31
+ # rubocop:enable Metrics/AbcSize,Metrics/MethodLength
30
32
  end
31
33
  end
@@ -46,6 +46,7 @@ module Parentry
46
46
 
47
47
  def ancestor_ids_was
48
48
  return [] unless saved_changes[parentry_column]
49
+
49
50
  parse_parentry(saved_changes[parentry_column][0]).tap(&:pop)
50
51
  end
51
52
  end
@@ -33,9 +33,9 @@ module Parentry
33
33
  end
34
34
 
35
35
  def leaf?
36
- children.size == 0
36
+ children.size.zero?
37
37
  end
38
- alias_method :childless?, :leaf?
38
+ alias childless? leaf?
39
39
 
40
40
  def children?
41
41
  !leaf?
@@ -50,7 +50,7 @@ module Parentry
50
50
  end
51
51
 
52
52
  def siblings?
53
- siblings.size > 0
53
+ siblings.size.positive?
54
54
  end
55
55
 
56
56
  def only_child?
@@ -80,6 +80,7 @@ module Parentry
80
80
  def depth
81
81
  return depth_offset if root?
82
82
  return parent.depth + 1 if changes[:parent_id].present?
83
+
83
84
  path_ids.size - 1 + depth_offset
84
85
  end
85
86
 
@@ -8,6 +8,7 @@ module Parentry
8
8
 
9
9
  def compute_parentry
10
10
  return [] unless persisted?
11
+
11
12
  parent.present? ? parent.parentry + [id] : [id]
12
13
  end
13
14
 
@@ -7,7 +7,7 @@ module Parentry
7
7
  end
8
8
 
9
9
  def compute_parentry
10
- parent.present? ? "#{parent.parentry}.#{id}" : "#{id}"
10
+ parent.present? ? "#{parent.parentry}.#{id}" : id.to_s
11
11
  end
12
12
 
13
13
  def cascade_parentry
@@ -1,3 +1,3 @@
1
1
  module Parentry
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0'.freeze
3
3
  end
@@ -1,5 +1,4 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'parentry/version'
5
4
 
@@ -9,21 +8,22 @@ Gem::Specification.new do |spec|
9
8
  spec.authors = ['Hamed Asghari']
10
9
  spec.email = ['hasghari@gmail.com']
11
10
 
12
- spec.summary = %q{ActiveRecord adapter for the Postgres ltree module}
11
+ spec.summary = 'ActiveRecord adapter for the Postgres ltree module'
13
12
  spec.homepage = 'https://github.com/hasghari/parentry'
14
13
  spec.license = 'MIT'
15
14
 
16
15
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
16
  spec.require_paths = ['lib']
18
17
 
19
- spec.add_dependency 'activerecord', '>= 5.1', '< 6.1'
18
+ spec.add_dependency 'activerecord', '>= 5.1', '< 6.2'
20
19
 
21
- spec.add_development_dependency 'bundler', '~> 1.10'
22
- spec.add_development_dependency 'rake', '~> 10.0'
23
- spec.add_development_dependency 'rspec-rails', '~> 3.7'
24
- spec.add_development_dependency 'pg', '~> 0.21'
20
+ spec.add_development_dependency 'bundler', '~> 2.1'
25
21
  spec.add_development_dependency 'combustion', '~> 1.1'
26
22
  spec.add_development_dependency 'database_cleaner', '~> 1.6'
23
+ spec.add_development_dependency 'pg', '~> 1.2'
27
24
  spec.add_development_dependency 'pry', '~> 0.10'
25
+ spec.add_development_dependency 'rake', '~> 12.3'
26
+ spec.add_development_dependency 'rspec-rails', '~> 3.7'
27
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.37'
28
28
  spec.add_development_dependency 'simplecov', '~> 0.16'
29
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.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamed Asghari
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-22 00:00:00.000000000 Z
11
+ date: 2020-12-09 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.1'
22
+ version: '6.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,105 +29,119 @@ dependencies:
29
29
  version: '5.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.1'
32
+ version: '6.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '1.10'
39
+ version: '2.1'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.10'
46
+ version: '2.1'
47
47
  - !ruby/object:Gem::Dependency
48
- name: rake
48
+ name: combustion
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '10.0'
53
+ version: '1.1'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '10.0'
60
+ version: '1.1'
61
61
  - !ruby/object:Gem::Dependency
62
- name: rspec-rails
62
+ name: database_cleaner
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '3.7'
67
+ version: '1.6'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '3.7'
74
+ version: '1.6'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: pg
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0.21'
81
+ version: '1.2'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '0.21'
88
+ version: '1.2'
89
89
  - !ruby/object:Gem::Dependency
90
- name: combustion
90
+ name: pry
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '1.1'
95
+ version: '0.10'
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: '1.1'
102
+ version: '0.10'
103
103
  - !ruby/object:Gem::Dependency
104
- name: database_cleaner
104
+ name: rake
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '1.6'
109
+ version: '12.3'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '1.6'
116
+ version: '12.3'
117
117
  - !ruby/object:Gem::Dependency
118
- name: pry
118
+ name: rspec-rails
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '0.10'
123
+ version: '3.7'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '0.10'
130
+ version: '3.7'
131
+ - !ruby/object:Gem::Dependency
132
+ name: rubocop-rspec
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '1.37'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '1.37'
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: simplecov
133
147
  requirement: !ruby/object:Gem::Requirement
@@ -142,16 +156,18 @@ dependencies:
142
156
  - - "~>"
143
157
  - !ruby/object:Gem::Version
144
158
  version: '0.16'
145
- description:
159
+ description:
146
160
  email:
147
161
  - hasghari@gmail.com
148
162
  executables: []
149
163
  extensions: []
150
164
  extra_rdoc_files: []
151
165
  files:
166
+ - ".github/workflows/ruby.yml"
152
167
  - ".gitignore"
153
168
  - ".rspec"
154
- - ".travis.yml"
169
+ - ".rubocop.yml"
170
+ - ".tool-versions"
155
171
  - Appraisals
156
172
  - CODE_OF_CONDUCT.md
157
173
  - Gemfile
@@ -166,6 +182,8 @@ files:
166
182
  - gemfiles/activerecord_5.2.0.gemfile.lock
167
183
  - gemfiles/activerecord_6.0.0.gemfile
168
184
  - gemfiles/activerecord_6.0.0.gemfile.lock
185
+ - gemfiles/activerecord_6.1.0.gemfile
186
+ - gemfiles/activerecord_6.1.0.gemfile.lock
169
187
  - lib/parentry.rb
170
188
  - lib/parentry/class_methods.rb
171
189
  - lib/parentry/instance_methods.rb
@@ -183,7 +201,7 @@ homepage: https://github.com/hasghari/parentry
183
201
  licenses:
184
202
  - MIT
185
203
  metadata: {}
186
- post_install_message:
204
+ post_install_message:
187
205
  rdoc_options: []
188
206
  require_paths:
189
207
  - lib
@@ -198,8 +216,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
216
  - !ruby/object:Gem::Version
199
217
  version: '0'
200
218
  requirements: []
201
- rubygems_version: 3.0.3
202
- signing_key:
219
+ rubygems_version: 3.1.4
220
+ signing_key:
203
221
  specification_version: 4
204
222
  summary: ActiveRecord adapter for the Postgres ltree module
205
223
  test_files: []
@@ -1,25 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.5.3
4
- - 2.6.3
5
- env:
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
15
- gemfile:
16
- - gemfiles/activerecord_5.1.5.gemfile
17
- - gemfiles/activerecord_5.2.0.gemfile
18
- - gemfiles/activerecord_6.0.0.gemfile
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