closure_tree 7.2.0 → 7.3.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 +96 -0
- data/.gitignore +2 -1
- data/.rspec +1 -1
- data/Appraisals +15 -0
- data/CHANGELOG.md +4 -0
- data/Rakefile +7 -10
- data/bin/appraisal +29 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/closure_tree.gemspec +6 -2
- data/lib/closure_tree/has_closure_tree_root.rb +1 -1
- data/lib/closure_tree/version.rb +1 -1
- metadata +51 -6
- data/.travis.yml +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7034c0f3149bb3fabe92f4d03f118e4704b80a5ccbfa371e50f1a0f7f624c534
|
4
|
+
data.tar.gz: 9a9faf0245f8252442c3c2e80a73eeccdf1e94d748dcb8a2ace96ebf131984c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13ee25bbdd76b240ebc74a2f3b6b5846c09a302f60ec2d48dff0d0d8a825f015a66bed08e1eec2bdfad80d437e139337e9e9bbdbb0831ac3b0a4bd5e0493e7e8
|
7
|
+
data.tar.gz: 97f0e9bbde7fb694bf52833cfd9c469b5f22944752b5f33586486c2edd10958ac422dc957a847d3ba63153de85b63e9e84494b0529cb855590a72610726d5c2f
|
@@ -0,0 +1,96 @@
|
|
1
|
+
---
|
2
|
+
name: CI
|
3
|
+
|
4
|
+
on:
|
5
|
+
- push
|
6
|
+
- pull_request
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
rspec:
|
10
|
+
runs-on: ubuntu-20.04
|
11
|
+
|
12
|
+
services:
|
13
|
+
postgres:
|
14
|
+
image: 'postgres:13'
|
15
|
+
ports: ['5432:5432']
|
16
|
+
env:
|
17
|
+
POSTGRES_PASSWORD: postgres
|
18
|
+
POSTGRES_DB: closure_tree
|
19
|
+
options: >-
|
20
|
+
--health-cmd pg_isready
|
21
|
+
--health-interval 10s
|
22
|
+
--health-timeout 5s
|
23
|
+
--health-retries 5
|
24
|
+
|
25
|
+
strategy:
|
26
|
+
fail-fast: false
|
27
|
+
matrix:
|
28
|
+
ruby:
|
29
|
+
- '3.0'
|
30
|
+
- '2.7'
|
31
|
+
- '2.6'
|
32
|
+
- '2.5'
|
33
|
+
rails:
|
34
|
+
- activerecord_6.1
|
35
|
+
- activerecord_6.0
|
36
|
+
- activerecord_5.2
|
37
|
+
- activerecord_5.1
|
38
|
+
- activerecord_5.0
|
39
|
+
- activerecord_4.2
|
40
|
+
- activerecord_edge
|
41
|
+
adapter:
|
42
|
+
- sqlite3
|
43
|
+
- mysql2
|
44
|
+
- postgresql
|
45
|
+
exclude:
|
46
|
+
- ruby: '2.7'
|
47
|
+
rails: activerecord_4.2
|
48
|
+
- ruby: '3.0'
|
49
|
+
rails: activerecord_4.2
|
50
|
+
- ruby: '3.0'
|
51
|
+
rails: activerecord_5.0
|
52
|
+
- ruby: '3.0'
|
53
|
+
rails: activerecord_5.1
|
54
|
+
- ruby: '3.0'
|
55
|
+
rails: activerecord_5.2
|
56
|
+
- ruby: '2.5'
|
57
|
+
rails: activerecord_edge
|
58
|
+
|
59
|
+
steps:
|
60
|
+
- name: Checkout
|
61
|
+
uses: actions/checkout@v2
|
62
|
+
|
63
|
+
- name: Setup Ruby
|
64
|
+
uses: ruby/setup-ruby@v1
|
65
|
+
with:
|
66
|
+
ruby-version: ${{ matrix.ruby }}
|
67
|
+
|
68
|
+
- name: Set DB Adapter
|
69
|
+
env:
|
70
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
71
|
+
DB_ADAPTER: ${{ matrix.adapter }}
|
72
|
+
|
73
|
+
# See: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#mysql
|
74
|
+
run: |
|
75
|
+
if [ "${DB_ADAPTER}" = "mysql2" ]; then
|
76
|
+
sudo systemctl start mysql.service
|
77
|
+
mysql -u root -proot -e 'create database closure_tree;'
|
78
|
+
fi
|
79
|
+
|
80
|
+
- name: Bundle
|
81
|
+
env:
|
82
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
83
|
+
DB_ADAPTER: ${{ matrix.adapter }}
|
84
|
+
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
|
85
|
+
run: |
|
86
|
+
gem install bundler
|
87
|
+
bundle config path vendor/bundle
|
88
|
+
bundle install --jobs 4 --retry 3
|
89
|
+
|
90
|
+
- name: RSpec
|
91
|
+
env:
|
92
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
93
|
+
DB_ADAPTER: ${{ matrix.adapter }}
|
94
|
+
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
|
95
|
+
WITH_ADVISORY_LOCK_PREFIX: ${{ github.run_id }}
|
96
|
+
run: bin/rake --trace spec:all
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--
|
1
|
+
--color
|
data/Appraisals
CHANGED
@@ -74,6 +74,21 @@ appraise 'activerecord-6.0' do
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
+
appraise 'activerecord-6.1' do
|
78
|
+
gem 'activerecord', '~> 6.1.0'
|
79
|
+
platforms :ruby do
|
80
|
+
gem 'mysql2'
|
81
|
+
gem 'pg'
|
82
|
+
gem 'sqlite3'
|
83
|
+
end
|
84
|
+
|
85
|
+
platforms :jruby do
|
86
|
+
gem 'activerecord-jdbcmysql-adapter'
|
87
|
+
gem 'activerecord-jdbcpostgresql-adapter'
|
88
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
77
92
|
appraise 'activerecord-edge' do
|
78
93
|
gem 'activerecord', github: 'rails/rails'
|
79
94
|
platforms :ruby do
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
@@ -1,23 +1,20 @@
|
|
1
|
-
|
2
|
-
require 'bundler/setup'
|
3
|
-
rescue LoadError
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
6
2
|
|
7
|
-
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
8
5
|
|
9
|
-
require "rspec/core/rake_task"
|
10
6
|
RSpec::Core::RakeTask.new(:spec) do |task|
|
11
|
-
task.pattern = 'spec/*_spec.rb'
|
7
|
+
task.pattern = 'spec/closure_tree/*_spec.rb'
|
12
8
|
end
|
13
9
|
|
14
|
-
task :
|
10
|
+
task default: :spec
|
15
11
|
|
16
12
|
namespace :spec do
|
17
13
|
desc 'Run all spec variants'
|
18
14
|
task :all do
|
19
|
-
rake = '
|
15
|
+
rake = 'bin/rake'
|
20
16
|
fail unless system("#{rake} spec:generators")
|
17
|
+
|
21
18
|
[['', ''], ['db_prefix_', ''], ['', '_db_suffix'], ['abc_', '_123']].each do |prefix, suffix|
|
22
19
|
env = "DB_PREFIX=#{prefix} DB_SUFFIX=#{suffix}"
|
23
20
|
fail unless system("#{rake} spec #{env}")
|
data/bin/appraisal
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'appraisal' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("appraisal", "appraisal")
|
data/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/closure_tree.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/closure_tree/version'
|
3
4
|
|
4
5
|
Gem::Specification.new do |gem|
|
5
6
|
gem.name = 'closure_tree'
|
@@ -26,8 +27,11 @@ Gem::Specification.new do |gem|
|
|
26
27
|
gem.add_development_dependency 'database_cleaner'
|
27
28
|
gem.add_development_dependency 'generator_spec'
|
28
29
|
gem.add_development_dependency 'parallel'
|
30
|
+
gem.add_development_dependency 'pg'
|
29
31
|
gem.add_development_dependency 'rspec-instafail'
|
30
32
|
gem.add_development_dependency 'rspec-rails'
|
33
|
+
gem.add_development_dependency 'sqlite3'
|
34
|
+
gem.add_development_dependency 'simplecov'
|
31
35
|
gem.add_development_dependency 'timecop'
|
32
36
|
# gem.add_development_dependency 'byebug'
|
33
37
|
# gem.add_development_dependency 'ruby-prof' # <- don't need this normally.
|
@@ -8,7 +8,7 @@ module ClosureTree
|
|
8
8
|
options[:class_name] ||= assoc_name.to_s.sub(/\Aroot_/, "").classify
|
9
9
|
options[:foreign_key] ||= self.name.underscore << "_id"
|
10
10
|
|
11
|
-
has_one assoc_name, -> { where(parent: nil) }, options
|
11
|
+
has_one assoc_name, -> { where(parent: nil) }, **options
|
12
12
|
|
13
13
|
# Fetches the association, eager loading all children and given associations
|
14
14
|
define_method("#{assoc_name}_including_tree") do |*args|
|
data/lib/closure_tree/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: closure_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew McEachen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pg
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rspec-instafail
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +136,34 @@ dependencies:
|
|
122
136
|
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: sqlite3
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: simplecov
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
125
167
|
- !ruby/object:Gem::Dependency
|
126
168
|
name: timecop
|
127
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,9 +185,9 @@ executables: []
|
|
143
185
|
extensions: []
|
144
186
|
extra_rdoc_files: []
|
145
187
|
files:
|
188
|
+
- ".github/workflows/ci.yml"
|
146
189
|
- ".gitignore"
|
147
190
|
- ".rspec"
|
148
|
-
- ".travis.yml"
|
149
191
|
- ".yardopts"
|
150
192
|
- Appraisals
|
151
193
|
- CHANGELOG.md
|
@@ -154,6 +196,9 @@ files:
|
|
154
196
|
- README.md
|
155
197
|
- Rakefile
|
156
198
|
- _config.yml
|
199
|
+
- bin/appraisal
|
200
|
+
- bin/rake
|
201
|
+
- bin/rspec
|
157
202
|
- closure_tree.gemspec
|
158
203
|
- lib/closure_tree.rb
|
159
204
|
- lib/closure_tree/active_record_support.rb
|
@@ -184,7 +229,7 @@ homepage: http://mceachen.github.io/closure_tree/
|
|
184
229
|
licenses:
|
185
230
|
- MIT
|
186
231
|
metadata: {}
|
187
|
-
post_install_message:
|
232
|
+
post_install_message:
|
188
233
|
rdoc_options: []
|
189
234
|
require_paths:
|
190
235
|
- lib
|
@@ -200,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
245
|
version: '0'
|
201
246
|
requirements: []
|
202
247
|
rubygems_version: 3.0.3
|
203
|
-
signing_key:
|
248
|
+
signing_key:
|
204
249
|
specification_version: 4
|
205
250
|
summary: Easily and efficiently make your ActiveRecord model support hierarchies
|
206
251
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
cache: bundler
|
2
|
-
language: ruby
|
3
|
-
|
4
|
-
rvm:
|
5
|
-
- 2.7.1
|
6
|
-
- 2.6.3
|
7
|
-
- 2.5.5
|
8
|
-
|
9
|
-
gemfile:
|
10
|
-
- gemfiles/activerecord_6.0.gemfile
|
11
|
-
- gemfiles/activerecord_5.2.gemfile
|
12
|
-
- gemfiles/activerecord_5.1.gemfile
|
13
|
-
- gemfiles/activerecord_5.0.gemfile
|
14
|
-
- gemfiles/activerecord_4.2.gemfile
|
15
|
-
- gemfiles/activerecord_edge.gemfile
|
16
|
-
|
17
|
-
env:
|
18
|
-
- DB=sqlite
|
19
|
-
- DB=mysql
|
20
|
-
- DB=postgresql
|
21
|
-
|
22
|
-
services:
|
23
|
-
- mysql
|
24
|
-
- postgresql
|
25
|
-
|
26
|
-
script: WITH_ADVISORY_LOCK_PREFIX=$TRAVIS_JOB_ID bundle exec rake --trace spec:all
|
27
|
-
|
28
|
-
matrix:
|
29
|
-
allow_failures:
|
30
|
-
- gemfile: gemfiles/activerecord_edge.gemfile
|
31
|
-
- gemfile: gemfiles/activerecord_6.0.gemfile
|
32
|
-
exclude:
|
33
|
-
- rvm: 2.5.5
|
34
|
-
gemfile: gemfiles/activerecord_edge.gemfile
|
35
|
-
- rvm: 2.7.1
|
36
|
-
gemfile: gemfiles/activerecord_4.2.gemfile
|