isolator 0.1.0.pre → 0.1.0.pre2

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
2
  SHA256:
3
- metadata.gz: 49bd3e78bcb76db6246085d139aba6aecda0ed438eb4a8241765034d92e307c0
4
- data.tar.gz: 525b2c3d728493a7c4b57f0552dbc0434b9012db07f9b3e3b79d6b585349e5b8
3
+ metadata.gz: d70c61a526af789744667a5ef87f3b396e261102c414f004c874278a3a7af7cd
4
+ data.tar.gz: 75432a1b9d3ad708269b55cfb675168abb8b2b83efabcb19a709f7da19ade6a8
5
5
  SHA512:
6
- metadata.gz: 8e272766ea2a5387632c203388fb0781d39897ff2a426a8fb8221b6e483bfc785214e26bff3f01eedefa1e40fa73a33816e7d617033a46d883bc57b9bdb26835
7
- data.tar.gz: 8ca5b2671dca29a767ac8a33d8e215387850b817dda34f47a7ee455f349fc2c6e42d5fac1e07a83f8bbb2347cbf5a5d6279e4236346db0d3241e08f345253326
6
+ metadata.gz: 77d6b9bd87e603fd10415e234421ec60852228e50217f2ed37dac5aa837500fbfc6febaaa2aa8442375f6ca52a4e68474eb9d381ea99d19222ae1810eff03efa
7
+ data.tar.gz: '0782abd5aede38aee2f303738629cc0c4fd4487163555691ad37622f673aa57b99b12ea1112bb609ab10225cf0e027237dac12c60bc213d6fcfbd46076c4f624'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## master
4
4
 
5
+ - [PR [#5](https://github.com/palkan/isolator/pull/5)] Add `mail` adapter. ([@alexshgov][])
6
+
5
7
  - Initial version. ([@palkan][], [@TheSmartnik][], [@alexshgov][])
6
8
 
7
9
  [@palkan]: https://github.com/palkan
data/README.md CHANGED
@@ -108,6 +108,7 @@ Isolator has a bunch of built-in adapters:
108
108
  - `:http` – built on top of [Sniffer][]
109
109
  - `:active_job`
110
110
  - `:sidekiq`
111
+ - `:mailer`
111
112
 
112
113
  You can dynamically enable/disable adapters, e.g.:
113
114
 
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ActiveSupport.on_load(:active_job) do
4
- require "isolator/adapters/background_jobs/active_job"
3
+ if defined?(ActiveSupport)
4
+ ActiveSupport.on_load(:active_job) do
5
+ require "isolator/adapters/background_jobs/active_job"
6
+ end
5
7
  end
6
8
 
7
9
  require "isolator/adapters/background_jobs/sidekiq" if defined?(Sidekiq::Client)
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ Isolator.isolate :mailer, Mail::Message, :deliver,
4
+ exception_class: Isolator::MailerError
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ if defined?(ActiveSupport)
4
+ ActiveSupport.on_load(:action_mailer) do
5
+ require "isolator/adapters/mailers/mail"
6
+ end
7
+ end
8
+
9
+ require "isolator/adapters/mailers/mail" if defined?(Mail::Message)
@@ -2,3 +2,4 @@
2
2
 
3
3
  require "isolator/adapters/http"
4
4
  require "isolator/adapters/background_jobs"
5
+ require "isolator/adapters/mailers"
@@ -18,4 +18,8 @@ module Isolator # :nodoc: all
18
18
  MESSAGE = "You are trying to enqueue background job inside db transaction. " \
19
19
  "In case of transaction failure, this may lead to data inconsistency and unexpected bugs"
20
20
  end
21
+
22
+ class MailerError < UnsafeOperationError
23
+ MESSAGE = "You are trying to send email inside db transaction."
24
+ end
21
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Isolator
4
- VERSION = "0.1.0.pre"
4
+ VERSION = "0.1.0.pre2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isolator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre
4
+ version: 0.1.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-16 00:00:00.000000000 Z
11
+ date: 2018-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sniffer
@@ -179,6 +179,8 @@ files:
179
179
  - lib/isolator/adapters/background_jobs/sidekiq.rb
180
180
  - lib/isolator/adapters/base.rb
181
181
  - lib/isolator/adapters/http.rb
182
+ - lib/isolator/adapters/mailers.rb
183
+ - lib/isolator/adapters/mailers/mail.rb
182
184
  - lib/isolator/callbacks.rb
183
185
  - lib/isolator/configuration.rb
184
186
  - lib/isolator/errors.rb