ams_lazy_relationships 0.1.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +4 -5
- data/Appraisals +12 -0
- data/CHANGELOG.md +69 -1
- data/Gemfile.lock +19 -15
- data/README.md +87 -4
- data/RELEASE.md +13 -0
- data/Rakefile +2 -1
- data/ams_lazy_relationships.gemspec +8 -4
- data/gemfiles/ams_0.10.0.gemfile +7 -0
- data/gemfiles/ams_0.10.10.gemfile +7 -0
- data/gemfiles/ams_0.10.3.gemfile +7 -0
- data/lib/ams_lazy_relationships.rb +4 -0
- data/lib/ams_lazy_relationships/core.rb +3 -1
- data/lib/ams_lazy_relationships/core/evaluation.rb +41 -6
- data/lib/ams_lazy_relationships/core/lazy_dig_method.rb +91 -0
- data/lib/ams_lazy_relationships/core/lazy_relationship_meta.rb +0 -12
- data/lib/ams_lazy_relationships/core/lazy_relationship_method.rb +1 -1
- data/lib/ams_lazy_relationships/core/relationship_wrapper_methods.rb +14 -9
- data/lib/ams_lazy_relationships/extensions.rb +8 -0
- data/lib/ams_lazy_relationships/extensions/reflection.rb +71 -0
- data/lib/ams_lazy_relationships/loaders/association.rb +26 -22
- data/lib/ams_lazy_relationships/loaders/base.rb +48 -0
- data/lib/ams_lazy_relationships/loaders/direct.rb +15 -21
- data/lib/ams_lazy_relationships/loaders/simple_belongs_to.rb +7 -17
- data/lib/ams_lazy_relationships/loaders/simple_has_many.rb +11 -18
- data/lib/ams_lazy_relationships/version.rb +1 -1
- metadata +47 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3c8c81edbcbae5aed5aea521529d0bfbbe793739c9095a971c76799b976d9010
|
4
|
+
data.tar.gz: ad23f2121d43eb103bb770bc9b8ca2b9992839d7fe455e84f6cb5ebdedcf77f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b94d1e5828e237ba98a12f9781ae81abf40acbb1c5438932f18a601ea87c96288c3ec8c29d220d3812c0ca90898a0a24707599ab088e5b9f02e6e4b3fa11f4b
|
7
|
+
data.tar.gz: a51c03a759b3b9d7062714d32c26af33e2c58ed6d28ad0e219b9d0a641c741f10abec39c9d6256efde46e8ef97e808bbb28df4e28c4efaf629554b363eab10d1
|
data/.travis.yml
CHANGED
@@ -6,20 +6,19 @@ env:
|
|
6
6
|
language: ruby
|
7
7
|
gemfile:
|
8
8
|
- gemfiles/ams_0.10.0.rc4.gemfile
|
9
|
+
- gemfiles/ams_0.10.0.gemfile
|
9
10
|
- gemfiles/ams_0.10.2.gemfile
|
11
|
+
- gemfiles/ams_0.10.3.gemfile
|
10
12
|
- gemfiles/ams_0.10.8.gemfile
|
13
|
+
- gemfiles/ams_0.10.10.gemfile
|
11
14
|
cache: bundler
|
12
15
|
rvm:
|
13
|
-
- 2.3
|
14
|
-
before_install:
|
15
|
-
- gem install bundler:1.17 undercover --no-doc
|
16
|
+
- 2.5.3
|
16
17
|
before_script:
|
17
18
|
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
18
19
|
- chmod +x ./cc-test-reporter
|
19
20
|
- ./cc-test-reporter before-build
|
20
21
|
script:
|
21
22
|
- bundle exec rake
|
22
|
-
- git pull origin master:master
|
23
|
-
- undercover --compare master
|
24
23
|
after_script:
|
25
24
|
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/Appraisals
CHANGED
@@ -2,10 +2,22 @@ appraise "ams-0.10.0.rc4" do
|
|
2
2
|
gem "active_model_serializers", "0.10.0.rc4"
|
3
3
|
end
|
4
4
|
|
5
|
+
appraise "ams-0.10.0" do
|
6
|
+
gem "active_model_serializers", "0.10.0"
|
7
|
+
end
|
8
|
+
|
5
9
|
appraise "ams-0.10.2" do
|
6
10
|
gem "active_model_serializers", "0.10.2"
|
7
11
|
end
|
8
12
|
|
13
|
+
appraise "ams-0.10.3" do
|
14
|
+
gem "active_model_serializers", "0.10.3"
|
15
|
+
end
|
16
|
+
|
9
17
|
appraise "ams-0.10.8" do
|
10
18
|
gem "active_model_serializers", "0.10.8"
|
11
19
|
end
|
20
|
+
|
21
|
+
appraise "ams-0.10.10" do
|
22
|
+
gem "active_model_serializers", "0.10.10"
|
23
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,73 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v0.3.1](https://github.com/Bajena/ams_lazy_relationships/tree/v0.3.1) (2021-04-14)
|
4
|
+
[Full Changelog](https://github.com/Bajena/ams_lazy_relationships/compare/v0.3.0...v0.3.1)
|
5
|
+
|
6
|
+
**Closed issues:**
|
7
|
+
|
8
|
+
- NameError: uninitialized constant ActiveModel::Serializer::Reflection [\#59](https://github.com/Bajena/ams_lazy_relationships/issues/59)
|
9
|
+
|
10
|
+
**Merged pull requests:**
|
11
|
+
|
12
|
+
- Lock minimum AMS version to 0.10.0.rc4 [\#60](https://github.com/Bajena/ams_lazy_relationships/pull/60) ([Bajena](https://github.com/Bajena))
|
13
|
+
|
14
|
+
## [v0.3.0](https://github.com/Bajena/ams_lazy_relationships/tree/v0.3.0) (2020-01-16)
|
15
|
+
[Full Changelog](https://github.com/Bajena/ams_lazy_relationships/compare/v0.2.0...v0.3.0)
|
16
|
+
|
17
|
+
**Merged pull requests:**
|
18
|
+
|
19
|
+
- Fix association duplicates after accepts\_nested\_attributes\_for assignation [\#50](https://github.com/Bajena/ams_lazy_relationships/pull/50) ([stokarenko](https://github.com/stokarenko))
|
20
|
+
- Skip active\_support as redundant dependency [\#49](https://github.com/Bajena/ams_lazy_relationships/pull/49) ([stokarenko](https://github.com/stokarenko))
|
21
|
+
- Test against AMS v0.10.0.rc4 [\#48](https://github.com/Bajena/ams_lazy_relationships/pull/48) ([stokarenko](https://github.com/stokarenko))
|
22
|
+
- Skip redundant queries when include\_data is disabled [\#47](https://github.com/Bajena/ams_lazy_relationships/pull/47) ([stokarenko](https://github.com/stokarenko))
|
23
|
+
- Adjust tested ams version [\#46](https://github.com/Bajena/ams_lazy_relationships/pull/46) ([stokarenko](https://github.com/stokarenko))
|
24
|
+
- Fix documentation for blocked relationships [\#45](https://github.com/Bajena/ams_lazy_relationships/pull/45) ([stokarenko](https://github.com/stokarenko))
|
25
|
+
|
26
|
+
## [v0.2.0](https://github.com/Bajena/ams_lazy_relationships/tree/v0.2.0) (2020-01-11)
|
27
|
+
[Full Changelog](https://github.com/Bajena/ams_lazy_relationships/compare/v0.1.5...v0.2.0)
|
28
|
+
|
29
|
+
**Merged pull requests:**
|
30
|
+
|
31
|
+
- Lazy dig [\#44](https://github.com/Bajena/ams_lazy_relationships/pull/44) ([stokarenko](https://github.com/stokarenko))
|
32
|
+
|
33
|
+
## [v0.1.5](https://github.com/Bajena/ams_lazy_relationships/tree/v0.1.5) (2020-01-08)
|
34
|
+
[Full Changelog](https://github.com/Bajena/ams_lazy_relationships/compare/v0.1.4...v0.1.5)
|
35
|
+
|
36
|
+
**Closed issues:**
|
37
|
+
|
38
|
+
- Extract a base class for the loaders [\#39](https://github.com/Bajena/ams_lazy_relationships/issues/39)
|
39
|
+
- "Association" loader loads unnecessary records on AR 5.2.3+ [\#37](https://github.com/Bajena/ams_lazy_relationships/issues/37)
|
40
|
+
- undefined method `load\_all\_lazy\_relationships' for nil:NilClass [\#30](https://github.com/Bajena/ams_lazy_relationships/issues/30)
|
41
|
+
- Convert loaders to use strings instead of records as main keys [\#24](https://github.com/Bajena/ams_lazy_relationships/issues/24)
|
42
|
+
|
43
|
+
**Merged pull requests:**
|
44
|
+
|
45
|
+
- Improve tests for nested serializer lookup [\#43](https://github.com/Bajena/ams_lazy_relationships/pull/43) ([stokarenko](https://github.com/stokarenko))
|
46
|
+
- Extract a base class for lazy loaders [\#40](https://github.com/Bajena/ams_lazy_relationships/pull/40) ([Bajena](https://github.com/Bajena))
|
47
|
+
- Filter out preloaded records in `Association` preloader [\#36](https://github.com/Bajena/ams_lazy_relationships/pull/36) ([Bajena](https://github.com/Bajena))
|
48
|
+
- Synchronize lazy relationships [\#35](https://github.com/Bajena/ams_lazy_relationships/pull/35) ([stokarenko](https://github.com/stokarenko))
|
49
|
+
- Fix nested serializer lookup [\#34](https://github.com/Bajena/ams_lazy_relationships/pull/34) ([stokarenko](https://github.com/stokarenko))
|
50
|
+
- Fix batch loader dependency [\#33](https://github.com/Bajena/ams_lazy_relationships/pull/33) ([stokarenko](https://github.com/stokarenko))
|
51
|
+
- Bump rack from 2.0.6 to 2.0.8 [\#32](https://github.com/Bajena/ams_lazy_relationships/pull/32) ([dependabot[bot]](https://github.com/apps/dependabot))
|
52
|
+
- Bump loofah from 2.2.3 to 2.3.1 [\#31](https://github.com/Bajena/ams_lazy_relationships/pull/31) ([dependabot[bot]](https://github.com/apps/dependabot))
|
53
|
+
|
54
|
+
## [v0.1.4](https://github.com/Bajena/ams_lazy_relationships/tree/v0.1.4) (2019-06-02)
|
55
|
+
[Full Changelog](https://github.com/Bajena/ams_lazy_relationships/compare/v0.1.3...v0.1.4)
|
56
|
+
|
57
|
+
**Closed issues:**
|
58
|
+
|
59
|
+
- Use replace\_methods: false by default in loaders [\#28](https://github.com/Bajena/ams_lazy_relationships/issues/28)
|
60
|
+
- Require less restrictive batch-loader version [\#25](https://github.com/Bajena/ams_lazy_relationships/issues/25)
|
61
|
+
- Profile time and memory usage [\#21](https://github.com/Bajena/ams_lazy_relationships/issues/21)
|
62
|
+
- Loading circular relationships [\#20](https://github.com/Bajena/ams_lazy_relationships/issues/20)
|
63
|
+
- Add railtie [\#19](https://github.com/Bajena/ams_lazy_relationships/issues/19)
|
64
|
+
|
65
|
+
**Merged pull requests:**
|
66
|
+
|
67
|
+
- Use replace\_methods: false in batch loaders [\#29](https://github.com/Bajena/ams_lazy_relationships/pull/29) ([Bajena](https://github.com/Bajena))
|
68
|
+
- Add benchmark for speed & memory usage [\#27](https://github.com/Bajena/ams_lazy_relationships/pull/27) ([Bajena](https://github.com/Bajena))
|
69
|
+
- Require less restrictive batch loader version [\#26](https://github.com/Bajena/ams_lazy_relationships/pull/26) ([Bajena](https://github.com/Bajena))
|
70
|
+
|
3
71
|
## [v0.1.3](https://github.com/Bajena/ams_lazy_relationships/tree/v0.1.3) (2019-05-19)
|
4
72
|
[Full Changelog](https://github.com/Bajena/ams_lazy_relationships/compare/0.1.2...v0.1.3)
|
5
73
|
|
@@ -53,4 +121,4 @@
|
|
53
121
|
|
54
122
|
|
55
123
|
|
56
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
124
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ams_lazy_relationships (0.1
|
5
|
-
active_model_serializers
|
6
|
-
batch-loader (~> 1
|
4
|
+
ams_lazy_relationships (0.3.1)
|
5
|
+
active_model_serializers (>= 0.10.0.rc4)
|
6
|
+
batch-loader (~> 1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -21,9 +21,9 @@ GEM
|
|
21
21
|
erubi (~> 1.4)
|
22
22
|
rails-dom-testing (~> 2.0)
|
23
23
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
24
|
-
active_model_serializers (0.10.
|
25
|
-
actionpack (>= 4.1, < 6)
|
26
|
-
activemodel (>= 4.1, < 6)
|
24
|
+
active_model_serializers (0.10.12)
|
25
|
+
actionpack (>= 4.1, < 6.2)
|
26
|
+
activemodel (>= 4.1, < 6.2)
|
27
27
|
case_transform (>= 0.2)
|
28
28
|
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
29
29
|
activemodel (5.2.2)
|
@@ -45,13 +45,15 @@ GEM
|
|
45
45
|
thor (>= 0.14.0)
|
46
46
|
arel (9.0.0)
|
47
47
|
ast (2.4.0)
|
48
|
-
batch-loader (1.
|
48
|
+
batch-loader (1.5.0)
|
49
|
+
benchmark-memory (0.1.2)
|
50
|
+
memory_profiler (~> 0.9)
|
49
51
|
builder (3.2.3)
|
50
52
|
case_transform (0.2)
|
51
53
|
activesupport
|
52
54
|
coderay (1.1.2)
|
53
55
|
concurrent-ruby (1.1.4)
|
54
|
-
crass (1.0.
|
56
|
+
crass (1.0.5)
|
55
57
|
db-query-matchers (0.9.0)
|
56
58
|
activesupport (>= 4.0, <= 6.0)
|
57
59
|
rspec (~> 3.0)
|
@@ -76,16 +78,17 @@ GEM
|
|
76
78
|
parser (>= 2.5, != 2.5.1.1)
|
77
79
|
jaro_winkler (1.5.2)
|
78
80
|
json (2.1.0)
|
79
|
-
jsonapi-renderer (0.2.
|
80
|
-
loofah (2.
|
81
|
+
jsonapi-renderer (0.2.2)
|
82
|
+
loofah (2.3.1)
|
81
83
|
crass (~> 1.0.2)
|
82
84
|
nokogiri (>= 1.5.9)
|
85
|
+
memory_profiler (0.9.13)
|
83
86
|
method_source (0.8.2)
|
84
87
|
mini_portile2 (2.4.0)
|
85
88
|
minitest (5.11.3)
|
86
89
|
multi_json (1.13.1)
|
87
90
|
multipart-post (2.0.0)
|
88
|
-
nokogiri (1.10.
|
91
|
+
nokogiri (1.10.5)
|
89
92
|
mini_portile2 (~> 2.4.0)
|
90
93
|
octokit (4.13.0)
|
91
94
|
sawyer (~> 0.8.0, >= 0.5.3)
|
@@ -100,7 +103,7 @@ GEM
|
|
100
103
|
pry-nav (0.2.4)
|
101
104
|
pry (>= 0.9.10, < 0.11.0)
|
102
105
|
public_suffix (3.0.3)
|
103
|
-
rack (2.0.
|
106
|
+
rack (2.0.8)
|
104
107
|
rack-test (1.1.0)
|
105
108
|
rack (>= 1.0, < 3)
|
106
109
|
rails-dom-testing (2.0.3)
|
@@ -181,7 +184,7 @@ DEPENDENCIES
|
|
181
184
|
activerecord
|
182
185
|
ams_lazy_relationships!
|
183
186
|
appraisal
|
184
|
-
|
187
|
+
benchmark-memory (~> 0.1)
|
185
188
|
db-query-matchers
|
186
189
|
github_changelog_generator
|
187
190
|
pry
|
@@ -193,9 +196,10 @@ DEPENDENCIES
|
|
193
196
|
rubocop-rspec (= 1.20.1)
|
194
197
|
simplecov
|
195
198
|
simplecov-lcov
|
196
|
-
sqlite3
|
199
|
+
sqlite3
|
200
|
+
thread_safe
|
197
201
|
undercover
|
198
202
|
with_model (~> 2.0)
|
199
203
|
|
200
204
|
BUNDLED WITH
|
201
|
-
|
205
|
+
2.2.15
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Build Status](https://travis-ci.
|
1
|
+
[![Build Status](https://travis-ci.com/Bajena/ams_lazy_relationships.svg?branch=master)](https://travis-ci.com/Bajena/ams_lazy_relationships)
|
2
2
|
[![Maintainability](https://api.codeclimate.com/v1/badges/c21b988e09db63396309/maintainability)](https://codeclimate.com/github/Bajena/ams_lazy_relationships/maintainability)
|
3
3
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/c21b988e09db63396309/test_coverage)](https://codeclimate.com/github/Bajena/ams_lazy_relationships/test_coverage)
|
4
4
|
|
@@ -63,8 +63,10 @@ class UserSerializer < BaseSerializer
|
|
63
63
|
|
64
64
|
# The previous one is a shorthand for the following lines:
|
65
65
|
lazy_relationship :blog_posts, loader: AmsLazyRelationships::Loaders::Association.new("User", :blog_posts)
|
66
|
-
has_many :blog_posts, serializer: BlogPostSerializer do
|
67
|
-
|
66
|
+
has_many :blog_posts, serializer: BlogPostSerializer do |serializer|
|
67
|
+
# non-proc custom finder will work as well, but it can produce redundant sql
|
68
|
+
# queries, please see [Example 2: Modifying the relationship before rendering](#example-2-modifying-the-relationship-before-rendering)
|
69
|
+
-> { serializer.lazy_blog_posts }
|
68
70
|
end
|
69
71
|
|
70
72
|
lazy_has_one :poro_model, loader: AmsLazyRelationships::Loaders::Direct.new(:poro_model) { |object| PoroModel.new(object) }
|
@@ -116,10 +118,43 @@ end
|
|
116
118
|
#### Example 2: Modifying the relationship before rendering
|
117
119
|
Sometimes it may happen that you need to process the relationship before rendering, e.g. decorate the records. In this case the gem provides a special method (in our case `lazy_comments`) for each defined relationship. Check out the example - we'll decorate every comment before serializing:
|
118
120
|
|
121
|
+
```ruby
|
122
|
+
class BlogPostSerializer < BaseSerializer
|
123
|
+
lazy_has_many :comments do |serializer|
|
124
|
+
-> { serializer.lazy_comments.map(&:decorate) }
|
125
|
+
end
|
126
|
+
end
|
127
|
+
```
|
128
|
+
|
129
|
+
Despite the fact that non-block custom finder such as
|
130
|
+
|
131
|
+
```ruby
|
132
|
+
class BlogPostSerializer < BaseSerializer
|
133
|
+
lazy_has_many :comments do |serializer|
|
134
|
+
serializer.lazy_comments.map(&:decorate)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
```
|
138
|
+
|
139
|
+
will work still, it's better to implement it in a form of lambda, in order to avoid redundant SQL queries when `include_data` AMS setting appears to be `false`:
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
class BlogPostSerializer < BaseSerializer
|
143
|
+
lazy_has_many :comments do |serializer|
|
144
|
+
include_data :if_sideloaded
|
145
|
+
-> { serializer.lazy_comments.map(&:decorate) }
|
146
|
+
end
|
147
|
+
end
|
148
|
+
```
|
149
|
+
|
150
|
+
Feel free to skip custom lazy finder for association if your goal is just to define `include_data` setting and/or to specify some links and metas:
|
151
|
+
|
119
152
|
```ruby
|
120
153
|
class BlogPostSerializer < BaseSerializer
|
121
154
|
lazy_has_many :comments do
|
122
|
-
|
155
|
+
include_data :if_sideloaded
|
156
|
+
link :self, 'a link'
|
157
|
+
meta name: 'Dan Brown'
|
123
158
|
end
|
124
159
|
end
|
125
160
|
```
|
@@ -163,6 +198,54 @@ class BlogPostSerializer < BaseSerializer
|
|
163
198
|
end
|
164
199
|
```
|
165
200
|
|
201
|
+
#### Example 6: Lazy dig through relationships
|
202
|
+
In additional to previous example you may want to make use of nested lazy relationship without rendering of any nested record.
|
203
|
+
There is an `lazy_dig` method to be used for that:
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
class AuthorSerializer < BaseSerializer
|
207
|
+
lazy_relationship :address
|
208
|
+
end
|
209
|
+
|
210
|
+
class BlogPostSerializer < BaseSerializer
|
211
|
+
lazy_relationship :author
|
212
|
+
|
213
|
+
attribute :author_address do
|
214
|
+
lazy_dig(:author, :address)&.full_address
|
215
|
+
end
|
216
|
+
end
|
217
|
+
```
|
218
|
+
|
219
|
+
## Performance comparison with vanilla AMS
|
220
|
+
|
221
|
+
In general the bigger and more complex your serialized records hierarchy is and the more latency you have in your DB the more you'll benefit from using this gem.
|
222
|
+
Example results for average size records tree (10 blog posts -> 10 comments each -> 1 user per comment, performed on local in-memory SQLite DB) are:
|
223
|
+
|
224
|
+
### Time:
|
225
|
+
|
226
|
+
```bash
|
227
|
+
# With lazy relationships: 0.860000 0.010000 0.870000 ( 0.870297)
|
228
|
+
# Vanilla AMS: 1.050000 0.000000 1.050000 ( 1.059801)
|
229
|
+
```
|
230
|
+
|
231
|
+
This means your serializers should get **~13%** speed boost by introducing lazy relationships.
|
232
|
+
|
233
|
+
### Memory:
|
234
|
+
|
235
|
+
```bash
|
236
|
+
# With lazy relationships:
|
237
|
+
# 46.283M memsize ( 0.000 retained)
|
238
|
+
# 506.696k objects ( 0.000 retained)
|
239
|
+
# 50.000 strings ( 0.000 retained)
|
240
|
+
# Vanilla AMS: 42.738M memsize ( 0.000 retained)
|
241
|
+
# 545.266k objects ( 0.000 retained)
|
242
|
+
# 50.000 strings ( 0.000 retained)
|
243
|
+
```
|
244
|
+
|
245
|
+
This means that serialization may consume **~5%** more memory.
|
246
|
+
|
247
|
+
Detailed benchmark script & results can be found [here](/spec/benchmark_spec.rb).
|
248
|
+
|
166
249
|
## Development
|
167
250
|
|
168
251
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/RELEASE.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Release steps
|
2
|
+
1. Bump VERSION constant
|
3
|
+
2. Generate changelog and update
|
4
|
+
```shell
|
5
|
+
CHANGELOG_GITHUB_TOKEN=<token> bundle exec rake changelog
|
6
|
+
```
|
7
|
+
3. Run `bundle` to regenerate Gemfile.lock
|
8
|
+
4. Commit & push a new tag
|
9
|
+
5. Build and push to rubygems
|
10
|
+
```shell
|
11
|
+
gem build ams_lazy_relationships
|
12
|
+
gem push ams_lazy_relationships-x.y.z.gem
|
13
|
+
```
|
data/Rakefile
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "bundler/gem_tasks"
|
4
4
|
require "rspec/core/rake_task"
|
5
5
|
require "github_changelog_generator/task"
|
6
|
+
require "ams_lazy_relationships/version"
|
6
7
|
|
7
8
|
RSpec::Core::RakeTask.new(:spec)
|
8
9
|
|
@@ -11,5 +12,5 @@ task default: :spec
|
|
11
12
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
12
13
|
config.user = "Bajena"
|
13
14
|
config.project = "ams_lazy_relationships"
|
14
|
-
config.future_release = "
|
15
|
+
config.future_release = "v#{AmsLazyRelationships::VERSION}"
|
15
16
|
end
|
@@ -33,13 +33,12 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
34
|
spec.require_paths = ["lib"]
|
35
35
|
|
36
|
-
spec.add_dependency "active_model_serializers"
|
37
|
-
spec.add_dependency "batch-loader", "~> 1
|
36
|
+
spec.add_dependency "active_model_serializers", ">= 0.10.0.rc4"
|
37
|
+
spec.add_dependency "batch-loader", "~> 1"
|
38
38
|
|
39
39
|
spec.add_development_dependency "activerecord"
|
40
40
|
# A Ruby library for testing against different versions of dependencies
|
41
41
|
spec.add_development_dependency "appraisal"
|
42
|
-
spec.add_development_dependency "bundler", "~> 1.17"
|
43
42
|
# Rspec matchers for SQL query counts
|
44
43
|
spec.add_development_dependency "db-query-matchers"
|
45
44
|
spec.add_development_dependency "github_changelog_generator"
|
@@ -52,9 +51,14 @@ Gem::Specification.new do |spec|
|
|
52
51
|
spec.add_development_dependency "rubocop-rspec", "= 1.20.1"
|
53
52
|
spec.add_development_dependency "simplecov"
|
54
53
|
spec.add_development_dependency "simplecov-lcov"
|
55
|
-
spec.add_development_dependency "sqlite3"
|
54
|
+
spec.add_development_dependency "sqlite3"
|
56
55
|
# Detect untested code blocks in recent changes
|
57
56
|
spec.add_development_dependency "undercover"
|
58
57
|
# Dynamically build an Active Record model (with table) within a test context
|
59
58
|
spec.add_development_dependency "with_model", "~> 2.0"
|
59
|
+
|
60
|
+
# Implicit dependency of AMS - used to be a part of Rails
|
61
|
+
spec.add_development_dependency "thread_safe"
|
62
|
+
|
63
|
+
spec.add_development_dependency "benchmark-memory", "~> 0.1"
|
60
64
|
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "batch-loader"
|
4
|
+
require "active_model_serializers"
|
5
|
+
|
3
6
|
require "ams_lazy_relationships/version"
|
7
|
+
require "ams_lazy_relationships/extensions"
|
4
8
|
require "ams_lazy_relationships/loaders"
|
5
9
|
require "ams_lazy_relationships/core"
|
6
10
|
|