eager_group 0.10.0 → 0.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3717871f8324a6ec0a0886745b12c17f7443398a8658bcb60ce008fa1e924df1
4
- data.tar.gz: 0eccab385f9d6ec341ace42258672f663b03598ee164ef22b1b25fb7bf17779a
3
+ metadata.gz: bedabe6da7cfa46fbfbdecf1d2cc63a40f2d820fc5e9c65557a84d1ab4078495
4
+ data.tar.gz: 1f3e1ce3e020df317036605a553a046f13f17cc614f9e30425676157904de6bb
5
5
  SHA512:
6
- metadata.gz: c1fb52a045e4f2005a78ef698ff915195e705a9729e1fb6a25275d2516c48e7f016d3249946d3a337b07b70a822f75c0ffe1f2acbb130c78a2d13df03107449b
7
- data.tar.gz: 0a7393ea354afaaf1c1002c7641c3a4bd94e26b2407eea9b6cb701da243b67733c34d226711650964251aaa2f5d117db0d0e418e5702ebb4b75f59323c3b6c49
6
+ metadata.gz: c591075a2549089e129caf73981483963cf93685485e7bd6903a6e6f692da0264405025187ddcf7ab4fe19f347be5fa0d132108b43c72c3156391a44d936c014
7
+ data.tar.gz: b10afd48502166c90dfe32abad7456dce45041a9e3b9412335696e849f5fa0ebe4af85d2e2489ed227e506de06b644b8f0dabd0789f3af42b7c09210689fd414
@@ -1,18 +1,39 @@
1
- name: test
1
+ name: CI
2
+
2
3
  on:
3
4
  push:
4
5
  branches:
5
6
  - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
6
11
  jobs:
7
12
  test:
8
- name: test
13
+ name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }}
9
14
  runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby:
19
+ - '3.2'
20
+ - '3.3'
21
+ - '3.4'
22
+ - '4.0'
23
+ gemfile:
24
+ - Gemfile.rails-7.0
25
+ - Gemfile.rails-7.1
26
+ - Gemfile.rails-7.2
27
+ - Gemfile.rails-8.0
28
+ - Gemfile.rails-8.1
29
+ env:
30
+ BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
10
31
  steps:
11
- - uses: actions/checkout@v2
12
- - name: Set up Ruby
13
- uses: ruby/setup-ruby@v1
14
- with:
15
- ruby-version: 3.1
16
- bundler-cache: true
17
- - name: Run tests
18
- run: bundle exec rspec
32
+ - uses: actions/checkout@v5
33
+ - name: Set up Ruby
34
+ uses: ruby/setup-ruby@v1
35
+ with:
36
+ ruby-version: ${{ matrix.ruby }}
37
+ bundler-cache: true
38
+ - name: Run tests
39
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
3
  /Gemfile.lock
4
+ /Gemfile.*.lock
4
5
  /_yardoc/
5
6
  /coverage/
6
7
  /doc/
@@ -9,3 +10,4 @@
9
10
  /tmp/
10
11
  .idea
11
12
  .tool-versions
13
+ .DS_Store
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Next Release
2
2
 
3
+ ## 0.11.0 (11/06/2026)
4
+
5
+ * Drop Ruby 3.1 and Rails 4.x, 5.x, 6.x support
6
+ * Support Ruby 3.2, 3.3, 3.4, 4.0 and Rails 7.x, 8.x
7
+ * Replace Travis CI with GitHub Actions
8
+
3
9
  ## 0.10.0 (12/28/2022)
4
10
 
5
11
  * Add STI support, use `class_attribute` to prevent subclasses affect each other
