isolator 0.6.1 → 0.6.2

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: 5c44e9964b126ff2ef69eaf93b21ad6535061cca8c85e916022046c1854c89cb
4
- data.tar.gz: 9dd67179bc96aca803313422d02e55ae57a3ac5fcb17c217aed97c3bda5f1250
3
+ metadata.gz: 36b44d69162aa2c6450298b45b30c824e129448be00ff92ffb0835da654cdf15
4
+ data.tar.gz: f5179d3d98ef52b3dd2c52c022da6e61cd1ea9472619d8350545756014ad9c3f
5
5
  SHA512:
6
- metadata.gz: b01364d05a5d1521760b83c50f5e2ff98b2045baec1756c4b12128143786c3b856c462997eebbb0bdac7e3881581f15ebb52e927ae04641114038f299aa3e358
7
- data.tar.gz: 8b469a00794532b7aa31c7a79af486f8c6d27beb5bda56d253adb56637ca54b641218dab9961f9a83a253a33d295a31edb0f7129154a39d2b10dfeb211e7928c
6
+ metadata.gz: b0194b763fac7ed01c229bac83985770c0ac9ba6da6448706a4bfa70d6f578b044b1d280cdb78e1fa7eebab6961979ddd937d914486f96cac067368f586b5f04
7
+ data.tar.gz: c9015bf6498684d09188a535fae608e02939a0cec7eb63f5ada0e705881d56f72f0971c55674e4e6a7448d6da3a933d54e8ed4a1c50fa5a9a906b0f09e36a381
@@ -1,70 +1,51 @@
1
1
  require:
2
+ - standard/cop/semantic_blocks
2
3
  - rubocop-md
3
4
 
5
+ inherit_gem:
6
+ standard: config/base.yml
7
+
4
8
  AllCops:
5
- Include:
6
- - 'lib/**/*.rb'
7
- - 'lib/**/*.rake'
8
- - 'spec/**/*.rb'
9
9
  Exclude:
10
- - 'bin/**/*'
11
- - 'gemfiles/**/*'
12
- - 'spec/dummy/**/*'
13
- - 'vendor/**/*'
10
+ - 'bin/*'
14
11
  - 'tmp/**/*'
15
- - 'Rakefile'
16
12
  - 'Gemfile'
17
- - '*.gemspec'
13
+ - 'vendor/**/*'
14
+ - 'gemfiles/**/*'
15
+ - 'lib/generators/**/templates/**/*'
18
16
  DisplayCopNames: true
19
- StyleGuideCopsOnly: false
20
- TargetRubyVersion: 2.2.2
17
+ TargetRubyVersion: 2.5
21
18
 
22
- Rails:
19
+ Standard/SemanticBlocks:
23
20
  Enabled: false
24
21
 
25
- Bundler/OrderedGems:
26
- Enabled: false
22
+ Style/FrozenStringLiteralComment:
23
+ Enabled: true
27
24
 
28
- Naming/UncommunicativeMethodParamName:
29
- Enabled: false
25
+ Style/TrailingCommaInArrayLiteral:
26
+ EnforcedStyleForMultiline: no_comma
30
27
 
31
- Style/SymbolArray:
32
- Enabled: false
28
+ Style/TrailingCommaInHashLiteral:
29
+ EnforcedStyleForMultiline: no_comma
33
30
 
34
- Style/Documentation:
31
+ Lint/Void:
35
32
  Exclude:
36
- - 'spec/**/*.rb'
37
-
38
- Style/StringLiterals:
39
- EnforcedStyle: double_quotes
40
-
41
- Style/RegexpLiteral:
42
- Enabled: false
43
-
44
- Style/Lambda:
45
- Enabled: false
33
+ - '**/*.md'
46
34
 
47
- Style/BlockDelimiters:
35
+ # See https://github.com/rubocop-hq/rubocop/issues/4222
36
+ Lint/AmbiguousBlockAssociation:
48
37
  Exclude:
49
- - 'spec/**/*.rb'
50
-
51
- Style/NumericPredicate:
52
- Enabled: false
38
+ - 'spec/**/*'
39
+ - '**/*.md'
53
40
 
54
- Layout/SpaceInsideStringInterpolation:
55
- EnforcedStyle: no_space
56
-
57
- Lint/AmbiguousRegexpLiteral:
58
- Enabled: false
59
-
60
- Metrics/LineLength:
61
- Max: 100
41
+ Lint/DuplicateMethods:
62
42
  Exclude:
63
- - 'spec/**/*.rb'
43
+ - '**/*.md'
64
44
 
65
- Metrics/BlockLength:
45
+ Naming/FileName:
66
46
  Exclude:
67
- - 'spec/**/*.rb'
47
+ - '**/*.md'
68
48
 
69
- Style/MutableConstant:
70
- Enabled: false
49
+ Layout/InitialIndentation:
50
+ Exclude:
51
+ - 'CHANGELOG.md'
@@ -1,8 +1,6 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
- rvm:
5
- - 2.5.3
6
4
 
7
5
  notifications:
8
6
  email: false
@@ -12,20 +10,18 @@ matrix:
12
10
  include:
13
11
  - rvm: ruby-head
14
12
  gemfile: gemfiles/railsmaster.gemfile
15
- - rvm: jruby-9.2.8.0
13
+ - rvm: jruby-9.2.10.0
16
14
  gemfile: gemfiles/jruby.gemfile
17
- - rvm: 2.6.2
18
- gemfile: gemfiles/rails6.gemfile
19
- - rvm: 2.5.0
15
+ - rvm: 2.7
20
16
  gemfile: Gemfile
21
- - rvm: 2.4.3
17
+ - rvm: 2.6
18
+ gemfile: gemfiles/rails6.gemfile
19
+ - rvm: 2.5
22
20
  gemfile: Gemfile
23
- - rvm: 2.3.1
21
+ - rvm: 2.5
24
22
  gemfile: gemfiles/activerecord42.gemfile
25
- - rvm: 2.2.2
26
- gemfile: gemfiles/ruby_2.2.2.gemfile
27
23
  allow_failures:
28
24
  - rvm: ruby-head
29
25
  gemfile: gemfiles/railsmaster.gemfile
30
- - rvm: jruby-9.2.8.0
26
+ - rvm: jruby-9.2.10.0
31
27
  gemfile: gemfiles/jruby.gemfile
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.6.2 (2020-03-20)
6
+
7
+ - Make Sniffer version requirement open-ended. ([@palkan][])
8
+
9
+ - **Support Ruby 2.5+** ([@palkan][])
10
+
5
11
  ## 0.6.1 (2019-09-06)
6
12
 
7
13
  - Fix Sniffer integration. ([@palkan][])
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 Vladimir Dementyev
3
+ Copyright (c) 2018-2020 Vladimir Dementyev
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -110,7 +110,7 @@ Isolator relys on [uniform_notifier][] to send custom notifications.
110
110
  ### Supported ORMs
111
111
 
112
112
  - `ActiveRecord` >= 4.1
113
- - `ROM::SQL` (only if Active Support instrumentation extenstion is loaded)
113
+ - `ROM::SQL` (only if Active Support instrumentation extension is loaded)
114
114
 
115
115
  ### Adapters
116
116
 
@@ -194,12 +194,12 @@ Possible `options` are:
194
194
 
195
195
  ```ruby
196
196
  Isolator.isolate :active_job,
197
- target: ActiveJob::Base,
198
- method_name: :enqueue,
199
- exception_class: Isolator::BackgroundJobError,
200
- details_message: ->(obj, _args) {
201
- "#{obj.class.name}(#{obj.arguments})"
202
- }
197
+ target: ActiveJob::Base,
198
+ method_name: :enqueue,
199
+ exception_class: Isolator::BackgroundJobError,
200
+ details_message: ->(obj, _args) {
201
+ "#{obj.class.name}(#{obj.arguments})"
202
+ }
203
203
  ```
