n1_loader 1.6.1 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +4 -3
- data/.github/workflows/tests.yml +6 -2
- data/CHANGELOG.md +8 -0
- data/README.md +9 -4
- data/lib/n1_loader/core/loader.rb +1 -1
- data/lib/n1_loader/version.rb +1 -1
- data/n1_loader.gemspec +1 -0
- metadata +3 -3
- data/.circleci/config.yml +0 -152
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c874b380de3baf4e2c0631f223261604ecb7108a4320797d746a73a90af01db5
|
4
|
+
data.tar.gz: c7e98c2c4b07afbb45081b9435f9b544126378f585a23dc7419f320764af0908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 071005e2ebc91c4884a2417d02162d795bea99813ea20b556d2b61f18d32e66ae3657f250af84ea67c32433c1d5c6697a2db9a20461d7ac0f73ff86e5b429d94
|
7
|
+
data.tar.gz: 001e24c4c00ffd207229dd2721baa4424ee90bd7591d9b3ea2092d823e5bec403f51ca80d6efad7b2ff8db3bc57bb955bd04705dd97f704fc64494dffe1f8321
|
@@ -1,10 +1,12 @@
|
|
1
1
|
name: Rubocop
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
4
|
+
pull_request:
|
5
|
+
schedule:
|
6
|
+
- cron: '0 0 * * 0'
|
5
7
|
|
6
8
|
jobs:
|
7
|
-
|
9
|
+
rubocop:
|
8
10
|
runs-on: ubuntu-latest
|
9
11
|
|
10
12
|
steps:
|
@@ -14,7 +16,6 @@ jobs:
|
|
14
16
|
uses: ruby/setup-ruby@v1
|
15
17
|
with:
|
16
18
|
ruby-version: 2.7
|
17
|
-
bundler-cache: true
|
18
19
|
|
19
20
|
- name: Install dependencies
|
20
21
|
run: bundle install
|
data/.github/workflows/tests.yml
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
name: RSpec tests
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
4
|
+
pull_request:
|
5
|
+
schedule:
|
6
|
+
- cron: '0 0 * * 0'
|
5
7
|
|
6
8
|
jobs:
|
7
9
|
tests:
|
@@ -36,6 +38,9 @@ jobs:
|
|
36
38
|
- activerecord-gemfile: 'ar_7_latest'
|
37
39
|
ar_lazy_preload-gemfile: 'ar_lazy_preload_0.6.1'
|
38
40
|
|
41
|
+
- activerecord-gemfile: 'ar_5_latest'
|
42
|
+
ar_lazy_preload-gemfile: 'ar_lazy_preload_master'
|
43
|
+
|
39
44
|
env:
|
40
45
|
ACTIVERECORD_GEMFILE: ${{ matrix.activerecord-gemfile }}
|
41
46
|
AR_LAZY_PRELOAD_GEMFILE: ${{ matrix.ar_lazy_preload-gemfile }}
|
@@ -47,7 +52,6 @@ jobs:
|
|
47
52
|
uses: ruby/setup-ruby@v1
|
48
53
|
with:
|
49
54
|
ruby-version: ${{ matrix.ruby-version }}
|
50
|
-
bundler-cache: true
|
51
55
|
|
52
56
|
- name: Install dependencies
|
53
57
|
run: bundle install
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [1.6.3] - 2022/12/30
|
2
|
+
|
3
|
+
- Performance optimization: avoid unnecessary calls. Thanks [Nazar Matus](https://github.com/FunkyloverOne) for the [contribution](https://github.com/djezzzl/n1_loader/pull/33).
|
4
|
+
|
5
|
+
## [1.6.2] - 2022/11/23
|
6
|
+
|
7
|
+
- Add fund metadata
|
8
|
+
|
1
9
|
## [1.6.1] - 2022/10/29
|
2
10
|
|
3
11
|
- Fix ArLazyPreload context setup when using isolated loaders for objects without the context.
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# N1Loader
|
2
2
|
|
3
|
-
[![CircleCI][1]][2]
|
4
3
|
[![Gem Version][3]][4]
|
4
|
+
[![][11]][12]
|
5
|
+
[![][13]][14]
|
5
6
|
[![][9]][10]
|
6
7
|
|
7
8
|
N1Loader is designed to provide a simple way for avoiding [N+1 issues][7] of any kind.
|
@@ -11,7 +12,8 @@ For example, it can help with resolving N+1 for:
|
|
11
12
|
- complex calculations
|
12
13
|
- and many more
|
13
14
|
|
14
|
-
>
|
15
|
+
> If the project helps you or your organization, I would be very grateful if you [contribute][15] or [donate][10].
|
16
|
+
> Your support is an incredible motivation and the biggest reward for my hard work.
|
15
17
|
|
16
18
|
___Support:___ ActiveRecord 5, 6, and 7.
|
17
19
|
|
@@ -253,8 +255,6 @@ Everyone interacting in the N1Loader project's codebases, issue trackers, chat r
|
|
253
255
|
|
254
256
|
Copyright (c) Evgeniy Demin. See [LICENSE.txt](LICENSE.txt) for further details.
|
255
257
|
|
256
|
-
[1]: https://circleci.com/gh/djezzzl/n1_loader/tree/master.svg?style=shield
|
257
|
-
[2]: https://circleci.com/gh/djezzzl/n1_loader/tree/master
|
258
258
|
[3]: https://badge.fury.io/rb/n1_loader.svg
|
259
259
|
[4]: https://badge.fury.io/rb/n1_loader
|
260
260
|
[5]: https://github.com/rails/rails/tree/main/activerecord
|
@@ -263,3 +263,8 @@ Copyright (c) Evgeniy Demin. See [LICENSE.txt](LICENSE.txt) for further details.
|
|
263
263
|
[8]: https://github.com/djezzzl/n1_loader
|
264
264
|
[9]: https://opencollective.com/n1_loader/tiers/badge.svg
|
265
265
|
[10]: https://opencollective.com/n1_loader#support
|
266
|
+
[11]: https://github.com/djezzzl/n1_loader/actions/workflows/tests.yml/badge.svg?branch=master
|
267
|
+
[12]: https://github.com/djezzzl/n1_loader/actions/workflows/tests.yml?query=event%3Aschedule
|
268
|
+
[13]: https://github.com/djezzzl/n1_loader/actions/workflows/rubocop.yml/badge.svg?branch=master
|
269
|
+
[14]: https://github.com/djezzzl/n1_loader/actions/workflows/rubocop.yml?query=event%3Aschedule
|
270
|
+
[15]: https://github.com/djezzzl/n1_loader#contributing
|
@@ -110,7 +110,7 @@ module N1Loader
|
|
110
110
|
|
111
111
|
@loaded = {}.compare_by_identity
|
112
112
|
|
113
|
-
if elements.size == 1
|
113
|
+
if respond_to?(:single) && elements.size == 1
|
114
114
|
fulfill(elements.first, single(elements.first))
|
115
115
|
elsif elements.any?
|
116
116
|
perform(elements)
|
data/lib/n1_loader/version.rb
CHANGED
data/n1_loader.gemspec
CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
spec.metadata["source_code_uri"] = "https://github.com/djezzzl/n1_loader"
|
18
18
|
spec.metadata["changelog_uri"] = "https://github.com/djezzzl/n1_loader/master/CHANGELOG.md"
|
19
|
+
spec.metadata["funding_uri"] = "https://opencollective.com/n1_loader#support"
|
19
20
|
|
20
21
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
22
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: n1_loader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeniy Demin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -143,7 +143,6 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
-
- ".circleci/config.yml"
|
147
146
|
- ".github/workflows/rubocop.yml"
|
148
147
|
- ".github/workflows/tests.yml"
|
149
148
|
- ".gitignore"
|
@@ -207,6 +206,7 @@ metadata:
|
|
207
206
|
homepage_uri: https://github.com/djezzzl/n1_loader
|
208
207
|
source_code_uri: https://github.com/djezzzl/n1_loader
|
209
208
|
changelog_uri: https://github.com/djezzzl/n1_loader/master/CHANGELOG.md
|
209
|
+
funding_uri: https://opencollective.com/n1_loader#support
|
210
210
|
post_install_message:
|
211
211
|
rdoc_options: []
|
212
212
|
require_paths:
|
data/.circleci/config.yml
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
version: 2.1
|
2
|
-
|
3
|
-
executors:
|
4
|
-
ruby:
|
5
|
-
description: The official CircleCI Ruby Docker image
|
6
|
-
parameters:
|
7
|
-
tag:
|
8
|
-
description: The circleci/ruby Docker image version tag
|
9
|
-
type: string
|
10
|
-
default: latest
|
11
|
-
docker:
|
12
|
-
- image: circleci/ruby:<< parameters.tag >>
|
13
|
-
environment:
|
14
|
-
BUNDLE_JOBS: 4
|
15
|
-
BUNDLE_RETRY: 3
|
16
|
-
working_directory: ~/n1_loader
|
17
|
-
|
18
|
-
jobs:
|
19
|
-
checkout:
|
20
|
-
executor: ruby
|
21
|
-
steps:
|
22
|
-
- checkout
|
23
|
-
- persist_to_workspace:
|
24
|
-
root: ~/n1_loader
|
25
|
-
paths:
|
26
|
-
- .
|
27
|
-
|
28
|
-
build:
|
29
|
-
parameters:
|
30
|
-
ruby-version:
|
31
|
-
type: string
|
32
|
-
activerecord-gemfile:
|
33
|
-
type: string
|
34
|
-
ar_lazy_preload-gemfile:
|
35
|
-
type: string
|
36
|
-
environment:
|
37
|
-
ACTIVERECORD_GEMFILE: << parameters.activerecord-gemfile >>
|
38
|
-
AR_LAZY_PRELOAD_GEMFILE: << parameters.ar_lazy_preload-gemfile >>
|
39
|
-
executor:
|
40
|
-
name: ruby
|
41
|
-
tag: << parameters.ruby-version >>
|
42
|
-
steps:
|
43
|
-
- attach_workspace:
|
44
|
-
at: ~/n1_loader
|
45
|
-
- run:
|
46
|
-
name: Install the gems specified by the Gemfile
|
47
|
-
command: bundle install
|
48
|
-
- run:
|
49
|
-
name: Run Core RSpec
|
50
|
-
command: |
|
51
|
-
bundle exec rspec --profile 10 \
|
52
|
-
--format RspecJunitFormatter \
|
53
|
-
--out test_results/core.xml \
|
54
|
-
--format progress \
|
55
|
-
spec/n1_loader_spec.rb
|
56
|
-
- run:
|
57
|
-
name: Run ActiveRecord integration RSpec
|
58
|
-
command: |
|
59
|
-
bundle exec rspec --profile 10 \
|
60
|
-
--format RspecJunitFormatter \
|
61
|
-
--out test_results/activerecord-integration.xml \
|
62
|
-
--format progress \
|
63
|
-
spec/n1_loader_spec.rb \
|
64
|
-
spec/activerecord_spec.rb
|
65
|
-
- run:
|
66
|
-
name: Run ActiveRecord integration RSpec
|
67
|
-
command: |
|
68
|
-
bundle exec rspec --profile 10 \
|
69
|
-
--format RspecJunitFormatter \
|
70
|
-
--out test_results/ar-lazy-preload-integration.xml \
|
71
|
-
--format progress \
|
72
|
-
spec/n1_loader_spec.rb \
|
73
|
-
spec/activerecord_spec.rb \
|
74
|
-
spec/ar_lazy_preload_spec.rb
|
75
|
-
- store_test_results:
|
76
|
-
path: test_results
|
77
|
-
|
78
|
-
rubocop:
|
79
|
-
executor:
|
80
|
-
name: ruby
|
81
|
-
tag: "2.5"
|
82
|
-
steps:
|
83
|
-
- attach_workspace:
|
84
|
-
at: ~/n1_loader
|
85
|
-
- run:
|
86
|
-
name: Install the gems specified by the Gemfile
|
87
|
-
command: bundle install
|
88
|
-
- run:
|
89
|
-
name: Lint Ruby code with RuboCop
|
90
|
-
command: bundle exec rubocop --parallel
|
91
|
-
|
92
|
-
workflows:
|
93
|
-
version: 2
|
94
|
-
default: &default
|
95
|
-
jobs:
|
96
|
-
- checkout
|
97
|
-
- build:
|
98
|
-
requires:
|
99
|
-
- checkout
|
100
|
-
matrix:
|
101
|
-
parameters:
|
102
|
-
ruby-version: [
|
103
|
-
"2.7",
|
104
|
-
"latest"
|
105
|
-
]
|
106
|
-
activerecord-gemfile: [
|
107
|
-
"ar_5_latest",
|
108
|
-
"ar_6_latest",
|
109
|
-
"ar_7_latest"
|
110
|
-
]
|
111
|
-
ar_lazy_preload-gemfile: [
|
112
|
-
"ar_lazy_preload_0.6.1",
|
113
|
-
"ar_lazy_preload_master"
|
114
|
-
]
|
115
|
-
exclude:
|
116
|
-
# AR 5 and ruby 3+
|
117
|
-
- ruby-version: "latest"
|
118
|
-
activerecord-gemfile: "ar_5_latest"
|
119
|
-
ar_lazy_preload-gemfile: "ar_lazy_preload_0.6.1"
|
120
|
-
|
121
|
-
- ruby-version: "latest"
|
122
|
-
activerecord-gemfile: "ar_5_latest"
|
123
|
-
ar_lazy_preload-gemfile: "ar_lazy_preload_master"
|
124
|
-
|
125
|
-
# AR 7 and ar_lazy_preload < 1
|
126
|
-
- ruby-version: "2.5"
|
127
|
-
activerecord-gemfile: "ar_7_latest"
|
128
|
-
ar_lazy_preload-gemfile: "ar_lazy_preload_0.6.1"
|
129
|
-
|
130
|
-
- ruby-version: "2.7"
|
131
|
-
activerecord-gemfile: "ar_7_latest"
|
132
|
-
ar_lazy_preload-gemfile: "ar_lazy_preload_0.6.1"
|
133
|
-
|
134
|
-
- ruby-version: "latest"
|
135
|
-
activerecord-gemfile: "ar_7_latest"
|
136
|
-
ar_lazy_preload-gemfile: "ar_lazy_preload_0.6.1"
|
137
|
-
|
138
|
-
|
139
|
-
name: ruby-<< matrix.ruby-version >>-<< matrix.activerecord-gemfile >>-<< matrix.ar_lazy_preload-gemfile >>
|
140
|
-
- rubocop:
|
141
|
-
requires:
|
142
|
-
- checkout
|
143
|
-
|
144
|
-
nightly:
|
145
|
-
triggers:
|
146
|
-
- schedule:
|
147
|
-
cron: "0 0 * * *"
|
148
|
-
filters:
|
149
|
-
branches:
|
150
|
-
only:
|
151
|
-
- master
|
152
|
-
<<: *default
|