after_commit_everywhere 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +13 -6
- data/Appraisals +6 -1
- data/CHANGELOG.md +22 -0
- data/README.md +3 -1
- data/after_commit_everywhere.gemspec +4 -1
- data/gemfiles/activerecord_4_2.gemfile +7 -0
- data/gemfiles/activerecord_5_2.gemfile +1 -1
- data/gemfiles/activerecord_master.gemfile +1 -0
- data/lib/after_commit_everywhere.rb +5 -0
- data/lib/after_commit_everywhere/version.rb +1 -1
- metadata +49 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7d629817cd7a0bcb81c8d59d09356e9f1ca30552
|
4
|
+
data.tar.gz: a918de48d7fe61eeb40493cd5f9cfe9e8f38e135
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0dcd0079e0d01bd55442a45b633f3ffbe628555c3cad8e8f6a8c06323150d0ffb8fa291f49510776ad406b8d1f6dc7254a19c2ba9ba5b10686ff3b3e9fc9467
|
7
|
+
data.tar.gz: e0b2bd78ade3dc2b0f280fbbd15f4230d8748f03347e2b022c63fa472edb0ca849edf3c7735b4662f5a7171e59789f2445107787243b19c801cf28f1e343020d
|
data/.travis.yml
CHANGED
@@ -11,15 +11,22 @@ addons:
|
|
11
11
|
|
12
12
|
matrix:
|
13
13
|
include:
|
14
|
-
- rvm: 2.5.
|
14
|
+
- rvm: 2.5.1
|
15
|
+
gemfile: gemfiles/activerecord_4_2.gemfile
|
16
|
+
- rvm: 2.5.1
|
15
17
|
gemfile: gemfiles/activerecord_5_0.gemfile
|
16
|
-
- rvm: 2.5.
|
18
|
+
- rvm: 2.5.1
|
17
19
|
gemfile: gemfiles/activerecord_5_1.gemfile
|
18
|
-
- rvm: 2.5.
|
20
|
+
- rvm: 2.5.1
|
19
21
|
gemfile: gemfiles/activerecord_5_2.gemfile
|
20
|
-
- rvm: 2.5.
|
22
|
+
- rvm: 2.5.1
|
21
23
|
gemfile: gemfiles/activerecord_master.gemfile
|
22
|
-
- rvm: 2.4.
|
24
|
+
- rvm: 2.4.4
|
23
25
|
gemfile: gemfiles/activerecord_5_2.gemfile
|
24
|
-
- rvm: 2.3.
|
26
|
+
- rvm: 2.3.7
|
25
27
|
gemfile: gemfiles/activerecord_5_2.gemfile
|
28
|
+
|
29
|
+
# https://github.com/travis-ci/travis-ci/issues/8969#issuecomment-380028168
|
30
|
+
before_install:
|
31
|
+
- gem update --system
|
32
|
+
- gem install bundler
|
data/Appraisals
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
appraise 'activerecord-4-2' do
|
4
|
+
gem 'activerecord', '~> 4.2.0'
|
5
|
+
end
|
2
6
|
|
3
7
|
appraise 'activerecord-5-0' do
|
4
8
|
gem 'activerecord', '~> 5.0.0'
|
@@ -9,9 +13,10 @@ appraise 'activerecord-5-1' do
|
|
9
13
|
end
|
10
14
|
|
11
15
|
appraise 'activerecord-5-2' do
|
12
|
-
gem 'activerecord', '~> 5.2.0
|
16
|
+
gem 'activerecord', '~> 5.2.0'
|
13
17
|
end
|
14
18
|
|
15
19
|
appraise 'activerecord-master' do
|
20
|
+
gem 'rails', git: 'https://github.com/rails/rails.git'
|
16
21
|
gem 'activerecord', git: 'https://github.com/rails/rails.git'
|
17
22
|
end
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## 0.1.2 (2018-05-01)
|
10
|
+
|
11
|
+
- [PR [#1](https://github.com/Envek/after_commit_everywhere/pull/1)] Enable ActiveRecord 4.2 support. ([@arjun810], [@Envek])
|
12
|
+
|
13
|
+
## 0.1.1 (2018-03-29)
|
14
|
+
|
15
|
+
- Do not issue warning on `after_commit` invocation outside of transaction as it is expected behaviour. ([@Envek])
|
16
|
+
|
17
|
+
## 0.1.0 (2018-03-18)
|
18
|
+
|
19
|
+
- Initial version with `after_commit`, `before_commit`. and `after_rollback` callbacks. ([@Envek])
|
20
|
+
|
21
|
+
[@Envek]: https://github.com/Envek "Andrey Novikov"
|
22
|
+
[@arjun810]: https://github.com/arjun810 "Arjun Singh"
|
data/README.md
CHANGED
@@ -98,6 +98,8 @@ Will be executed right before outermost transaction will be commited _(I can't i
|
|
98
98
|
|
99
99
|
If called outside transaction will execute callback immediately.
|
100
100
|
|
101
|
+
Supported only starting from ActiveRecord 5.0.
|
102
|
+
|
101
103
|
#### `after_rollback`
|
102
104
|
|
103
105
|
Will be executed right after transaction in which it have been declared was rolled back (this might be nested savepoint transaction block with `requires_new: true`).
|
@@ -110,7 +112,7 @@ Please keep in mind ActiveRecord's [limitations for rolling back nested transact
|
|
110
112
|
|
111
113
|
#### Does it works with transactional_test or DatabaseCleaner
|
112
114
|
|
113
|
-
|
115
|
+
**Yes**.
|
114
116
|
|
115
117
|
|
116
118
|
## Development
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ['lib']
|
30
30
|
|
31
|
-
spec.add_dependency 'activerecord', '>=
|
31
|
+
spec.add_dependency 'activerecord', '>= 4.2'
|
32
32
|
spec.add_development_dependency 'appraisal'
|
33
33
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
34
34
|
spec.add_development_dependency 'pry'
|
@@ -36,4 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
37
37
|
spec.add_development_dependency 'rubocop'
|
38
38
|
spec.add_development_dependency 'sqlite3'
|
39
|
+
spec.add_development_dependency 'isolator'
|
40
|
+
spec.add_development_dependency 'rails'
|
41
|
+
spec.add_development_dependency 'rspec-rails'
|
39
42
|
end
|
@@ -33,10 +33,15 @@ module AfterCommitEverywhere
|
|
33
33
|
#
|
34
34
|
# If called outside transaction it will execute callback immediately.
|
35
35
|
#
|
36
|
+
# Available only since Ruby on Rails 5.0. See https://github.com/rails/rails/pull/18936
|
37
|
+
#
|
36
38
|
# @param connection [ActiveRecord::ConnectionAdapters::AbstractAdapter]
|
37
39
|
# @param callback [#call] Callback to be executed
|
38
40
|
# @return void
|
39
41
|
def before_commit(connection: ActiveRecord::Base.connection, &callback)
|
42
|
+
if ActiveRecord::VERSION::MAJOR < 5
|
43
|
+
raise NotImplementedError, "#{__callee__} works only with Rails 5.0+"
|
44
|
+
end
|
40
45
|
AfterCommitEverywhere.register_callback(
|
41
46
|
connection: connection,
|
42
47
|
name: __callee__,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: after_commit_everywhere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: appraisal
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +122,48 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: isolator
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rails
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rspec-rails
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
125
167
|
description: Brings before_commit, after_commit, and after_rollback transactional callbacks
|
126
168
|
outside of your ActiveRecord models.
|
127
169
|
email:
|
@@ -135,6 +177,7 @@ files:
|
|
135
177
|
- ".rubocop.yml"
|
136
178
|
- ".travis.yml"
|
137
179
|
- Appraisals
|
180
|
+
- CHANGELOG.md
|
138
181
|
- Gemfile
|
139
182
|
- LICENSE.txt
|
140
183
|
- README.md
|
@@ -143,6 +186,7 @@ files:
|
|
143
186
|
- bin/console
|
144
187
|
- bin/setup
|
145
188
|
- gemfiles/.bundle/config
|
189
|
+
- gemfiles/activerecord_4_2.gemfile
|
146
190
|
- gemfiles/activerecord_5_0.gemfile
|
147
191
|
- gemfiles/activerecord_5_1.gemfile
|
148
192
|
- gemfiles/activerecord_5_2.gemfile
|
@@ -171,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
215
|
version: '0'
|
172
216
|
requirements: []
|
173
217
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.
|
218
|
+
rubygems_version: 2.6.14.1
|
175
219
|
signing_key:
|
176
220
|
specification_version: 4
|
177
221
|
summary: Executes code after database commit wherever you want in your application
|