deep_preloader 1.0.2 → 1.1.1
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/gem-push.yml +31 -0
- data/.github/workflows/test.yml +50 -0
- data/gemfiles/activerecord_7_0.gemfile +8 -0
- data/lib/deep_preloader/polymorphic_spec.rb +6 -2
- data/lib/deep_preloader/spec.rb +8 -4
- data/lib/deep_preloader/version.rb +1 -1
- metadata +6 -4
- data/.circleci/config.yml +0 -103
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d624c81fa1de1077266d5b3da945c551e3a3d0756e1c5f1b55f67e868dde0df
|
4
|
+
data.tar.gz: 83d4214703de49d03770af58abf27f1e6963cac88594534dcbba1d6e47d4746a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f21d5b3c98a221ab90504d771a6e353deabe042a656679e11f8eb64699561eb433ba8da10700f4eec2131dd53a46c2875e5af7cece4c4e6e30e264e20c9f6a52
|
7
|
+
data.tar.gz: 4aefe1fb5e9eba21037730a2ccbab9de657b5bcc14c937687fb58f66729cb0c7ab411323d1b1ed0094811939d0fcd22f73250d340db7e8c1bc96e858a7fa6167
|
@@ -0,0 +1,31 @@
|
|
1
|
+
name: Publish Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ "master" ]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
name: Build + Publish
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
contents: read
|
13
|
+
packages: write
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
- name: Set up Ruby 2.7
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 2.7
|
21
|
+
|
22
|
+
- name: Publish to RubyGems
|
23
|
+
run: |
|
24
|
+
mkdir -p $HOME/.gem
|
25
|
+
touch $HOME/.gem/credentials
|
26
|
+
chmod 0600 $HOME/.gem/credentials
|
27
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
28
|
+
gem build *.gemspec
|
29
|
+
gem push *.gem
|
30
|
+
env:
|
31
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
@@ -0,0 +1,50 @@
|
|
1
|
+
name: Run Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches: "**"
|
6
|
+
|
7
|
+
permissions:
|
8
|
+
contents: read
|
9
|
+
checks: write
|
10
|
+
pull-requests: write
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
ruby-version: ['2.7', '3.1', '3.2']
|
20
|
+
include:
|
21
|
+
- ruby-version: '2.7'
|
22
|
+
bundle-gemfile: gemfiles/activerecord_5_2.gemfile
|
23
|
+
- ruby-version: '3.1'
|
24
|
+
bundle-gemfile: gemfiles/activerecord_6_1.gemfile
|
25
|
+
- ruby-version: '3.2'
|
26
|
+
bundle-gemfile: gemfiles/activerecord_7_0.gemfile
|
27
|
+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
28
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.bundle-gemfile }}
|
29
|
+
steps:
|
30
|
+
- uses: actions/checkout@v3
|
31
|
+
- name: Set up Ruby
|
32
|
+
uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: ${{ matrix.ruby-version }}
|
35
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
36
|
+
- name: Run tests
|
37
|
+
run: bundle exec rspec --profile 10 --format RspecJunitFormatter --out test_results/rspec.xml --format progress
|
38
|
+
- name: Upload result
|
39
|
+
uses: actions/upload-artifact@v3
|
40
|
+
if: always()
|
41
|
+
with:
|
42
|
+
name: rspec_${{ matrix.ruby-version }}.xml
|
43
|
+
path: test_results/rspec.xml
|
44
|
+
- name: Test Report
|
45
|
+
uses: dorny/test-reporter@v1
|
46
|
+
if: always()
|
47
|
+
with:
|
48
|
+
name: Rspec Tests - ${{ matrix.ruby-version }}
|
49
|
+
path: test_results/rspec.xml
|
50
|
+
reporter: java-junit
|
@@ -15,7 +15,7 @@ class DeepPreloader::PolymorphicSpec < DeepPreloader::AbstractSpec
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def initialize(specs_by_type = {})
|
18
|
-
@specs_by_type = specs_by_type
|
18
|
+
@specs_by_type = specs_by_type.transform_keys(&:to_s)
|
19
19
|
end
|
20
20
|
|
21
21
|
def polymorphic?
|
@@ -35,7 +35,7 @@ class DeepPreloader::PolymorphicSpec < DeepPreloader::AbstractSpec
|
|
35
35
|
if specs_by_type[k]
|
36
36
|
specs_by_type[k].merge!(v)
|
37
37
|
else
|
38
|
-
specs_by_type[k] = v
|
38
|
+
specs_by_type[k] = v.deep_dup
|
39
39
|
end
|
40
40
|
end
|
41
41
|
else
|
@@ -54,6 +54,10 @@ class DeepPreloader::PolymorphicSpec < DeepPreloader::AbstractSpec
|
|
54
54
|
|
55
55
|
alias eql? ==
|
56
56
|
|
57
|
+
def deep_dup
|
58
|
+
self.class.new(specs_by_type.deep_dup)
|
59
|
+
end
|
60
|
+
|
57
61
|
def inspect
|
58
62
|
"PolySpec#{specs_by_type.inspect}"
|
59
63
|
end
|
data/lib/deep_preloader/spec.rb
CHANGED
@@ -11,11 +11,11 @@ class DeepPreloader::Spec < DeepPreloader::AbstractSpec
|
|
11
11
|
end
|
12
12
|
when Hash
|
13
13
|
assoc_specs = data.each_with_object({}) do |(k, v), h|
|
14
|
-
h[k.
|
14
|
+
h[k.to_s] = parse(v)
|
15
15
|
end
|
16
16
|
self.new(assoc_specs)
|
17
17
|
when String, Symbol
|
18
|
-
self.new({ data.
|
18
|
+
self.new({ data.to_s => nil })
|
19
19
|
when DeepPreloader::AbstractSpec
|
20
20
|
data
|
21
21
|
when nil
|
@@ -26,7 +26,7 @@ class DeepPreloader::Spec < DeepPreloader::AbstractSpec
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def initialize(association_specs = {})
|
29
|
-
@association_specs = association_specs
|
29
|
+
@association_specs = association_specs.transform_keys(&:to_s)
|
30
30
|
end
|
31
31
|
|
32
32
|
def merge!(other)
|
@@ -38,7 +38,7 @@ class DeepPreloader::Spec < DeepPreloader::AbstractSpec
|
|
38
38
|
if association_specs[k]
|
39
39
|
association_specs[k].merge!(v)
|
40
40
|
else
|
41
|
-
association_specs[k] = v
|
41
|
+
association_specs[k] = v.deep_dup
|
42
42
|
end
|
43
43
|
end
|
44
44
|
else
|
@@ -57,6 +57,10 @@ class DeepPreloader::Spec < DeepPreloader::AbstractSpec
|
|
57
57
|
|
58
58
|
alias eql? ==
|
59
59
|
|
60
|
+
def deep_dup
|
61
|
+
self.class.new(association_specs.deep_dup)
|
62
|
+
end
|
63
|
+
|
60
64
|
def inspect
|
61
65
|
"Spec#{association_specs.inspect}"
|
62
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deep_preloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iKnow Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -171,7 +171,8 @@ executables: []
|
|
171
171
|
extensions: []
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
|
-
- ".
|
174
|
+
- ".github/workflows/gem-push.yml"
|
175
|
+
- ".github/workflows/test.yml"
|
175
176
|
- ".gitignore"
|
176
177
|
- ".rspec"
|
177
178
|
- ".travis.yml"
|
@@ -185,6 +186,7 @@ files:
|
|
185
186
|
- deep_preloader.gemspec
|
186
187
|
- gemfiles/activerecord_5_2.gemfile
|
187
188
|
- gemfiles/activerecord_6_1.gemfile
|
189
|
+
- gemfiles/activerecord_7_0.gemfile
|
188
190
|
- lib/deep_preloader.rb
|
189
191
|
- lib/deep_preloader/abstract_spec.rb
|
190
192
|
- lib/deep_preloader/polymorphic_spec.rb
|
@@ -211,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
213
|
- !ruby/object:Gem::Version
|
212
214
|
version: '0'
|
213
215
|
requirements: []
|
214
|
-
rubygems_version: 3.
|
216
|
+
rubygems_version: 3.1.6
|
215
217
|
signing_key:
|
216
218
|
specification_version: 4
|
217
219
|
summary: Explicit preloader for ActiveRecord
|
data/.circleci/config.yml
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
version: 2.1
|
2
|
-
|
3
|
-
executors:
|
4
|
-
ruby:
|
5
|
-
parameters:
|
6
|
-
ruby-version:
|
7
|
-
type: string
|
8
|
-
default: "2.6"
|
9
|
-
gemfile:
|
10
|
-
type: string
|
11
|
-
default: "Gemfile"
|
12
|
-
docker:
|
13
|
-
- image: circleci/ruby:<< parameters.ruby-version >>
|
14
|
-
environment:
|
15
|
-
BUNDLE_JOBS: 3
|
16
|
-
BUNDLE_RETRY: 3
|
17
|
-
BUNDLE_PATH: vendor/bundle
|
18
|
-
RAILS_ENV: test
|
19
|
-
BUNDLE_GEMFILE: << parameters.gemfile >>
|
20
|
-
|
21
|
-
jobs:
|
22
|
-
test:
|
23
|
-
parameters:
|
24
|
-
ruby-version:
|
25
|
-
type: string
|
26
|
-
gemfile:
|
27
|
-
type: string
|
28
|
-
executor:
|
29
|
-
name: ruby
|
30
|
-
ruby-version: << parameters.ruby-version >>
|
31
|
-
gemfile: << parameters.gemfile >>
|
32
|
-
parallelism: 1
|
33
|
-
steps:
|
34
|
-
- checkout
|
35
|
-
|
36
|
-
- run:
|
37
|
-
# Remove the non-appraisal gemfile for safety: we never want to use it.
|
38
|
-
name: Prepare bundler
|
39
|
-
command: bundle -v
|
40
|
-
|
41
|
-
- run:
|
42
|
-
name: Compute a gemfile lock
|
43
|
-
command: bundle lock && cp "${BUNDLE_GEMFILE}.lock" /tmp/gem-lock
|
44
|
-
|
45
|
-
- restore_cache:
|
46
|
-
keys:
|
47
|
-
- deep_preloader-<< parameters.ruby-version >>-{{ checksum "/tmp/gem-lock" }}
|
48
|
-
- deep_preloader-
|
49
|
-
|
50
|
-
- run:
|
51
|
-
name: Bundle Install
|
52
|
-
command: bundle check || bundle install
|
53
|
-
|
54
|
-
- save_cache:
|
55
|
-
key: deep_preloader-<< parameters.ruby-version >>-{{ checksum "/tmp/gem-lock" }}
|
56
|
-
paths:
|
57
|
-
- vendor/bundle
|
58
|
-
|
59
|
-
- run:
|
60
|
-
name: Run rspec
|
61
|
-
command: bundle exec rspec --profile 10 --format RspecJunitFormatter --out test_results/rspec.xml --format progress
|
62
|
-
|
63
|
-
- store_test_results:
|
64
|
-
path: test_results
|
65
|
-
|
66
|
-
publish:
|
67
|
-
executor: ruby
|
68
|
-
steps:
|
69
|
-
- checkout
|
70
|
-
- run:
|
71
|
-
name: Setup Rubygems
|
72
|
-
command: |
|
73
|
-
mkdir ~/.gem &&
|
74
|
-
echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials &&
|
75
|
-
chmod 0600 ~/.gem/credentials
|
76
|
-
- run:
|
77
|
-
name: Publish to Rubygems
|
78
|
-
command: |
|
79
|
-
gem build deep_preloader.gemspec
|
80
|
-
gem push deep_preloader-*.gem
|
81
|
-
|
82
|
-
workflows:
|
83
|
-
version: 2.1
|
84
|
-
build:
|
85
|
-
jobs:
|
86
|
-
- test:
|
87
|
-
name: 'ruby 2.6 ActiveRecord 5.2'
|
88
|
-
ruby-version: "2.6"
|
89
|
-
gemfile: gemfiles/activerecord_5_2.gemfile
|
90
|
-
- test:
|
91
|
-
name: 'ruby 2.7 ActiveRecord 5.2'
|
92
|
-
ruby-version: "2.7"
|
93
|
-
gemfile: gemfiles/activerecord_5_2.gemfile
|
94
|
-
- test:
|
95
|
-
name: 'ruby 3.0 ActiveRecord 6.1'
|
96
|
-
ruby-version: "3.0"
|
97
|
-
gemfile: gemfiles/activerecord_6_1.gemfile
|
98
|
-
- publish:
|
99
|
-
filters:
|
100
|
-
branches:
|
101
|
-
only: master
|
102
|
-
tags:
|
103
|
-
ignore: /.*/
|