after_commit_everywhere 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7d629817cd7a0bcb81c8d59d09356e9f1ca30552
4
- data.tar.gz: a918de48d7fe61eeb40493cd5f9cfe9e8f38e135
2
+ SHA256:
3
+ metadata.gz: d959365a048625cd9a944d475f20a3621bcaba1666399f558269eee56ba6d238
4
+ data.tar.gz: 17b9c71cb73cb8c86a3d45928476537169183dca86bdfd896eb7c66c83d32b7f
5
5
  SHA512:
6
- metadata.gz: a0dcd0079e0d01bd55442a45b633f3ffbe628555c3cad8e8f6a8c06323150d0ffb8fa291f49510776ad406b8d1f6dc7254a19c2ba9ba5b10686ff3b3e9fc9467
7
- data.tar.gz: e0b2bd78ade3dc2b0f280fbbd15f4230d8748f03347e2b022c63fa472edb0ca849edf3c7735b4662f5a7171e59789f2445107787243b19c801cf28f1e343020d
6
+ metadata.gz: e453a9b961a9c5d18c77a0bb1d69fe899604b8970316459e008930ad0264c5a9077cf2adf7bf9ce6ecde856a1b5c8a1cf3a8f733e25a7e65d6641be8fc63aa8d
7
+ data.tar.gz: 915d3541eaf4c43f0eb195cb94ea0debd86d3fa0372ad2eb081fa2471c2f80586fc96c9691bf77af15390522b8cf06e5aa2f82410cde6ef1f9bff5ed898fff1a
@@ -34,8 +34,17 @@ Style/TrailingCommaInArguments:
34
34
  Enabled: true
35
35
  EnforcedStyleForMultiline: consistent_comma
36
36
 
37
- Style/TrailingCommaInLiteral:
38
- Description: 'Checks for trailing comma in array and hash literals.'
37
+ Style/TrailingCommaInArrayLiteral:
38
+ Description: 'Checks for trailing comma in array literals.'
39
39
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
40
40
  Enabled: true
41
41
  EnforcedStyleForMultiline: consistent_comma
42
+
43
+ Style/TrailingCommaInHashLiteral:
44
+ Description: 'Checks for trailing comma in hash literals.'
45
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
46
+ Enabled: true
47
+ EnforcedStyleForMultiline: consistent_comma
48
+
49
+ Style/StringLiterals:
50
+ EnforcedStyle: double_quotes
@@ -11,22 +11,24 @@ addons:
11
11
 
12
12
  matrix:
13
13
  include:
14
- - rvm: 2.5.1
14
+ - rvm: 2.5.3
15
15
  gemfile: gemfiles/activerecord_4_2.gemfile
16
- - rvm: 2.5.1
16
+ - rvm: 2.5.3
17
17
  gemfile: gemfiles/activerecord_5_0.gemfile
18
- - rvm: 2.5.1
18
+ - rvm: 2.5.3
19
19
  gemfile: gemfiles/activerecord_5_1.gemfile
20
- - rvm: 2.5.1
20
+ - rvm: 2.4.5
21
21
  gemfile: gemfiles/activerecord_5_2.gemfile
22
- - rvm: 2.5.1
23
- gemfile: gemfiles/activerecord_master.gemfile
24
- - rvm: 2.4.4
22
+ - rvm: 2.3.8
23
+ gemfile: gemfiles/activerecord_5_2.gemfile
24
+ - rvm: 2.5.3
25
25
  gemfile: gemfiles/activerecord_5_2.gemfile
26
- - rvm: 2.3.7
26
+ - rvm: 2.6.1
27
27
  gemfile: gemfiles/activerecord_5_2.gemfile
28
+ - rvm: 2.6.1
29
+ gemfile: gemfiles/activerecord_master.gemfile
28
30
 
29
31
  # https://github.com/travis-ci/travis-ci/issues/8969#issuecomment-380028168
30
32
  before_install:
31
33
  - gem update --system
