acts_as_recursive_tree 2.1.1 → 3.1.0
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/.github/workflows/ci.yml +44 -0
- data/.github/workflows/lint.yml +31 -0
- data/.github/workflows/rubygem.yml +37 -0
- data/.gitignore +3 -1
- data/.rubocop.yml +33 -1
- data/.rubocop_todo.yml +28 -281
- data/Appraisals +21 -0
- data/CHANGELOG.md +16 -1
- data/Gemfile +2 -0
- data/README.md +9 -0
- data/Rakefile +8 -8
- data/acts_as_recursive_tree.gemspec +27 -18
- data/gemfiles/ar_52.gemfile +8 -0
- data/gemfiles/ar_60.gemfile +8 -0
- data/gemfiles/ar_61.gemfile +8 -0
- data/gemfiles/ar_70.gemfile +8 -0
- data/lib/acts_as_recursive_tree/acts_macro.rb +6 -6
- data/lib/acts_as_recursive_tree/associations.rb +10 -8
- data/lib/acts_as_recursive_tree/builders/ancestors.rb +3 -2
- data/lib/acts_as_recursive_tree/builders/descendants.rb +3 -1
- data/lib/acts_as_recursive_tree/builders/leaves.rb +7 -8
- data/lib/acts_as_recursive_tree/builders/relation_builder.rb +14 -10
- data/lib/acts_as_recursive_tree/builders/{strategy → strategies}/ancestor.rb +3 -1
- data/lib/acts_as_recursive_tree/builders/{strategy → strategies}/descendant.rb +3 -1
- data/lib/acts_as_recursive_tree/builders/{strategy → strategies}/join.rb +5 -3
- data/lib/acts_as_recursive_tree/builders/{strategy → strategies}/subselect.rb +3 -1
- data/lib/acts_as_recursive_tree/builders/{strategy.rb → strategies.rb} +3 -9
- data/lib/acts_as_recursive_tree/config.rb +2 -0
- data/lib/acts_as_recursive_tree/model.rb +9 -8
- data/lib/acts_as_recursive_tree/options/depth_condition.rb +3 -2
- data/lib/acts_as_recursive_tree/options/query_options.rb +4 -2
- data/lib/acts_as_recursive_tree/options/values.rb +28 -18
- data/lib/acts_as_recursive_tree/railtie.rb +2 -0
- data/lib/acts_as_recursive_tree/scopes.rb +8 -4
- data/lib/acts_as_recursive_tree/version.rb +3 -1
- data/lib/acts_as_recursive_tree.rb +7 -11
- data/spec/builders_spec.rb +21 -12
- data/spec/db/database.rb +13 -4
- data/spec/db/database.yml +2 -5
- data/spec/db/models.rb +12 -11
- data/spec/db/schema.rb +3 -4
- data/spec/model/location_spec.rb +7 -11
- data/spec/model/node_spec.rb +35 -49
- data/spec/model/relation_spec.rb +6 -11
- data/spec/spec_helper.rb +54 -55
- data/spec/values_spec.rb +30 -19
- metadata +111 -26
- data/lib/acts_as_recursive_tree/builders.rb +0 -14
- data/lib/acts_as_recursive_tree/options.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3681366c263bd90e2479c6a4761042825547241a15e828678c260789f05ad54
|
4
|
+
data.tar.gz: c526e787809100bcba957ddeae424ffa068afe7f10e8e2ece1aec354cce6c70b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b4e5b9a5a1462b39cc8c2cc0184d8db0653b1d02be8728d2bf46fa309d847224765c3e6b8ac885f064a42f64b34375d9e032e888d5588c9940d55225ceced4a
|
7
|
+
data.tar.gz: 4e8a2077169e98b889671412c87c80d21f03541bbcdc62cefe520e47c626459c29ff1ee6a07bb54a9ebd94ca8418c4369d27ff9950a3c559b0bd7ef41970afc6
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: CI
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ main ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ '**' ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
matrix:
|
22
|
+
ruby-version: ['2.5', '2.6', '2.7', '3.0']
|
23
|
+
gemfile: [ar_52, ar_60, ar_61, ar_70]
|
24
|
+
exclude:
|
25
|
+
- ruby-version: '3.0'
|
26
|
+
gemfile: ar_52
|
27
|
+
- ruby-version: '2.5'
|
28
|
+
gemfile: ar_70
|
29
|
+
- ruby-version: '2.6'
|
30
|
+
gemfile: ar_70
|
31
|
+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
32
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
33
|
+
steps:
|
34
|
+
- uses: actions/checkout@v2
|
35
|
+
- name: Set up Ruby
|
36
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
37
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
38
|
+
uses: ruby/setup-ruby@v1
|
39
|
+
# uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
40
|
+
with:
|
41
|
+
ruby-version: ${{ matrix.ruby-version }}
|
42
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
43
|
+
- name: Run tests
|
44
|
+
run: bundle exec rake
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: LINT
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ main ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ '**' ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
steps:
|
21
|
+
- uses: actions/checkout@v2
|
22
|
+
- name: Set up Ruby
|
23
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
24
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
25
|
+
uses: ruby/setup-ruby@v1
|
26
|
+
# uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
27
|
+
with:
|
28
|
+
ruby-version: 2.7
|
29
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
30
|
+
- name: Run rubocop
|
31
|
+
run: bundle exec rubocop
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
|
6
|
+
name: Ruby Gem
|
7
|
+
|
8
|
+
on:
|
9
|
+
# Manually publish
|
10
|
+
workflow_dispatch:
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
build:
|
14
|
+
name: Build + Publish
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
permissions:
|
17
|
+
packages: write
|
18
|
+
contents: read
|
19
|
+
|
20
|
+
steps:
|
21
|
+
- uses: actions/checkout@v2
|
22
|
+
- name: Set up Ruby
|
23
|
+
uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: 2.7
|
26
|
+
- run: bundle install
|
27
|
+
- name: Publish to RubyGems
|
28
|
+
env:
|
29
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
30
|
+
run: |
|
31
|
+
mkdir -p $HOME/.gem
|
32
|
+
touch $HOME/.gem/credentials
|
33
|
+
chmod 0600 $HOME/.gem/credentials
|
34
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
35
|
+
gem build *.gemspec
|
36
|
+
gem push *.gem
|
37
|
+
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1 +1,33 @@
|
|
1
|
-
|
1
|
+
require:
|
2
|
+
- rubocop-rails
|
3
|
+
- rubocop-rspec
|
4
|
+
|
5
|
+
inherit_from: .rubocop_todo.yml
|
6
|
+
|
7
|
+
AllCops:
|
8
|
+
TargetRubyVersion: 2.5
|
9
|
+
NewCops: enable
|
10
|
+
SuggestExtensions: false
|
11
|
+
|
12
|
+
Gemspec/RequireMFA:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Metrics/AbcSize:
|
16
|
+
Max: 20
|
17
|
+
|
18
|
+
Rails/RakeEnvironment:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
RSpec/NestedGroups:
|
22
|
+
Max: 4
|
23
|
+
|
24
|
+
Style/Alias:
|
25
|
+
EnforcedStyle: prefer_alias
|
26
|
+
|
27
|
+
Style/FrozenStringLiteralComment:
|
28
|
+
Exclude:
|
29
|
+
- 'gemfiles/**/*'
|
30
|
+
|
31
|
+
Style/StringLiterals:
|
32
|
+
Exclude:
|
33
|
+
- 'gemfiles/**/*'
|
data/.rubocop_todo.yml
CHANGED
@@ -1,321 +1,68 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2021-08-02 08:58:28 UTC using RuboCop version 1.18.4.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
10
|
-
#
|
11
|
-
#
|
12
|
-
|
13
|
-
|
14
|
-
EnforcedStyle: end
|
15
|
-
|
16
|
-
# Offense count: 1
|
17
|
-
# Cop supports --auto-correct.
|
18
|
-
Layout/CommentIndentation:
|
19
|
-
Exclude:
|
20
|
-
- 'spec/spec_helper.rb'
|
21
|
-
|
22
|
-
# Offense count: 1
|
23
|
-
# Cop supports --auto-correct.
|
24
|
-
Layout/EmptyLineAfterMagicComment:
|
25
|
-
Exclude:
|
26
|
-
- 'acts_as_recursive_tree.gemspec'
|
9
|
+
# Offense count: 6
|
10
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
11
|
+
# IgnoredMethods: refine
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Max: 87
|
27
14
|
|
28
15
|
# Offense count: 1
|
29
|
-
#
|
30
|
-
|
31
|
-
|
32
|
-
Exclude:
|
33
|
-
- 'lib/acts_as_recursive_tree/model.rb'
|
34
|
-
|
35
|
-
# Offense count: 5
|
36
|
-
# Cop supports --auto-correct.
|
37
|
-
Layout/EmptyLines:
|
38
|
-
Exclude:
|
39
|
-
- 'lib/acts_as_recursive_tree/model.rb'
|
40
|
-
- 'spec/db/models.rb'
|
41
|
-
- 'spec/model/node_spec.rb'
|
42
|
-
- 'spec/spec_helper.rb'
|
16
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
17
|
+
Metrics/MethodLength:
|
18
|
+
Max: 15
|
43
19
|
|
44
|
-
# Offense count:
|
45
|
-
#
|
46
|
-
#
|
47
|
-
|
48
|
-
Layout/EmptyLinesAroundBlockBody:
|
20
|
+
# Offense count: 18
|
21
|
+
# Configuration parameters: Prefixes.
|
22
|
+
# Prefixes: when, with, without
|
23
|
+
RSpec/ContextWording:
|
49
24
|
Exclude:
|
50
|
-
- '
|
51
|
-
- 'spec/db/schema.rb'
|
25
|
+
- 'spec/builders_spec.rb'
|
52
26
|
- 'spec/model/location_spec.rb'
|
53
27
|
- 'spec/model/node_spec.rb'
|
54
28
|
- 'spec/model/relation_spec.rb'
|
55
29
|
- 'spec/values_spec.rb'
|
56
30
|
|
57
|
-
# Offense count:
|
58
|
-
#
|
59
|
-
|
60
|
-
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
61
|
-
Layout/EmptyLinesAroundClassBody:
|
31
|
+
# Offense count: 37
|
32
|
+
# Configuration parameters: AssignmentOnly.
|
33
|
+
RSpec/InstanceVariable:
|
62
34
|
Exclude:
|
63
|
-
- 'lib/acts_as_recursive_tree/builders/ancestors.rb'
|
64
|
-
- 'lib/acts_as_recursive_tree/builders/leaves.rb'
|
65
|
-
- 'lib/acts_as_recursive_tree/builders/relation_builder.rb'
|
66
|
-
- 'lib/acts_as_recursive_tree/options/depth_condition.rb'
|
67
|
-
- 'lib/acts_as_recursive_tree/options/query_options.rb'
|
68
|
-
- 'spec/db/models.rb'
|
69
|
-
|
70
|
-
# Offense count: 6
|
71
|
-
# Cop supports --auto-correct.
|
72
|
-
Layout/EmptyLinesAroundMethodBody:
|
73
|
-
Exclude:
|
74
|
-
- 'lib/acts_as_recursive_tree/acts_macro.rb'
|
75
|
-
- 'lib/acts_as_recursive_tree/builders/leaves.rb'
|
76
|
-
- 'lib/acts_as_recursive_tree/options/values.rb'
|
77
|
-
- 'spec/model/node_spec.rb'
|
78
|
-
- 'spec/model/relation_spec.rb'
|
79
|
-
|
80
|
-
# Offense count: 2
|
81
|
-
# Cop supports --auto-correct.
|
82
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
83
|
-
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
84
|
-
Layout/EmptyLinesAroundModuleBody:
|
85
|
-
Exclude:
|
86
|
-
- 'lib/acts_as_recursive_tree/acts_macro.rb'
|
87
|
-
- 'lib/acts_as_recursive_tree/model.rb'
|
88
|
-
|
89
|
-
# Offense count: 6
|
90
|
-
# Cop supports --auto-correct.
|
91
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
92
|
-
# SupportedStyles: consistent, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
93
|
-
Layout/FirstParameterIndentation:
|
94
|
-
Exclude:
|
95
|
-
- 'lib/acts_as_recursive_tree/builders/leaves.rb'
|
96
|
-
- 'lib/acts_as_recursive_tree/model.rb'
|
97
|
-
- 'spec/model/relation_spec.rb'
|
98
|
-
|
99
|
-
# Offense count: 1
|
100
|
-
# Cop supports --auto-correct.
|
101
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, SupportedStylesForEmptyBraces.
|
102
|
-
# SupportedStyles: space, no_space
|
103
|
-
# SupportedStylesForEmptyBraces: space, no_space
|
104
|
-
Layout/SpaceBeforeBlockBraces:
|
105
|
-
Exclude:
|
106
|
-
- 'spec/values_spec.rb'
|
107
|
-
|
108
|
-
# Offense count: 2
|
109
|
-
# Cop supports --auto-correct.
|
110
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
111
|
-
# SupportedStyles: require_no_space, require_space
|
112
|
-
Layout/SpaceInLambdaLiteral:
|
113
|
-
Exclude:
|
114
|
-
- 'lib/acts_as_recursive_tree/scopes.rb'
|
115
|
-
- 'spec/builders_spec.rb'
|
116
|
-
|
117
|
-
# Offense count: 2
|
118
|
-
# Cop supports --auto-correct.
|
119
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces, SpaceBeforeBlockParameters.
|
120
|
-
# SupportedStyles: space, no_space
|
121
|
-
# SupportedStylesForEmptyBraces: space, no_space
|
122
|
-
Layout/SpaceInsideBlockBraces:
|
123
|
-
Exclude:
|
124
|
-
- 'spec/values_spec.rb'
|
125
|
-
|
126
|
-
# Offense count: 2
|
127
|
-
# Cop supports --auto-correct.
|
128
|
-
Layout/SpaceInsidePercentLiteralDelimiters:
|
129
|
-
Exclude:
|
130
|
-
- 'Rakefile'
|
131
|
-
|
132
|
-
# Offense count: 10
|
133
|
-
# Cop supports --auto-correct.
|
134
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
135
|
-
# SupportedStyles: final_newline, final_blank_line
|
136
|
-
Layout/TrailingBlankLines:
|
137
|
-
Exclude:
|
138
|
-
- 'lib/acts_as_recursive_tree/acts_macro.rb'
|
139
|
-
- 'lib/acts_as_recursive_tree/options/depth_condition.rb'
|
140
|
-
- 'lib/acts_as_recursive_tree/options/values.rb'
|
141
|
-
- 'spec/db/database.rb'
|
142
|
-
- 'spec/db/models.rb'
|
143
|
-
- 'spec/db/schema.rb'
|
144
35
|
- 'spec/model/location_spec.rb'
|
145
36
|
- 'spec/model/node_spec.rb'
|
146
37
|
- 'spec/model/relation_spec.rb'
|
147
|
-
- 'spec/values_spec.rb'
|
148
|
-
|
149
|
-
# Offense count: 14
|
150
|
-
Lint/AmbiguousRegexpLiteral:
|
151
|
-
Exclude:
|
152
|
-
- 'spec/builders_spec.rb'
|
153
|
-
- 'spec/values_spec.rb'
|
154
38
|
|
155
39
|
# Offense count: 1
|
156
|
-
|
157
|
-
Lint/DeprecatedClassMethods:
|
40
|
+
RSpec/MultipleDescribes:
|
158
41
|
Exclude:
|
159
|
-
- '
|
160
|
-
|
161
|
-
# Offense count: 1
|
162
|
-
# Cop supports --auto-correct.
|
163
|
-
# Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith, AutoCorrect.
|
164
|
-
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
165
|
-
Lint/EndAlignment:
|
166
|
-
Exclude:
|
167
|
-
- 'lib/acts_as_recursive_tree/options/values.rb'
|
168
|
-
|
169
|
-
# Offense count: 1
|
170
|
-
Lint/HandleExceptions:
|
171
|
-
Exclude:
|
172
|
-
- 'Rakefile'
|
173
|
-
|
174
|
-
# Offense count: 1
|
175
|
-
# Cop supports --auto-correct.
|
176
|
-
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
|
177
|
-
Lint/UnusedMethodArgument:
|
178
|
-
Exclude:
|
179
|
-
- 'lib/acts_as_recursive_tree/builders/leaves.rb'
|
180
|
-
|
181
|
-
# Offense count: 5
|
182
|
-
Metrics/AbcSize:
|
183
|
-
Max: 44
|
184
|
-
|
185
|
-
# Offense count: 8
|
186
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
187
|
-
Metrics/BlockLength:
|
188
|
-
Max: 89
|
189
|
-
|
190
|
-
# Offense count: 41
|
191
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
192
|
-
# URISchemes: http, https
|
193
|
-
Metrics/LineLength:
|
194
|
-
Max: 291
|
42
|
+
- 'spec/builders_spec.rb'
|
195
43
|
|
196
44
|
# Offense count: 2
|
197
|
-
|
198
|
-
|
199
|
-
Max: 13
|
45
|
+
RSpec/MultipleExpectations:
|
46
|
+
Max: 2
|
200
47
|
|
201
|
-
# Offense count:
|
202
|
-
#
|
203
|
-
Security/YAMLLoad:
|
204
|
-
Exclude:
|
205
|
-
- 'spec/db/database.rb'
|
206
|
-
|
207
|
-
# Offense count: 1
|
208
|
-
# Cop supports --auto-correct.
|
209
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
210
|
-
# SupportedStyles: prefer_alias, prefer_alias_method
|
211
|
-
Style/Alias:
|
212
|
-
Exclude:
|
213
|
-
- 'lib/acts_as_recursive_tree/acts_macro.rb'
|
214
|
-
|
215
|
-
# Offense count: 1
|
216
|
-
# Cop supports --auto-correct.
|
217
|
-
Style/BlockComments:
|
218
|
-
Exclude:
|
219
|
-
- 'spec/spec_helper.rb'
|
220
|
-
|
221
|
-
# Offense count: 1
|
222
|
-
# Cop supports --auto-correct.
|
223
|
-
Style/ColonMethodCall:
|
224
|
-
Exclude:
|
225
|
-
- 'spec/db/database.rb'
|
226
|
-
|
227
|
-
# Offense count: 20
|
48
|
+
# Offense count: 17
|
49
|
+
# Configuration parameters: AllowedConstants.
|
228
50
|
Style/Documentation:
|
229
51
|
Exclude:
|
230
|
-
- 'spec/**/*'
|
231
|
-
- 'test/**/*'
|
232
52
|
- 'lib/acts_as_recursive_tree.rb'
|
233
53
|
- 'lib/acts_as_recursive_tree/acts_macro.rb'
|
234
|
-
- 'lib/acts_as_recursive_tree/associations.rb'
|
235
|
-
- 'lib/acts_as_recursive_tree/builders.rb'
|
236
54
|
- 'lib/acts_as_recursive_tree/builders/ancestors.rb'
|
237
55
|
- 'lib/acts_as_recursive_tree/builders/descendants.rb'
|
238
56
|
- 'lib/acts_as_recursive_tree/builders/leaves.rb'
|
239
|
-
- 'lib/acts_as_recursive_tree/builders/relation_builder.rb'
|
240
57
|
- 'lib/acts_as_recursive_tree/model.rb'
|
241
|
-
- 'lib/acts_as_recursive_tree/options.rb'
|
242
58
|
- 'lib/acts_as_recursive_tree/options/depth_condition.rb'
|
243
59
|
- 'lib/acts_as_recursive_tree/options/query_options.rb'
|
244
60
|
- 'lib/acts_as_recursive_tree/options/values.rb'
|
245
61
|
- 'lib/acts_as_recursive_tree/railtie.rb'
|
246
|
-
- 'lib/acts_as_recursive_tree/scopes.rb'
|
247
|
-
|
248
|
-
# Offense count: 2
|
249
|
-
# Cop supports --auto-correct.
|
250
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
251
|
-
# SupportedStyles: compact, expanded
|
252
|
-
Style/EmptyMethod:
|
253
|
-
Exclude:
|
254
|
-
- 'lib/acts_as_recursive_tree/options/values.rb'
|
255
62
|
|
256
|
-
# Offense count:
|
257
|
-
# Cop supports --auto-correct.
|
258
|
-
Style/Encoding:
|
259
|
-
Exclude:
|
260
|
-
- 'acts_as_recursive_tree.gemspec'
|
261
|
-
- 'spec/db/schema.rb'
|
262
|
-
|
263
|
-
# Offense count: 1
|
63
|
+
# Offense count: 9
|
264
64
|
# Cop supports --auto-correct.
|
265
|
-
# Configuration parameters:
|
266
|
-
#
|
267
|
-
|
268
|
-
|
269
|
-
- 'spec/db/schema.rb'
|
270
|
-
|
271
|
-
# Offense count: 2
|
272
|
-
# Cop supports --auto-correct.
|
273
|
-
# Configuration parameters: MaxLineLength.
|
274
|
-
Style/IfUnlessModifier:
|
275
|
-
Exclude:
|
276
|
-
- 'spec/model/node_spec.rb'
|
277
|
-
- 'spec/model/relation_spec.rb'
|
278
|
-
|
279
|
-
# Offense count: 1
|
280
|
-
# Cop supports --auto-correct.
|
281
|
-
# Configuration parameters: InverseMethods, InverseBlocks.
|
282
|
-
Style/InverseMethods:
|
283
|
-
Exclude:
|
284
|
-
- 'lib/acts_as_recursive_tree/model.rb'
|
285
|
-
|
286
|
-
# Offense count: 6
|
287
|
-
# Cop supports --auto-correct.
|
288
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
289
|
-
# SupportedStyles: line_count_dependent, lambda, literal
|
290
|
-
Style/Lambda:
|
291
|
-
Exclude:
|
292
|
-
- 'lib/acts_as_recursive_tree/scopes.rb'
|
293
|
-
|
294
|
-
# Offense count: 1
|
295
|
-
# Cop supports --auto-correct.
|
296
|
-
Style/MultilineIfModifier:
|
297
|
-
Exclude:
|
298
|
-
- 'lib/acts_as_recursive_tree/scopes.rb'
|
299
|
-
|
300
|
-
# Offense count: 2
|
301
|
-
# Cop supports --auto-correct.
|
302
|
-
# Configuration parameters: PreferredDelimiters.
|
303
|
-
Style/PercentLiteralDelimiters:
|
304
|
-
Exclude:
|
305
|
-
- 'Rakefile'
|
306
|
-
- 'acts_as_recursive_tree.gemspec'
|
307
|
-
|
308
|
-
# Offense count: 17
|
309
|
-
# Cop supports --auto-correct.
|
310
|
-
Style/RedundantSelf:
|
311
|
-
Exclude:
|
312
|
-
- 'lib/acts_as_recursive_tree/acts_macro.rb'
|
313
|
-
- 'lib/acts_as_recursive_tree/associations.rb'
|
314
|
-
- 'lib/acts_as_recursive_tree/model.rb'
|
315
|
-
- 'lib/acts_as_recursive_tree/scopes.rb'
|
316
|
-
|
317
|
-
# Offense count: 2
|
318
|
-
# Cop supports --auto-correct.
|
319
|
-
Style/UnneededPercentQ:
|
320
|
-
Exclude:
|
321
|
-
- 'acts_as_recursive_tree.gemspec'
|
65
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
66
|
+
# URISchemes: http, https
|
67
|
+
Layout/LineLength:
|
68
|
+
Max: 291
|
data/Appraisals
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
appraise 'ar-52' do
|
4
|
+
gem 'activerecord', '~> 5.2.0'
|
5
|
+
gem 'activesupport', '~> 5.2.0'
|
6
|
+
end
|
7
|
+
|
8
|
+
appraise 'ar-60' do
|
9
|
+
gem 'activerecord', '~> 6.0.0'
|
10
|
+
gem 'activesupport', '~> 6.0.0'
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise 'ar-61' do
|
14
|
+
gem 'activerecord', '~> 6.1.0'
|
15
|
+
gem 'activesupport', '~> 6.1.0'
|
16
|
+
end
|
17
|
+
|
18
|
+
appraise 'ar-70' do
|
19
|
+
gem 'activerecord', '~> 7.0.0'
|
20
|
+
gem 'activesupport', '~> 7.0.0'
|
21
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
### Version 3.1.0
|
2
|
+
- Rails 7 support
|
3
|
+
|
4
|
+
### Version 3.0.0
|
5
|
+
- BREAKING: Dropped support for Rails < 5.2
|
6
|
+
- BREAKING: Increased minimum Ruby version to 2.5
|
7
|
+
- ADD: initial support for Rails < 7
|
8
|
+
- CHANGE: Using zeitwerk for auto loading
|
9
|
+
|
10
|
+
### Version 2.2.1
|
11
|
+
- Rails 6.1 support
|
12
|
+
|
13
|
+
### Version 2.2.0
|
14
|
+
- Rails 6.0 support
|
15
|
+
|
1
16
|
### Version 2.1.1
|
2
17
|
- Enabled subselect query when using depth
|
3
18
|
- new QueryOption query_strategy for forcing a specific strategy (:join, :subselect)
|
@@ -29,4 +44,4 @@
|
|
29
44
|
- BUGFIX: ordering result when querying ancestors
|
30
45
|
|
31
46
|
### Version 1.0.0
|
32
|
-
-
|
47
|
+
- initial release using AREL
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# ActsAsRecursiveTree
|
2
2
|
|
3
|
+
[](https://github.com/1and1/acts_as_recursive_tree/actions?query=workflow%3ACI+branch%3Amaster)
|
4
|
+
[](https://badge.fury.io/rb/acts_as_recursive_tree)
|
5
|
+
|
3
6
|
Use the power of recursive SQL statements in your Rails application.
|
4
7
|
|
5
8
|
When you have tree based data in your application, you always to struggle with retrieving data. There are solutions, but the always come at a price:
|
@@ -9,6 +12,12 @@ When you have tree based data in your application, you always to struggle with r
|
|
9
12
|
|
10
13
|
Luckily, there is already a SQL standard that makes it very easy to retrieve data in the traditional parent/child relation. Currently this is only supported in sqlite and Postgres. With this it is possible to query complete trees without the need of extra tables or indices.
|
11
14
|
|
15
|
+
## Supported environments
|
16
|
+
ActsAsRecursiveTree currently supports following ActiveRecord versions and is tested for compatibility:
|
17
|
+
* ActiveRecord 5.2.x
|
18
|
+
* ActiveRecord 6.0.x
|
19
|
+
* ActiveRecord 6.1.x
|
20
|
+
* ActiveRecord 7.0.x
|
12
21
|
|
13
22
|
## Installation
|
14
23
|
|
data/Rakefile
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/gem_tasks'
|
2
|
-
|
3
|
-
require 'rspec/core/rake_task'
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
4
|
+
require 'rspec/core/rake_task'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
task default: [:spec]
|
9
9
|
|
10
10
|
desc 'Deletes temporary files'
|
11
11
|
task :clean_tmp_files do
|
12
|
-
%w
|
13
|
-
File.delete(file) if File.
|
12
|
+
%w[db.log test.sqlite3].each do |file|
|
13
|
+
File.delete(file) if File.exist?(file)
|
14
14
|
end
|
15
15
|
end
|
@@ -1,30 +1,39 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'acts_as_recursive_tree/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
11
|
-
spec.summary
|
12
|
-
spec.description
|
13
|
-
This is a ruby gem that provides drop in replacement for acts_as_tree but makes use of SQL recursive statement. Be sure to have a DBMS that supports recursive queries when using this gem (e.g. PostgreSQL or SQLite).
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
16
|
-
|
17
|
-
|
8
|
+
spec.name = 'acts_as_recursive_tree'
|
9
|
+
spec.version = ActsAsRecursiveTree::VERSION
|
10
|
+
spec.authors = ['Wolfgang Wedelich-John', 'Willem Mulder']
|
11
|
+
spec.email = %w[wolfgang.wedelich@ionos.com 14mRh4X0r@gmail.com]
|
12
|
+
spec.summary = 'Drop in replacement for acts_as_tree but using recursive queries'
|
13
|
+
spec.description = '
|
14
|
+
This is a ruby gem that provides drop in replacement for acts_as_tree but makes use of SQL recursive statement. Be sure to have a DBMS that supports recursive queries when using this gem (e.g. PostgreSQL or SQLite). '
|
15
|
+
spec.homepage = 'https://github.com/1and1/acts_as_recursive_tree'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
spec.metadata = {
|
18
|
+
'bug_tracker_uri' => 'https://github.com/1and1/acts_as_recursive_tree/issues',
|
19
|
+
'changelog_uri' => 'https://github.com/1and1/acts_as_recursive_tree/blob/main/CHANGELOG.md'
|
20
|
+
}
|
21
|
+
spec.required_ruby_version = '>= 2.5.0'
|
18
22
|
spec.files = `git ls-files -z`.split("\x0")
|
19
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
23
|
spec.test_files = spec.files.grep(%r{^spec/})
|
21
24
|
spec.require_paths = ['lib']
|
22
25
|
|
23
|
-
spec.add_runtime_dependency 'activerecord', '>= 5.
|
26
|
+
spec.add_runtime_dependency 'activerecord', '>= 5.2.0', '< 7.1'
|
27
|
+
spec.add_runtime_dependency 'activesupport', '>= 5.2.0', '< 7.1'
|
28
|
+
spec.add_runtime_dependency 'zeitwerk', '>= 2.4'
|
24
29
|
|
25
|
-
spec.add_development_dependency '
|
30
|
+
spec.add_development_dependency 'appraisal', '~> 2.4'
|
26
31
|
spec.add_development_dependency 'database_cleaner', '~> 1.5'
|
27
|
-
spec.add_development_dependency 'rake'
|
28
|
-
spec.add_development_dependency 'rspec-rails', '
|
32
|
+
spec.add_development_dependency 'rake'
|
33
|
+
spec.add_development_dependency 'rspec-rails', '>= 3.5'
|
34
|
+
spec.add_development_dependency 'rubocop', '~> 1.23.0'
|
35
|
+
spec.add_development_dependency 'rubocop-rails', '~> 2.12.0'
|
36
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.6.0'
|
37
|
+
|
29
38
|
spec.add_development_dependency 'sqlite3', '~> 1.3'
|
30
39
|
end
|