204
204
 
205
205
  You can also add some callbacks to be run before and after the transaction:
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rspec/core/rake_task"
3
5
  require "rubocop/rake_task"
@@ -1,8 +1,8 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "activerecord-jdbcsqlite3-adapter", "~> 50.0"
3
+ gem "activerecord-jdbcsqlite3-adapter", "~> 60.0"
4
4
  gem "jdbc-sqlite3"
5
- gem "rails", "~> 5.0"
5
+ gem "rails", "~> 6.0.0"
6
6
  gem 'uniform_notifier', '~> 1.11'
7
7
 
8
8
  gemspec path: ".."
@@ -1,21 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path("../lib", __FILE__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require "isolator/version"
4
6
 
5
7
  Gem::Specification.new do |spec|
6
- spec.name = "isolator"
7
- spec.version = Isolator::VERSION
8
- spec.authors = ["Vladimir Dementyev"]
9
- spec.email = ["dementiev.vm@gmail.com"]
8
+ spec.name = "isolator"
9
+ spec.version = Isolator::VERSION
10
+ spec.authors = ["Vladimir Dementyev"]
11
+ spec.email = ["dementiev.vm@gmail.com"]
10
12
 
11
- spec.summary = "Detect non-atomic interactions within DB transactions"
12
- spec.description = "Detect non-atomic interactions within DB transactions"
13
- spec.homepage = "https://github.com/palkan/isolator"
14
- spec.license = "MIT"
13
+ spec.summary = "Detect non-atomic interactions within DB transactions"
14
+ spec.description = "Detect non-atomic interactions within DB transactions"
15
+ spec.homepage = "https://github.com/palkan/isolator"
16
+ spec.license = "MIT"
15
17
 
16
- spec.required_ruby_version = ">= 2.2.2"
18
+ spec.required_ruby_version = ">= 2.5.0"
17
19
 
18
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
21
  f.match(%r{^(test|spec|features)/})
20
22
  end
21
23
 
@@ -29,15 +31,15 @@ Gem::Specification.new do |spec|
29
31
 
30
32
  spec.require_paths = ["lib"]
31
33
 
32
- spec.add_runtime_dependency "sniffer", "~> 0.3.1"
34
+ spec.add_runtime_dependency "sniffer", ">= 0.3.1"
33
35
 
34
36
  spec.add_development_dependency "bundler", ">= 1.16"
35
- spec.add_development_dependency "rake", "~> 10.0"
37
+ spec.add_development_dependency "rake", "~> 13.0"
36
38
  spec.add_development_dependency "rspec", "~> 3.0"
37
39
  spec.add_development_dependency "rspec-rails", "~> 3.0"
38
40
  spec.add_development_dependency "minitest", "~> 5.10.0"
39
- spec.add_development_dependency "rubocop", "~> 0.56.0"
40
- spec.add_development_dependency "rubocop-md", "~> 0.2"
41
+ spec.add_development_dependency "standard", "~> 0.2.0"
42
+ spec.add_development_dependency "rubocop-md", "~> 0.3"
41
43
 
42
44
  spec.add_development_dependency "sidekiq", "~> 5.0"
43
45
  spec.add_development_dependency "webmock", "~> 3.1"
@@ -47,4 +49,5 @@ Gem::Specification.new do |spec|
47
49
  spec.add_development_dependency "resque-scheduler"
48
50
  spec.add_development_dependency "sucker_punch"
49
51
  spec.add_development_dependency "database_cleaner"
52
+ spec.add_development_dependency "database_cleaner-active_record"
50
53
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Isolator.isolate :active_job,
4
- target: ActiveJob::Base,
5
- method_name: :enqueue,
6
- exception_class: Isolator::BackgroundJobError,
7
- details_message: ->(obj, _args) {
8
- "#{obj.class.name}" \
9
- "#{obj.arguments.any? ? " (#{obj.arguments.join(', ')})" : ''}"
10
- }
4
+ target: ActiveJob::Base,
5
+ method_name: :enqueue,
6
+ exception_class: Isolator::BackgroundJobError,
7
+ details_message: ->(obj, _args) {
8
+ "#{obj.class.name}" \
9
+ "#{obj.arguments.any? ? " (#{obj.arguments.join(", ")})" : ""}"
10
+ }
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Isolator.isolate :resque,
4
- target: Resque.singleton_class,
5
- method_name: :enqueue,
6
- exception_class: Isolator::BackgroundJobError,
7
- details_message: ->(_obj, args) {
8
- args.join(", ")
9
- }
4
+ target: Resque.singleton_class,
5
+ method_name: :enqueue,
6
+ exception_class: Isolator::BackgroundJobError,
7
+ details_message: ->(_obj, args) {
8
+ args.join(", ")
9
+ }
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Isolator.isolate :resque_scheduler,
4
- target: Resque.singleton_class,
5
- method_name: :enqueue_at,
6
- exception_class: Isolator::BackgroundJobError,
7
- details_message: ->(_obj, (ts, *args)) {
8
- "#{args.join(', ')} (at #{ts})"
9
- }
4
+ target: Resque.singleton_class,
5
+ method_name: :enqueue_at,
6
+ exception_class: Isolator::BackgroundJobError,
7
+ details_message: ->(_obj, (ts, *args)) {
8
+ "#{args.join(", ")} (at #{ts})"
9
+ }
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Isolator.isolate :sidekiq,
4
- target: Sidekiq::Client,
5
- method_name: :raw_push,
6
- exception_class: Isolator::BackgroundJobError,
7
- details_message: ->(_obj, args) {
8
- args.first.map do |job|
9
- "#{job['class']} (#{job['args']})"
10
- end.join("\n")
11
- }
4
+ target: Sidekiq::Client,
5
+ method_name: :raw_push,
6
+ exception_class: Isolator::BackgroundJobError,
7
+ details_message: ->(_obj, args) {
8
+ args.first.map do |job|
9
+ "#{job["class"]} (#{job["args"]})"
10
+ end.join("\n")
11
+ }
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Isolator.isolate :sucker_punch,
4
- target: SuckerPunch::Queue.singleton_class,
5
- method_name: :find_or_create,
6
- exception_class: Isolator::BackgroundJobError,
7
- details_message: ->(_obj, args) {
8
- args.compact.join(", ")
9
- }
4
+ target: SuckerPunch::Queue.singleton_class,
5
+ method_name: :find_or_create,
6
+ exception_class: Isolator::BackgroundJobError,
7
+ details_message: ->(_obj, args) {
8
+ args.compact.join(", ")
9
+ }
@@ -31,8 +31,8 @@ module Isolator
31
31
  enabled? && Isolator.enabled? && Isolator.within_transaction? && !ignored?(*args)
32
32
  end
33
33
 
34
- def ignore_if
35
- ignores << Proc.new
34
+ def ignore_if(&block)
35
+ ignores << block
36
36
  end
37
37
 
38
38
  def ignores
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  adapter = Isolator.isolate :webmock,
4
- exception_class: Isolator::HTTPError,
5
- details_message: ->(obj, _args) {
6
- "#{obj.method.to_s.upcase} #{obj.uri}"
7
- }
4
+ exception_class: Isolator::HTTPError,
5
+ details_message: ->(obj, _args) {
6
+ "#{obj.method.to_s.upcase} #{obj.uri}"
7
+ }
8
8
 
9
9
  WebMock.after_request do |*args|
10
10
  adapter.notify(caller, *args)
@@ -13,7 +13,7 @@ module Isolator
13
13
  # defauls to false
14
14
  class Configuration
15
15
  attr_accessor :raise_exceptions, :logger, :send_notifications,
16
- :backtrace_filter
16
+ :backtrace_filter
17
17
 
18
18
  def initialize
19
19
  @logger = nil
@@ -20,7 +20,7 @@ module Isolator
20
20
  ignores = build_ignore_list(ignored_paths)
21
21
  return if ignores.blank?
22
22
 
23
- regex = Regexp.new("^.*(#{ignores.join('|')}):.*$")
23
+ regex = Regexp.new("^.*(#{ignores.join("|")}):.*$")
24
24
  adapter.ignore_if { caller.any? { |row| regex =~ row } }
25
25
  end
26
26
 
@@ -5,7 +5,7 @@ module Isolator
5
5
  module Isolate
6
6
  def isolate(id, **options)
7
7
  raise "Adapter already registered: #{id}" if Isolator.adapters.key?(id.to_s)
8
- adapter = AdapterBuilder.call(options)
8
+ adapter = AdapterBuilder.call(**options)
9
9
  Isolator.adapters[id.to_s] = adapter
10
10
  end
11
11
  end
@@ -9,8 +9,8 @@ module Isolator
9
9
 
10
10
  def self.subscribe!(event)
11
11
  ::ActiveSupport::Notifications.subscribe(event) do |_name, _start, _finish, _id, query|
12
- Isolator.incr_transactions! if query[:sql] =~ START_PATTERN
13
- Isolator.decr_transactions! if query[:sql] =~ FINISH_PATTERN
12
+ Isolator.incr_transactions! if START_PATTERN.match?(query[:sql])
13
+ Isolator.decr_transactions! if FINISH_PATTERN.match?(query[:sql])
14
14
  end
15
15
  end
16
16
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Isolator
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.2"
5
5
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isolator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-06 00:00:00.000000000 Z
11
+ date: 2020-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sniffer
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.3.1
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
26
  version: 0.3.1
27
27
  - !ruby/object:Gem::Dependency
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -95,33 +95,33 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: 5.10.0
97
97
  - !ruby/object:Gem::Dependency
98
- name: rubocop
98
+ name: standard
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.56.0
103
+ version: 0.2.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.56.0
110
+ version: 0.2.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubocop-md
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0.2'
117
+ version: '0.3'
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.2'
124
+ version: '0.3'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: sidekiq
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -234,6 +234,20 @@ dependencies:
234
234
  - - ">="
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: database_cleaner-active_record
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
237
251
  description: Detect non-atomic interactions within DB transactions
238
252
  email:
239
253
  - dementiev.vm@gmail.com
@@ -255,7 +269,6 @@ files:
255
269
  - gemfiles/jruby.gemfile
256
270
  - gemfiles/rails6.gemfile
257
271
  - gemfiles/railsmaster.gemfile
258
- - gemfiles/ruby_2.2.2.gemfile
259
272
  - isolator.gemspec
260
273
  - lib/isolator.rb
261
274
  - lib/isolator/adapter_builder.rb
@@ -305,14 +318,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
305
318
  requirements:
306
319
  - - ">="
307
320
  - !ruby/object:Gem::Version
308
- version: 2.2.2
321
+ version: 2.5.0
309
322
  required_rubygems_version: !ruby/object:Gem::Requirement
310
323
  requirements:
311
324
  - - ">="
312
325
  - !ruby/object:Gem::Version
313
326
  version: '0'
314
327
  requirements: []
315
- rubygems_version: 3.0.4
328
+ rubygems_version: 3.0.6
316
329
  signing_key:
317
330
  specification_version: 4
318
331
  summary: Detect non-atomic interactions within DB transactions
@@ -1,8 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "rails", "~> 4.2"
4
- gem "sqlite3", "~> 1.3.0"
5
- gem 'uniform_notifier', '1.11'
6
- gem 'anyway_config', '1.2'
7
-
8
- gemspec path: ".."