counter_culture 2.8.0 → 2.9.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/.travis.yml +11 -8
- data/CHANGELOG.md +5 -0
- data/README.md +12 -0
- data/lib/counter_culture/counter.rb +3 -1
- data/lib/counter_culture/version.rb +1 -1
- metadata +2 -3
- data/run_tests_locally.sh +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 99af13953d00540dac3d0b149483d190f03f4c0f77063cdd440b2b18c1ef6031
|
|
4
|
+
data.tar.gz: fedce32d590b66c8ff0bf291d612ef1f1fd08356afb81a56ae310caa6a9eeac9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 510c27a1188f8cbe9073487f2f0f7579ffad46a1b140c44bdfcea07308ddb0975587140dd96a60087475d8c6ad94d1b415cb40f57a1ba59e7d19673bd426bf93
|
|
7
|
+
data.tar.gz: 5c2acebf87a92a8ca02e7bd38d4d683cde4fa77c46f611ae29f6007509450baeeb72a69df6107c38606b9243d1e61e5a38302ec51bbd60bdb1fbd8bd53b1289f
|
data/.travis.yml
CHANGED
|
@@ -5,13 +5,16 @@ cache:
|
|
|
5
5
|
services:
|
|
6
6
|
- postgresql
|
|
7
7
|
- mysql
|
|
8
|
+
branches:
|
|
9
|
+
only:
|
|
10
|
+
- master
|
|
8
11
|
addons:
|
|
9
12
|
postgresql: "9.6"
|
|
10
13
|
rvm:
|
|
11
|
-
- "2.5.
|
|
12
|
-
- "2.6.
|
|
13
|
-
- "2.7.
|
|
14
|
-
- "3.0.
|
|
14
|
+
- "2.5.9"
|
|
15
|
+
- "2.6.8"
|
|
16
|
+
- "2.7.4"
|
|
17
|
+
- "3.0.2"
|
|
15
18
|
gemfile:
|
|
16
19
|
- gemfiles/rails_4.2.gemfile
|
|
17
20
|
- gemfiles/rails_5.0.gemfile
|
|
@@ -21,13 +24,13 @@ gemfile:
|
|
|
21
24
|
- gemfiles/rails_6.1.gemfile
|
|
22
25
|
matrix:
|
|
23
26
|
exclude:
|
|
24
|
-
- rvm: "3.0.
|
|
27
|
+
- rvm: "3.0.1"
|
|
25
28
|
gemfile: gemfiles/rails_4.2.gemfile
|
|
26
|
-
- rvm: "3.0.
|
|
29
|
+
- rvm: "3.0.1"
|
|
27
30
|
gemfile: gemfiles/rails_5.0.gemfile
|
|
28
|
-
- rvm: "3.0.
|
|
31
|
+
- rvm: "3.0.1"
|
|
29
32
|
gemfile: gemfiles/rails_5.1.gemfile
|
|
30
|
-
- rvm: "3.0.
|
|
33
|
+
- rvm: "3.0.1"
|
|
31
34
|
gemfile: gemfiles/rails_5.2.gemfile
|
|
32
35
|
env:
|
|
33
36
|
- DB=postgresql
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -259,6 +259,18 @@ Another option is to simply defer the update of counter caches to outside of the
|
|
|
259
259
|
```ruby
|
|
260
260
|
counter_culture :category, execute_after_commit: true
|
|
261
261
|
```
|
|
262
|
+
[NOTE] You need to manually specify the `after_commit_action` as dependency in the Gemfile to use this feature
|
|
263
|
+
```ruby
|
|
264
|
+
...
|
|
265
|
+
gem "after_commit_action"
|
|
266
|
+
...
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
You can also pass a `Proc` for dynamic control. This is useful for temporarily moving the counter cache update inside of the transaction:
|
|
270
|
+
|
|
271
|
+
```ruby
|
|
272
|
+
counter_culture :category, execute_after_commit: proc { !Thread.current[:update_counter_cache_in_transaction] }
|
|
273
|
+
```
|
|
262
274
|
|
|
263
275
|
### Manually populating counter cache values
|
|
264
276
|
|
|
@@ -311,7 +311,9 @@ module CounterCulture
|
|
|
311
311
|
end
|
|
312
312
|
|
|
313
313
|
def execute_now_or_after_commit(obj, &block)
|
|
314
|
-
|
|
314
|
+
execute_after_commit = @execute_after_commit.is_a?(Proc) ? @execute_after_commit.call : @execute_after_commit
|
|
315
|
+
|
|
316
|
+
if execute_after_commit
|
|
315
317
|
obj.execute_after_commit(&block)
|
|
316
318
|
else
|
|
317
319
|
block.call
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: counter_culture
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Magnus von Koeller
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-08-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -285,7 +285,6 @@ files:
|
|
|
285
285
|
- lib/counter_culture/version.rb
|
|
286
286
|
- lib/generators/counter_culture_generator.rb
|
|
287
287
|
- lib/generators/templates/counter_culture_migration.rb.erb
|
|
288
|
-
- run_tests_locally.sh
|
|
289
288
|
homepage: https://github.com/magnusvk/counter_culture
|
|
290
289
|
licenses:
|
|
291
290
|
- MIT
|
data/run_tests_locally.sh
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#! /bin/bash
|
|
2
|
-
|
|
3
|
-
set -e
|
|
4
|
-
source /usr/local/share/chruby/chruby.sh
|
|
5
|
-
|
|
6
|
-
for RUBY_VERSION in 2.5.8 2.6.6 2.7.2 3.0.0; do
|
|
7
|
-
chruby $RUBY_VERSION
|
|
8
|
-
ruby --version
|
|
9
|
-
|
|
10
|
-
gem install bundler -v '1.17.3'
|
|
11
|
-
|
|
12
|
-
(bundle _1.17.3_ check > /dev/null || bundle _1.17.3_ install)
|
|
13
|
-
gem install appraisal
|
|
14
|
-
bundle exec appraisal install
|
|
15
|
-
|
|
16
|
-
for DB in mysql2 postgresql sqlite3; do
|
|
17
|
-
echo "RUBY $RUBY_VERSION; DB $DB"
|
|
18
|
-
DB=$DB bundle exec appraisal rspec spec/counter_culture_spec.rb
|
|
19
|
-
done
|
|
20
|
-
done
|