data/Gemfile.rails-7.0 ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'activerecord', '~> 7.0.0'
6
+ gem 'sqlite3', '~> 1.4'
data/Gemfile.rails-7.1 ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'activerecord', '~> 7.1.0'
6
+ gem 'sqlite3', '~> 1.4'
data/Gemfile.rails-7.2 ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'activerecord', '~> 7.2.0'
6
+ gem 'sqlite3'
data/Gemfile.rails-8.0 ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'activerecord', '~> 8.0.0'
6
+ gem 'sqlite3'
data/Gemfile.rails-8.1 ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'activerecord', '~> 8.1.0'
6
+ gem 'sqlite3'
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # EagerGroup
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/flyerhzm/eager_group.png)](http://travis-ci.org/flyerhzm/eager_group)
3
+ [![CI](https://github.com/flyerhzm/eager_group/actions/workflows/main.yml/badge.svg)](https://github.com/flyerhzm/eager_group/actions/workflows/main.yml)
4
4
  [![AwesomeCode Status for
5
5
  flyerhzm/eager_group](https://awesomecode.io/projects/e5386790-9420-4003-831a-c9a8c8a48108/status)](https://awesomecode.io/repos/flyerhzm/eager_group)
6
6
 
@@ -38,7 +38,7 @@ SELECT "posts".* FROM "posts";
38
38
  SELECT AVG("comments"."rating") AS average_comments_rating, post_id AS post_id FROM "comments" WHERE "comments"."post_id" IN (1, 2, 3) GROUP BY post_id;
39
39
  ```
40
40
 
41
- It supports Rails 4.x, Rails 5.x and Rails 6.x
41
+ It supports Ruby 3.2, 3.3, 3.4 and 4.0, and Rails 7.x and 8.x
42
42
 
43
43
  ## Installation
44
44
 
@@ -70,7 +70,7 @@ class Post < ActiveRecord::Base
70
70
  has_many :comments
71
71
 
72
72
  define_eager_group :comments_average_rating, :comments, :average, :rating
73
- define_eager_group :approved_comments_count, :comments, :count, :*, -> { approved }
73
+ define_eager_group :approved_comments_count, :comments, :count, :all, -> { approved }
74
74
  end
75
75
 
76
76
  class Comment < ActiveRecord::Base
@@ -90,7 +90,8 @@ result.
90
90
  `count`, `maximum`, `minimum`, `sum`, I define 2 additional aggregate
91
91
  function `first_object` and `last_object` to eager load first and last
92
92
  association objects.
93
- * `column_name`, aggregate column name, it can be `:*` for `count`
93
+ * `column_name`, aggregate column name, it can be `:all` (from rails 8) or
94
+ `:*` for `count`.
94
95
  * `scope`, scope is optional, it's used to filter data for aggregation.
95
96
 
96
97
  Then you can use `eager_group` to fix n+1 aggregate sql functions
data/eager_group.gemspec CHANGED
@@ -16,17 +16,20 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.license = 'MIT'
18
18
 
19
+ spec.required_ruby_version = '>= 3.2.0'
20
+
19
21
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
22
  spec.bindir = 'exe'
21
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
24
  spec.require_paths = ['lib']
23
25
 
24
- spec.add_development_dependency 'activerecord'
26
+ spec.add_dependency 'activerecord', '>= 7.0', '< 9.0'
27
+
25
28
  spec.add_development_dependency 'activerecord-import'
26
29
  spec.add_development_dependency 'activesupport'
27
30
  spec.add_development_dependency 'benchmark-ips'
28
31
  spec.add_development_dependency 'bundler'
29
- spec.add_development_dependency 'rake', '~> 10.0'
32
+ spec.add_development_dependency 'rake', '~> 13.0'
30
33
  spec.add_development_dependency 'rspec', '~> 3.3'
31
34
  spec.add_development_dependency 'sqlite3'
32
35
  spec.add_development_dependency 'pry'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EagerGroup
4
- VERSION = '0.10.0'
4
+ VERSION = '0.11.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eager_group
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2022-12-28 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activerecord
@@ -16,14 +15,20 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
18
+ version: '7.0'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '9.0'
22
+ type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
26
  - - ">="
25
27
  - !ruby/object:Gem::Version
26
- version: '0'
28
+ version: '7.0'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '9.0'
27
32
  - !ruby/object:Gem::Dependency
28
33
  name: activerecord-import
29
34
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +91,14 @@ dependencies:
86
91
  requirements:
87
92
  - - "~>"
88
93
  - !ruby/object:Gem::Version
89
- version: '10.0'
94
+ version: '13.0'
90
95
  type: :development
91
96
  prerelease: false
92
97
  version_requirements: !ruby/object:Gem::Requirement
93
98
  requirements:
94
99
  - - "~>"
95
100
  - !ruby/object:Gem::Version
96
- version: '10.0'
101
+ version: '13.0'
97
102
  - !ruby/object:Gem::Dependency
98
103
  name: rspec
99
104
  requirement: !ruby/object:Gem::Requirement
@@ -146,9 +151,13 @@ files:
146
151
  - ".github/workflows/main.yml"
147
152
  - ".gitignore"
148
153
  - ".rspec"
149
- - ".travis.yml"
150
154
  - CHANGELOG.md
151
155
  - Gemfile
156
+ - Gemfile.rails-7.0
157
+ - Gemfile.rails-7.1
158
+ - Gemfile.rails-7.2
159
+ - Gemfile.rails-8.0
160
+ - Gemfile.rails-8.1
152
161
  - MIT-LICENSE
153
162
  - README.md
154
163
  - Rakefile
@@ -170,7 +179,6 @@ homepage: https://github.com/flyerhzm/eager_group
170
179
  licenses:
171
180
  - MIT
172
181
  metadata: {}
173
- post_install_message:
174
182
  rdoc_options: []
175
183
  require_paths:
176
184
  - lib
@@ -178,15 +186,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
186
  requirements:
179
187
  - - ">="
180
188
  - !ruby/object:Gem::Version
181
- version: '0'
189
+ version: 3.2.0
182
190
  required_rubygems_version: !ruby/object:Gem::Requirement
183
191
  requirements:
184
192
  - - ">="
185
193
  - !ruby/object:Gem::Version
186
194
  version: '0'
187
195
  requirements: []
188
- rubygems_version: 3.4.1
189
- signing_key:
196
+ rubygems_version: 4.0.20
190
197
  specification_version: 4
191
198
  summary: Fix n+1 aggregate sql functions
192
199
  test_files: []
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.0
4
- env:
5
- - DB=sqlite
6
- script: bundle exec rspec spec