parentry 1.1.0 → 1.5.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
- SHA1:
3
- metadata.gz: b23910bc1f31f40e2e0e5211d52c66d72b1acac7
4
- data.tar.gz: 2e351be07a0b044d562bd2f7c8d69fc962367322
2
+ SHA256:
3
+ metadata.gz: f3feb70016cb4448fb7a633c183e4c28451779e80f4b17d9f41c9b56e8e4e560
4
+ data.tar.gz: 54c9e48f984205d2ba80c5bd53d745c19c89bd95529c63b7e2f4f2335ce3b89a
5
5
  SHA512:
6
- metadata.gz: e4d1c7a1529a3f16b37ea4424b04da4aec815d64d7bb25e2295dc10c5c7b3a860252f6224c6c4a706e4856db4fa92e59842381c8261c15abea677685fe6a152f
7
- data.tar.gz: 67ee9970fc5a6195291001eb8b34902f2e95876ebf43e937b542ae064d697b6741bab84ee6e15415541ddd5aed69fe0ce2e1151119c1968273432efa2e18f06b
6
+ metadata.gz: ad121d565f69446d95ef7db926461dd0c51c28ef981c95b0b02ed8debb6b27f40f7576773f76e31e35336704d9bb3fa5705461e9ef2bc5e02a66e4f542e8a534
7
+ data.tar.gz: 34ed4870c5f7fed79a0558df2e4db01f932690f8e07b935f56c4dfce6343529b6ba2bf69d97a00c039cadc820cd40ae708494bbdf9f8ed6be10c479958852f59
@@ -0,0 +1,58 @@
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.7'
14
+ - '3.0'
15
+ activerecord:
16
+ - 6.0.0
17
+ - 6.1.0
18
+ - 7.0.0
19
+ strategy:
20
+ - array
21
+ - ltree
22
+
23
+ env:
24
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/activerecord_${{ matrix.activerecord }}.gemfile
25
+
26
+ services:
27
+ postgres:
28
+ image: postgres:12.4
29
+ env:
30
+ POSTGRES_USER: postgres
31
+ POSTGRES_PASSWORD: postgres
32
+ POSTGRES_DB: parentry_test
33
+ ports:
34
+ - 5432:5432
35
+ # needed because the postgres container does not provide a healthcheck
36
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
37
+
38
+ steps:
39
+ - uses: actions/checkout@v2
40
+
41
+ - name: Set up Ruby
42
+ uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: ${{ matrix.ruby }}
45
+ bundler-cache: true
46
+
47
+ - name: Install PostgreSQL client
48
+ run: |
49
+ sudo apt-get -yqq install libpq-dev
50
+
51
+ - name: Run tests with RSpec
52
+ uses: paambaati/codeclimate-action@v2.7.5
53
+ env:
54
+ CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
55
+ STRATEGY: ${{ matrix.strategy }}
56
+ with:
57
+ coverageCommand: bundle exec rspec
58
+ debug: false
data/.rubocop.yml ADDED
@@ -0,0 +1,39 @@
1
+ inherit_mode:
2
+ merge:
3
+ - Exclude
4
+
5
+ AllCops:
6
+ NewCops: enable
7
+ TargetRubyVersion: 2.5
8
+ Exclude:
9
+ - gemfiles/**
10
+
11
+ Layout/LineLength:
12
+ Max: 120
13
+
14
+ Layout/MultilineMethodCallIndentation:
15
+ EnforcedStyle: indented_relative_to_receiver
16
+
17
+ Naming/PredicateName:
18
+ AllowedMethods:
19
+ - has_many
20
+
21
+ Style/Documentation:
22
+ Enabled: false
23
+
24
+ Style/EmptyMethod:
25
+ EnforcedStyle: expanded
26
+
27
+ Style/FormatStringToken:
28
+ EnforcedStyle: template
29
+
30
+ Style/FrozenStringLiteralComment:
31
+ Enabled: false
32
+
33
+ Style/PercentLiteralDelimiters:
34
+ PreferredDelimiters:
35
+ default: ()
36
+ '%w': '()'
37
+ '%W': '()'
38
+ '%i': '()'
39
+ '%I': '()'
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.0.3
data/Appraisals CHANGED
@@ -1,3 +1,19 @@
1
1
  appraise 'activerecord-5.1.5' do
2
- gem 'activerecord', '5.1.5'
2
+ gem 'activerecord', '~> 5.1', '< 5.2'
3
+ end
4
+
5
+ appraise 'activerecord-5.2.0' do
6
+ gem 'activerecord', '~> 5.2', '< 6'
7
+ end
8
+
9
+ appraise 'activerecord-6.0.0' do
10
+ gem 'activerecord', '~> 6.0', '< 6.1'
11
+ end
12
+
13
+ appraise 'activerecord-6.1.0' do
14
+ gem 'activerecord', '~> 6.1', '< 6.2'
15
+ end
16
+
17
+ appraise 'activerecord-7.0.0' do
18
+ gem 'activerecord', '~> 7.0', '< 7.1'
3
19
  end
data/README.md CHANGED
@@ -1,4 +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
+ [![Maintainability](https://api.codeclimate.com/v1/badges/cc7180328fffcbdea2bb/maintainability)](https://codeclimate.com/github/hasghari/parentry/maintainability)
2
3
 
3
4
  # Parentry
4
5
 
@@ -24,11 +25,26 @@ Or install it yourself as:
24
25
 
25
26
  ## Usage
26
27
 
27
- This gem requires 2 columns for each table: `parentry` and `parent_id`. A sample migration would look like:
28
+ 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
29
 
29
30
  ```ruby
30
- add_column :my_table, :parentry, :ltree
31
+ enable_extension 'ltree' # ltree is not turned on by default; skip if you use the array strategy
32
+
31
33
  add_column :my_table, :parent_id, :integer
34
+
35
+ add_column :my_table, :parentry, :ltree
36
+ add_column :my_table, :parentry_depth, :integer, default: 0 # optional
37
+
38
+ add_index :my_table, :parentry, using: :gist
39
+ ```
40
+
41
+ ```ruby
42
+ class MyTable < ApplicationRecord
43
+ include Parentry
44
+ parentry cache_depth: true
45
+ # to change strategy to array, and avoid dependency on ltree
46
+ # parentry strategy: :array
47
+ end
32
48
  ```
33
49
 
34
50
  ## Contributing
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
@@ -3,6 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "activerecord", "5.1.5"
6
+ gem "activerecord", "~> 5.1", "< 5.2"
7
7
 
8
8
  gemspec path: "../"
@@ -1,117 +1,150 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- parentry (1.1.0)
5
- activerecord (~> 5.1)
4
+ parentry (1.5.0)
5
+ activerecord (>= 5.1, < 7.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (5.1.5)
11
- actionview (= 5.1.5)
12
- activesupport (= 5.1.5)
10
+ actionpack (5.1.7)
11
+ actionview (= 5.1.7)
12
+ activesupport (= 5.1.7)
13
13
  rack (~> 2.0)
14
14
  rack-test (>= 0.6.3)
15
15
  rails-dom-testing (~> 2.0)
16
16
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
- actionview (5.1.5)
18
- activesupport (= 5.1.5)
17
+ actionview (5.1.7)
18
+ activesupport (= 5.1.7)
19
19
  builder (~> 3.1)
20
20
  erubi (~> 1.4)
21
21
  rails-dom-testing (~> 2.0)
22
22
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
23
- activemodel (5.1.5)
24
- activesupport (= 5.1.5)
25
- activerecord (5.1.5)
26
- activemodel (= 5.1.5)
27
- activesupport (= 5.1.5)
23
+ activemodel (5.1.7)
24
+ activesupport (= 5.1.7)
25
+ activerecord (5.1.7)
26
+ activemodel (= 5.1.7)
27
+ activesupport (= 5.1.7)
28
28
  arel (~> 8.0)
29
- activesupport (5.1.5)
29
+ activesupport (5.1.7)
30
30
  concurrent-ruby (~> 1.0, >= 1.0.2)
31
- i18n (~> 0.7)
31
+ i18n (>= 0.7, < 2)
32
32
  minitest (~> 5.1)
33
33
  tzinfo (~> 1.1)
34
- appraisal (2.2.0)
34
+ appraisal (2.3.0)
35
35
  bundler
36
36
  rake
37
37
  thor (>= 0.14.0)
38
38
  arel (8.0.0)
39
- builder (3.2.3)
40
- coderay (1.1.2)
41
- combustion (0.9.0)
39
+ ast (2.4.1)
40
+ builder (3.2.4)
41
+ coderay (1.1.3)
42
+ combustion (1.3.1)
42
43
  activesupport (>= 3.0.0)
43
44
  railties (>= 3.0.0)
44
45
  thor (>= 0.14.6)
45
- concurrent-ruby (1.0.5)
46
- crass (1.0.3)
47
- database_cleaner (1.6.2)
48
- diff-lcs (1.3)
49
- erubi (1.7.1)
50
- i18n (0.9.5)
46
+ concurrent-ruby (1.1.7)
47
+ crass (1.0.6)
48
+ database_cleaner (1.8.5)
49
+ diff-lcs (1.4.4)
50
+ docile (1.3.4)
51
+ erubi (1.10.0)
52
+ i18n (1.8.5)
51
53
  concurrent-ruby (~> 1.0)
52
- loofah (2.2.2)
54
+ loofah (2.8.0)
53
55
  crass (~> 1.0.2)
54
56
  nokogiri (>= 1.5.9)
55
- method_source (0.9.0)
56
- mini_portile2 (2.3.0)
57
- minitest (5.11.3)
58
- nokogiri (1.8.2)
59
- mini_portile2 (~> 2.3.0)
60
- pg (0.21.0)
61
- pry (0.11.3)
62
- coderay (~> 1.1.0)
63
- method_source (~> 0.9.0)
64
- rack (2.0.4)
65
- rack-test (1.0.0)
57
+ method_source (1.0.0)
58
+ mini_portile2 (2.4.0)
59
+ minitest (5.14.2)
60
+ nokogiri (1.10.10)
61
+ mini_portile2 (~> 2.4.0)
62
+ parallel (1.20.1)
63
+ parser (3.0.0.0)
64
+ ast (~> 2.4.1)
65
+ pg (1.2.3)
66
+ pry (0.13.1)
67
+ coderay (~> 1.1)
68
+ method_source (~> 1.0)
69
+ rack (2.2.3)
70
+ rack-test (1.1.0)
66
71
  rack (>= 1.0, < 3)
67
72
  rails-dom-testing (2.0.3)
68
73
  activesupport (>= 4.2.0)
69
74
  nokogiri (>= 1.6)
70
- rails-html-sanitizer (1.0.4)
71
- loofah (~> 2.2, >= 2.2.2)
72
- railties (5.1.5)
73
- actionpack (= 5.1.5)
74
- activesupport (= 5.1.5)
75
+ rails-html-sanitizer (1.3.0)
76
+ loofah (~> 2.3)
77
+ railties (5.1.7)
78
+ actionpack (= 5.1.7)
79
+ activesupport (= 5.1.7)
75
80
  method_source
76
81
  rake (>= 0.8.7)
77
82
  thor (>= 0.18.1, < 2.0)
78
- rake (10.5.0)
79
- rspec-core (3.7.1)
80
- rspec-support (~> 3.7.0)
81
- rspec-expectations (3.7.0)
83
+ rainbow (3.0.0)
84
+ rake (13.0.3)
85
+ regexp_parser (2.0.3)
86
+ rexml (3.2.4)
87
+ rspec-core (3.10.1)
88
+ rspec-support (~> 3.10.0)
89
+ rspec-expectations (3.10.1)
82
90
  diff-lcs (>= 1.2.0, < 2.0)
83
- rspec-support (~> 3.7.0)
84
- rspec-mocks (3.7.0)
91
+ rspec-support (~> 3.10.0)
92
+ rspec-mocks (3.10.1)
85
93
  diff-lcs (>= 1.2.0, < 2.0)
86
- rspec-support (~> 3.7.0)
87
- rspec-rails (3.7.2)
88
- actionpack (>= 3.0)
89
- activesupport (>= 3.0)
90
- railties (>= 3.0)
91
- rspec-core (~> 3.7.0)
92
- rspec-expectations (~> 3.7.0)
93
- rspec-mocks (~> 3.7.0)
94
- rspec-support (~> 3.7.0)
95
- rspec-support (3.7.1)
96
- thor (0.20.0)
94
+ rspec-support (~> 3.10.0)
95
+ rspec-rails (4.0.2)
96
+ actionpack (>= 4.2)
97
+ activesupport (>= 4.2)
98
+ railties (>= 4.2)
99
+ rspec-core (~> 3.10)
100
+ rspec-expectations (~> 3.10)
101
+ rspec-mocks (~> 3.10)
102
+ rspec-support (~> 3.10)
103
+ rspec-support (3.10.1)
104
+ rubocop (1.7.0)
105
+ parallel (~> 1.10)
106
+ parser (>= 2.7.1.5)
107
+ rainbow (>= 2.2.2, < 4.0)
108
+ regexp_parser (>= 1.8, < 3.0)
109
+ rexml
110
+ rubocop-ast (>= 1.2.0, < 2.0)
111
+ ruby-progressbar (~> 1.7)
112
+ unicode-display_width (>= 1.4.0, < 2.0)
113
+ rubocop-ast (1.3.0)
114
+ parser (>= 2.7.1.5)
115
+ rubocop-rspec (2.1.0)
116
+ rubocop (~> 1.0)
117
+ rubocop-ast (>= 1.1.0)
118
+ ruby-progressbar (1.11.0)
119
+ simplecov (0.20.0)
120
+ docile (~> 1.1)
121
+ simplecov-html (~> 0.11)
122
+ simplecov_json_formatter (~> 0.1)
123
+ simplecov-html (0.12.3)
124
+ simplecov_json_formatter (0.1.2)
125
+ thor (1.0.1)
97
126
  thread_safe (0.3.6)
98
- tzinfo (1.2.5)
127
+ tzinfo (1.2.9)
99
128
  thread_safe (~> 0.1)
129
+ unicode-display_width (1.7.0)
100
130
 
101
131
  PLATFORMS
102
- ruby
132
+ x86_64-darwin-20
133
+ x86_64-linux
103
134
 
104
135
  DEPENDENCIES
105
- activerecord (= 5.1.5)
136
+ activerecord (~> 5.1, < 5.2)
106
137
  appraisal
107
- bundler (~> 1.10)
108
- combustion (= 0.9.0)
138
+ bundler (~> 2)
139
+ combustion (~> 1.1)
109
140
  database_cleaner (~> 1.6)
110
141
  parentry!
111
- pg (~> 0.21)
112
- pry (~> 0.10)
113
- rake (~> 10.0)
114
- rspec-rails (~> 3.7)
142
+ pg (~> 1.2)
143
+ pry (~> 0.13)
144
+ rake (~> 13)
145
+ rspec-rails (~> 4.0)
146
+ rubocop-rspec (~> 2.1)
147
+ simplecov (~> 0.20)
115
148
 
116
149
  BUNDLED WITH
117
- 1.14.6
150
+ 2.2.32
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "activerecord", "~> 5.2", "< 6"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,150 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ parentry (1.5.0)
5
+ activerecord (>= 5.1, < 7.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionpack (5.2.4.4)
11
+ actionview (= 5.2.4.4)
12
+ activesupport (= 5.2.4.4)
13
+ rack (~> 2.0, >= 2.0.8)
14
+ rack-test (>= 0.6.3)
15
+ rails-dom-testing (~> 2.0)
16
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
+ actionview (5.2.4.4)
18
+ activesupport (= 5.2.4.4)
19
+ builder (~> 3.1)
20
+ erubi (~> 1.4)
21
+ rails-dom-testing (~> 2.0)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
23
+ activemodel (5.2.4.4)
24
+ activesupport (= 5.2.4.4)
25
+ activerecord (5.2.4.4)
26
+ activemodel (= 5.2.4.4)
27
+ activesupport (= 5.2.4.4)
28
+ arel (>= 9.0)
29
+ activesupport (5.2.4.4)
30
+ concurrent-ruby (~> 1.0, >= 1.0.2)
31
+ i18n (>= 0.7, < 2)
32
+ minitest (~> 5.1)
33
+ tzinfo (~> 1.1)
34
+ appraisal (2.3.0)
35
+ bundler
36
+ rake
37
+ thor (>= 0.14.0)
38
+ arel (9.0.0)
39
+ ast (2.4.1)
40
+ builder (3.2.4)
41
+ coderay (1.1.3)
42
+ combustion (1.3.1)
43
+ activesupport (>= 3.0.0)
44
+ railties (>= 3.0.0)
45
+ thor (>= 0.14.6)
46
+ concurrent-ruby (1.1.7)
47
+ crass (1.0.6)
48
+ database_cleaner (1.8.5)
49
+ diff-lcs (1.4.4)
50
+ docile (1.3.4)
51
+ erubi (1.10.0)
52
+ i18n (1.8.5)
53
+ concurrent-ruby (~> 1.0)
54
+ loofah (2.8.0)
55
+ crass (~> 1.0.2)
56
+ nokogiri (>= 1.5.9)
57
+ method_source (1.0.0)
58
+ mini_portile2 (2.4.0)
59
+ minitest (5.14.2)
60
+ nokogiri (1.10.10)
61
+ mini_portile2 (~> 2.4.0)
62
+ parallel (1.20.1)
63
+ parser (3.0.0.0)
64
+ ast (~> 2.4.1)
65
+ pg (1.2.3)
66
+ pry (0.13.1)
67
+ coderay (~> 1.1)
68
+ method_source (~> 1.0)
69
+ rack (2.2.3)
70
+ rack-test (1.1.0)
71
+ rack (>= 1.0, < 3)
72
+ rails-dom-testing (2.0.3)
73
+ activesupport (>= 4.2.0)
74
+ nokogiri (>= 1.6)
75
+ rails-html-sanitizer (1.3.0)
76
+ loofah (~> 2.3)
77
+ railties (5.2.4.4)
78
+ actionpack (= 5.2.4.4)
79
+ activesupport (= 5.2.4.4)
80
+ method_source
81
+ rake (>= 0.8.7)
82
+ thor (>= 0.19.0, < 2.0)
83
+ rainbow (3.0.0)
84
+ rake (13.0.3)
85
+ regexp_parser (2.0.3)
86
+ rexml (3.2.4)
87
+ rspec-core (3.10.1)
88
+ rspec-support (~> 3.10.0)
89
+ rspec-expectations (3.10.1)
90
+ diff-lcs (>= 1.2.0, < 2.0)
91
+ rspec-support (~> 3.10.0)
92
+ rspec-mocks (3.10.1)
93
+ diff-lcs (>= 1.2.0, < 2.0)
94
+ rspec-support (~> 3.10.0)
95
+ rspec-rails (4.0.2)
96
+ actionpack (>= 4.2)
97
+ activesupport (>= 4.2)
98
+ railties (>= 4.2)
99
+ rspec-core (~> 3.10)
100
+ rspec-expectations (~> 3.10)
101
+ rspec-mocks (~> 3.10)
102
+ rspec-support (~> 3.10)
103
+ rspec-support (3.10.1)
104
+ rubocop (1.7.0)
105
+ parallel (~> 1.10)
106
+ parser (>= 2.7.1.5)
107
+ rainbow (>= 2.2.2, < 4.0)
108
+ regexp_parser (>= 1.8, < 3.0)
109
+ rexml
110
+ rubocop-ast (>= 1.2.0, < 2.0)
111
+ ruby-progressbar (~> 1.7)
112
+ unicode-display_width (>= 1.4.0, < 2.0)
113
+ rubocop-ast (1.3.0)
114
+ parser (>= 2.7.1.5)
115
+ rubocop-rspec (2.1.0)
116
+ rubocop (~> 1.0)
117
+ rubocop-ast (>= 1.1.0)
118
+ ruby-progressbar (1.11.0)
119
+ simplecov (0.20.0)
120
+ docile (~> 1.1)
121
+ simplecov-html (~> 0.11)
122
+ simplecov_json_formatter (~> 0.1)
123
+ simplecov-html (0.12.3)
124
+ simplecov_json_formatter (0.1.2)
125
+ thor (1.0.1)
126
+ thread_safe (0.3.6)
127
+ tzinfo (1.2.9)
128
+ thread_safe (~> 0.1)
129
+ unicode-display_width (1.7.0)
130
+
131
+ PLATFORMS
132
+ x86_64-darwin-20
133
+ x86_64-linux
134
+
135
+ DEPENDENCIES
136
+ activerecord (~> 5.2, < 6)
137
+ appraisal
138
+ bundler (~> 2)
139
+ combustion (~> 1.1)
140
+ database_cleaner (~> 1.6)
141
+ parentry!
142
+ pg (~> 1.2)
143
+ pry (~> 0.13)
144
+ rake (~> 13)
145
+ rspec-rails (~> 4.0)
146
+ rubocop-rspec (~> 2.1)
147
+ simplecov (~> 0.20)
148
+
149
+ BUNDLED WITH
150
+ 2.2.32
@@ -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", "< 6.1"
7
+
8
+ gemspec path: "../"