32
- - gem install bundler
34
+ - gem install bundler -v "~> 1.17.2"
data/Appraisals CHANGED
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
- #
3
- appraise 'activerecord-4-2' do
4
- gem 'activerecord', '~> 4.2.0'
2
+
3
+ appraise "activerecord-4-2" do
4
+ gem "activerecord", "~> 4.2.0"
5
5
  end
6
6
 
7
- appraise 'activerecord-5-0' do
8
- gem 'activerecord', '~> 5.0.0'
7
+ appraise "activerecord-5-0" do
8
+ gem "activerecord", "~> 5.0.0"
9
9
  end
10
10
 
11
- appraise 'activerecord-5-1' do
12
- gem 'activerecord', '~> 5.1.0'
11
+ appraise "activerecord-5-1" do
12
+ gem "activerecord", "~> 5.1.0"
13
13
  end
14
14
 
15
- appraise 'activerecord-5-2' do
16
- gem 'activerecord', '~> 5.2.0'
15
+ appraise "activerecord-5-2" do
16
+ gem "activerecord", "~> 5.2.0"
17
17
  end
18
18
 
19
- appraise 'activerecord-master' do
20
- gem 'rails', git: 'https://github.com/rails/rails.git'
21
- gem 'activerecord', git: 'https://github.com/rails/rails.git'
19
+ appraise "activerecord-master" do
20
+ gem "rails", git: "https://github.com/rails/rails.git"
21
+ gem "activerecord", git: "https://github.com/rails/rails.git"
22
22
  end
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## 0.1.3 (2019-02-18)
10
+
11
+ - Make `in_transaction?` helper method public. ([@Envek])
12
+
9
13
  ## 0.1.2 (2018-05-01)
10
14
 
