acts_as_recursive_tree 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Appraisals +26 -0
- data/acts_as_recursive_tree.gemspec +4 -3
- data/lib/acts_as_recursive_tree/options/values.rb +13 -1
- data/lib/acts_as_recursive_tree/version.rb +1 -1
- data/spec/db/database.rb +8 -2
- data/spec/values_spec.rb +2 -2
- metadata +25 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea1cf22b09ed91c55f3388b8c794a3d820eb353896feca3df3cd16bfadd1e1fb
|
4
|
+
data.tar.gz: 55605034be64624f710175f2bc5714273f87e39124799fa4952dfb8425f9719d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e357b5809c1aa3c28789af9c81d6ac17739f04b40cec8e43a6ecb2b690ea69e9d3752aab7cf3579fb38042b387132c9e02ddf5b3facc54b1206b33eb184d194
|
7
|
+
data.tar.gz: 97a0ecfa41d4085f2a6a14a964be479747f4857af9400e9412699f6b7a21324c2af3632bba5831576ac08156fa8ff01ff06025e09c46b0e51fe64221b8a8bef6
|
data/.gitignore
CHANGED
data/Appraisals
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
appraise "ar-50" do
|
2
|
+
ruby '~> 2'
|
3
|
+
|
4
|
+
gem 'activerecord', '~> 5.0.0'
|
5
|
+
gem 'sqlite3', '~> 1.3.6'
|
6
|
+
end
|
7
|
+
|
8
|
+
appraise "ar-51" do
|
9
|
+
ruby '~> 2'
|
10
|
+
|
11
|
+
gem 'activerecord', '~> 5.1.0'
|
12
|
+
end
|
13
|
+
|
14
|
+
appraise "ar-52" do
|
15
|
+
ruby '~> 2'
|
16
|
+
|
17
|
+
gem 'activerecord', '~> 5.2.0'
|
18
|
+
end
|
19
|
+
|
20
|
+
appraise "ar-60" do
|
21
|
+
gem 'activerecord', '~> 6.0.0'
|
22
|
+
end
|
23
|
+
|
24
|
+
appraise "ar-61" do
|
25
|
+
gem 'activerecord', '~> 6.1.0'
|
26
|
+
end
|
@@ -6,8 +6,8 @@ require 'acts_as_recursive_tree/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'acts_as_recursive_tree'
|
8
8
|
spec.version = ActsAsRecursiveTree::VERSION
|
9
|
-
spec.authors = ['Wolfgang Wedelich-John']
|
10
|
-
spec.email = ['wolfgang.wedelich@1und1.de']
|
9
|
+
spec.authors = ['Wolfgang Wedelich-John', 'Willem Mulder']
|
10
|
+
spec.email = ['wolfgang.wedelich@1und1.de', '14mRh4X0r@gmail.com']
|
11
11
|
spec.summary = %q{Drop in replacement for acts_as_tree but using recursive queries}
|
12
12
|
spec.description = %q{
|
13
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). }
|
@@ -20,10 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^spec/})
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_runtime_dependency 'activerecord', '>= 5.0.0', '< 6.
|
23
|
+
spec.add_runtime_dependency 'activerecord', '>= 5.0.0', '< 6.2.0'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'database_cleaner', '~> 1.5'
|
26
26
|
spec.add_development_dependency 'rake', '~> 10.0'
|
27
27
|
spec.add_development_dependency 'rspec-rails', '~> 3.5'
|
28
28
|
spec.add_development_dependency 'sqlite3', '~> 1.3'
|
29
|
+
spec.add_development_dependency 'appraisal', '~> 2.4'
|
29
30
|
end
|
@@ -38,6 +38,16 @@ module ActsAsRecursiveTree
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
class RangeValue < Base
|
42
|
+
def apply_to(attribute)
|
43
|
+
attribute.between(prepared_value)
|
44
|
+
end
|
45
|
+
|
46
|
+
def apply_negated_to(attribute)
|
47
|
+
attribute.not_between(prepared_value)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
41
51
|
class MultiValue < Base
|
42
52
|
def apply_to(attribute)
|
43
53
|
attribute.in(prepared_value)
|
@@ -62,6 +72,8 @@ module ActsAsRecursiveTree
|
|
62
72
|
SingleValue
|
63
73
|
when ::ActiveRecord::Relation
|
64
74
|
Relation
|
75
|
+
when Range
|
76
|
+
RangeValue
|
65
77
|
when Enumerable
|
66
78
|
MultiValue
|
67
79
|
when ::ActiveRecord::Base
|
@@ -74,4 +86,4 @@ module ActsAsRecursiveTree
|
|
74
86
|
end
|
75
87
|
end
|
76
88
|
end
|
77
|
-
end
|
89
|
+
end
|
data/spec/db/database.rb
CHANGED
@@ -8,10 +8,16 @@ ActiveRecord::Migration.verbose = false
|
|
8
8
|
|
9
9
|
ActiveRecord::Base.configurations = YAML::load(File.read("#{database_folder}/database.yml"))
|
10
10
|
|
11
|
-
|
11
|
+
if ActiveRecord.version >= Gem::Version.new('6.1.0')
|
12
|
+
config = ActiveRecord::Base.configurations.configs_for env_name: database_adapter, name: "primary"
|
13
|
+
database = config.database
|
14
|
+
else
|
15
|
+
config = ActiveRecord::Base.configurations[database_adapter]
|
16
|
+
database = config["database"]
|
17
|
+
end
|
12
18
|
|
13
19
|
# remove database if present
|
14
|
-
FileUtils.rm
|
20
|
+
FileUtils.rm database, force: true
|
15
21
|
|
16
22
|
ActiveRecord::Base.establish_connection(database_adapter.to_sym)
|
17
23
|
ActiveRecord::Base.establish_connection(config)
|
data/spec/values_spec.rb
CHANGED
@@ -57,7 +57,7 @@ describe ActsAsRecursiveTree::Options::Values do
|
|
57
57
|
let(:range) { 1..3 }
|
58
58
|
subject(:value) { described_class.create(range) }
|
59
59
|
|
60
|
-
it { is_expected.to be_a ActsAsRecursiveTree::Options::Values::
|
60
|
+
it { is_expected.to be_a ActsAsRecursiveTree::Options::Values::RangeValue }
|
61
61
|
|
62
62
|
it 'should apply_to' do
|
63
63
|
expect(value.apply_to(attribute).to_sql).to end_with "BETWEEN #{range.begin} AND #{range.end}"
|
@@ -83,4 +83,4 @@ describe ActsAsRecursiveTree::Options::Values do
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
86
|
-
end
|
86
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_recursive_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wolfgang Wedelich-John
|
8
|
-
|
8
|
+
- Willem Mulder
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-07-30 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activerecord
|
@@ -19,7 +20,7 @@ dependencies:
|
|
19
20
|
version: 5.0.0
|
20
21
|
- - "<"
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version: 6.
|
23
|
+
version: 6.2.0
|
23
24
|
type: :runtime
|
24
25
|
prerelease: false
|
25
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +30,7 @@ dependencies:
|
|
29
30
|
version: 5.0.0
|
30
31
|
- - "<"
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version: 6.
|
33
|
+
version: 6.2.0
|
33
34
|
- !ruby/object:Gem::Dependency
|
34
35
|
name: database_cleaner
|
35
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,11 +87,26 @@ dependencies:
|
|
86
87
|
- - "~>"
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: '1.3'
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: appraisal
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.4'
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.4'
|
89
104
|
description: "\n This is a ruby gem that provides drop in replacement for acts_as_tree
|
90
105
|
but makes use of SQL recursive statement. Be sure to have a DBMS that supports recursive
|
91
106
|
queries when using this gem (e.g. PostgreSQL or SQLite). "
|
92
107
|
email:
|
93
108
|
- wolfgang.wedelich@1und1.de
|
109
|
+
- 14mRh4X0r@gmail.com
|
94
110
|
executables: []
|
95
111
|
extensions: []
|
96
112
|
extra_rdoc_files: []
|
@@ -99,6 +115,7 @@ files:
|
|
99
115
|
- ".rspec"
|
100
116
|
- ".rubocop.yml"
|
101
117
|
- ".rubocop_todo.yml"
|
118
|
+
- Appraisals
|
102
119
|
- CHANGELOG.md
|
103
120
|
- Gemfile
|
104
121
|
- LICENSE.txt
|
@@ -141,7 +158,7 @@ homepage: https://github.com/1and1/acts_as_recursive_tree
|
|
141
158
|
licenses:
|
142
159
|
- MIT
|
143
160
|
metadata: {}
|
144
|
-
post_install_message:
|
161
|
+
post_install_message:
|
145
162
|
rdoc_options: []
|
146
163
|
require_paths:
|
147
164
|
- lib
|
@@ -156,8 +173,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
173
|
- !ruby/object:Gem::Version
|
157
174
|
version: '0'
|
158
175
|
requirements: []
|
159
|
-
rubygems_version: 3.
|
160
|
-
signing_key:
|
176
|
+
rubygems_version: 3.1.6
|
177
|
+
signing_key:
|
161
178
|
specification_version: 4
|
162
179
|
summary: Drop in replacement for acts_as_tree but using recursive queries
|
163
180
|
test_files:
|