11
15
  - [PR [#1](https://github.com/Envek/after_commit_everywhere/pull/1)] Enable ActiveRecord 4.2 support. ([@arjun810], [@Envek])
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'after_commit_everywhere/version'
5
+ require "after_commit_everywhere/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'after_commit_everywhere'
8
+ spec.name = "after_commit_everywhere"
9
9
  spec.version = AfterCommitEverywhere::VERSION
10
- spec.authors = ['Andrey Novikov']
11
- spec.email = ['envek@envek.name']
10
+ spec.authors = ["Andrey Novikov"]
11
+ spec.email = ["envek@envek.name"]
12
12
 
13
13
  spec.summary = <<~MSG.strip
14
14
  Executes code after database commit wherever you want in your application
@@ -18,25 +18,25 @@ Gem::Specification.new do |spec|
18
18
  Brings before_commit, after_commit, and after_rollback transactional \
19
19
  callbacks outside of your ActiveRecord models.
20
20
  MSG
21
- spec.homepage = 'https://github.com/Envek/after_commit_everywhere'
22
- spec.license = 'MIT'
21
+ spec.homepage = "https://github.com/Envek/after_commit_everywhere"
22
+ spec.license = "MIT"
23
23
 
24
24
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
25
  f.match(%r{^(test|spec|features)/})
26
26
  end
27
- spec.bindir = 'exe'
27
+ spec.bindir = "exe"
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
- spec.require_paths = ['lib']
29
+ spec.require_paths = ["lib"]
30
30
 
31
- spec.add_dependency 'activerecord', '>= 4.2'
32
- spec.add_development_dependency 'appraisal'
33
- spec.add_development_dependency 'bundler', '~> 1.16'
34
- spec.add_development_dependency 'pry'
35
- spec.add_development_dependency 'rake', '~> 10.0'
36
- spec.add_development_dependency 'rspec', '~> 3.0'
37
- spec.add_development_dependency 'rubocop'
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'
31
+ spec.add_dependency "activerecord", ">= 4.2"
32
+ spec.add_development_dependency "appraisal"
33
+ spec.add_development_dependency "bundler", "~> 1.16"
34
+ spec.add_development_dependency "isolator"
35
+ spec.add_development_dependency "pry"
36
+ spec.add_development_dependency "rails"
37
+ spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "rspec", "~> 3.0"
39
+ spec.add_development_dependency "rspec-rails"
40
+ spec.add_development_dependency "rubocop", "~> 0.64"
41
+ spec.add_development_dependency "sqlite3", "~> 1.3.6"
42
42
  end
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'bundler/setup'
5
- require 'after_commit_everywhere'
4
+ require "bundler/setup"
5
+ require "after_commit_everywhere"
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
9
9
 
10
- require 'pry'
10
+ require "pry"
11
11
  Pry.start
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source "https://rubygems.org"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source "https://rubygems.org"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source "https://rubygems.org"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source "https://rubygems.org"
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source "https://rubygems.org"
4
6
 
5
- gem "rails", git: "https://github.com/rails/rails.git"
6
7
  gem "activerecord", git: "https://github.com/rails/rails.git"
8
+ gem "rails", git: "https://github.com/rails/rails.git"
7
9
 
8
10
  gemspec path: "../"
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_record'
3
+ require "active_record"
4
4
 
5
- require 'after_commit_everywhere/version'
6
- require 'after_commit_everywhere/wrap'
5
+ require "after_commit_everywhere/version"
6
+ require "after_commit_everywhere/wrap"
7
7
 
8
8
  # Module allowing to use ActiveRecord transactional callbacks outside of
9
9
  # ActiveRecord models, literally everywhere in your application.
@@ -42,6 +42,7 @@ module AfterCommitEverywhere
42
42
  if ActiveRecord::VERSION::MAJOR < 5
43
43
  raise NotImplementedError, "#{__callee__} works only with Rails 5.0+"
44
44
  end
45
+
45
46
  AfterCommitEverywhere.register_callback(
46
47
  connection: connection,
47
48
  name: __callee__,
@@ -72,6 +73,7 @@ module AfterCommitEverywhere
72
73
  class << self
73
74
  def register_callback(connection:, name:, no_tx_action:, callback:)
74
75
  raise ArgumentError, "Provide callback to #{name}" unless callback
76
+
75
77
  unless in_transaction?(connection)
76
78
  case no_tx_action
77
79
  when :warn_and_execute
@@ -87,9 +89,8 @@ module AfterCommitEverywhere
87
89
  connection.add_transaction_record(wrap)
88
90
  end
89
91
 
90
- private
91
-
92
- def in_transaction?(connection)
92
+ # Helper method to determine whether we're currently in transaction or not
93
+ def in_transaction?(connection = ActiveRecord::Base.connection)
93
94
  # service transactions (tests and database_cleaner) are not joinable
94
95
  connection.transaction_open? && connection.current_transaction.joinable?
95
96
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AfterCommitEverywhere
4
- VERSION = '0.1.2'
4
+ VERSION = "0.1.3"
5
5
  end
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.2
4
+ version: 0.1.3
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-05-01 00:00:00.000000000 Z
11
+ date: 2019-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.16'
55
55
  - !ruby/object:Gem::Dependency
56
- name: pry
56
+ name: isolator
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,63 +67,63 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec
84
+ name: rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '3.0'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '3.0'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rubocop
98
+ name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '10.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '10.0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: sqlite3
112
+ name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: '3.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: '3.0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: isolator
126
+ name: rspec-rails
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -137,35 +137,35 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: rails
140
+ name: rubocop
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0'
145
+ version: '0.64'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0'
152
+ version: '0.64'
153
153
  - !ruby/object:Gem::Dependency
154
- name: rspec-rails
154
+ name: sqlite3
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: 1.3.6
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
167
- description: Brings before_commit, after_commit, and after_rollback transactional callbacks
168
- outside of your ActiveRecord models.
166
+ version: 1.3.6
167
+ description: Brings before_commit, after_commit, and after_rollback transactional
168
+ callbacks outside of your ActiveRecord models.
169
169
  email:
170
170
  - envek@envek.name
171
171
  executables: []
@@ -214,8 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  requirements: []
217
- rubyforge_project:
218
- rubygems_version: 2.6.14.1
217
+ rubygems_version: 3.0.1
219
218
  signing_key:
220
219
  specification_version: 4
221
220
  summary: Executes code after database commit wherever you want in your application