marginalia 1.8.0 → 1.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 +5 -5
- data/.travis.yml +8 -0
- data/lib/marginalia.rb +2 -2
- data/lib/marginalia/comment.rb +7 -4
- data/marginalia.gemspec +2 -2
- data/test/query_comments_test.rb +12 -1
- metadata +3 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 31ba959aad96344c36a5044e5eed7affc9e837c1ebf6fefe204dc401e3c02cff
|
4
|
+
data.tar.gz: 5c84a52e9828ff87940bad7ca82ba495f59159fd2154793cc4eeafaacd47da50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 422739201b1a3e455b233d37500795fb80c4d92e167e4f5c8b7f70a9ee9f5db510fcee7e6623cdea951a8c8db7929b0ce8fcf2fcc5f7fbc15af8c8cd2445a45a
|
7
|
+
data.tar.gz: f89615ffdfd2cdffe9cef3edabbaf7bc2a9f5fb4124ec03cb3b402a0a0f1368c1616ade7b2f8a18d2292324d9e63589a70b366f1fb1ec7bc72a4ce8a90f498e4
|
data/.travis.yml
CHANGED
data/lib/marginalia.rb
CHANGED
@@ -76,9 +76,9 @@ module Marginalia
|
|
76
76
|
end
|
77
77
|
|
78
78
|
if ActiveRecord::VERSION::MAJOR >= 5
|
79
|
-
def exec_query_with_marginalia(sql, name = 'SQL', binds = [], options
|
79
|
+
def exec_query_with_marginalia(sql, name = 'SQL', binds = [], **options)
|
80
80
|
options[:prepare] ||= false
|
81
|
-
exec_query_without_marginalia(annotate_sql(sql), name, binds, options)
|
81
|
+
exec_query_without_marginalia(annotate_sql(sql), name, binds, **options)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
data/lib/marginalia/comment.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'socket'
|
2
4
|
|
3
5
|
module Marginalia
|
@@ -18,11 +20,11 @@ module Marginalia
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.construct_comment
|
21
|
-
ret =
|
23
|
+
ret = String.new
|
22
24
|
self.components.each do |c|
|
23
25
|
component_value = self.send(c)
|
24
26
|
if component_value.present?
|
25
|
-
ret << "#{c
|
27
|
+
ret << "#{c}:#{component_value},"
|
26
28
|
end
|
27
29
|
end
|
28
30
|
ret.chop!
|
@@ -102,11 +104,12 @@ module Marginalia
|
|
102
104
|
end
|
103
105
|
|
104
106
|
def self.sidekiq_job
|
105
|
-
marginalia_job["class"] if marginalia_job
|
107
|
+
marginalia_job["class"] if marginalia_job && marginalia_job.respond_to?(:[])
|
106
108
|
end
|
107
109
|
|
108
110
|
def self.line
|
109
|
-
Marginalia::Comment.lines_to_ignore ||= /\.rvm|gem|vendor\/|marginalia|rbenv/
|
111
|
+
Marginalia::Comment.lines_to_ignore ||= /\.rvm|gem|vendor\/|marginalia|rbenv|monitor\.rb.*mon_synchronize/
|
112
|
+
|
110
113
|
last_line = caller.detect do |line|
|
111
114
|
line !~ Marginalia::Comment.lines_to_ignore
|
112
115
|
end
|
data/marginalia.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.authors = ["Noah Lorang", "Nick Quaranto", "Taylor Weibley"]
|
3
|
-
gem.email = ["
|
3
|
+
gem.email = ["arthurnn@github.com"]
|
4
4
|
gem.homepage = "https://github.com/basecamp/marginalia"
|
5
5
|
|
6
6
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.test_files = `git ls-files -- {test}/*`.split("\n")
|
9
9
|
gem.name = "marginalia"
|
10
10
|
gem.require_paths = ["lib"]
|
11
|
-
gem.version = "1.
|
11
|
+
gem.version = "1.9.0"
|
12
12
|
gem.license = "MIT"
|
13
13
|
|
14
14
|
gem.add_runtime_dependency "actionpack", ">= 2.3"
|
data/test/query_comments_test.rb
CHANGED
@@ -121,6 +121,7 @@ class MarginaliaTest < MiniTest::Test
|
|
121
121
|
@queries << args.last[:sql]
|
122
122
|
end
|
123
123
|
@env = Rack::MockRequest.env_for('/')
|
124
|
+
ActiveJob::Base.queue_adapter = :inline
|
124
125
|
end
|
125
126
|
|
126
127
|
def test_double_annotate
|
@@ -282,6 +283,15 @@ class MarginaliaTest < MiniTest::Test
|
|
282
283
|
Post.first
|
283
284
|
refute_match %{job:PostsJob}, @queries.last
|
284
285
|
end
|
286
|
+
|
287
|
+
def test_active_job_with_sidekiq
|
288
|
+
Marginalia::Comment.components = [:job, :sidekiq_job]
|
289
|
+
PostsJob.perform_later
|
290
|
+
assert_match %{job:PostsJob}, @queries.first
|
291
|
+
|
292
|
+
Post.first
|
293
|
+
refute_match %{job:PostsJob}, @queries.last
|
294
|
+
end
|
285
295
|
end
|
286
296
|
|
287
297
|
def test_sidekiq_job
|
@@ -290,13 +300,14 @@ class MarginaliaTest < MiniTest::Test
|
|
290
300
|
|
291
301
|
# Test harness does not run Sidekiq middlewares by default so include testing middleware.
|
292
302
|
Sidekiq::Testing.server_middleware do |chain|
|
293
|
-
|
303
|
+
chain.add Marginalia::SidekiqInstrumentation::Middleware
|
294
304
|
end
|
295
305
|
|
296
306
|
Sidekiq::Testing.fake!
|
297
307
|
PostsSidekiqJob.perform_async
|
298
308
|
PostsSidekiqJob.drain
|
299
309
|
assert_match %{sidekiq_job:PostsSidekiqJob}, @queries.first
|
310
|
+
|
300
311
|
Post.first
|
301
312
|
refute_match %{sidekiq_job:PostsSidekiqJob}, @queries.last
|
302
313
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marginalia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Lorang
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-08-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: actionpack
|
@@ -140,7 +140,6 @@ dependencies:
|
|
140
140
|
version: '0'
|
141
141
|
description: Attach comments to your ActiveRecord queries.
|
142
142
|
email:
|
143
|
-
- noah@37signals.com
|
144
143
|
- arthurnn@github.com
|
145
144
|
executables: []
|
146
145
|
extensions: []
|
@@ -184,8 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
183
|
- !ruby/object:Gem::Version
|
185
184
|
version: '0'
|
186
185
|
requirements: []
|
187
|
-
|
188
|
-
rubygems_version: 2.4.5.1
|
186
|
+
rubygems_version: 3.1.2
|
189
187
|
signing_key:
|
190
188
|
specification_version: 4
|
191
189
|
summary: Attach comments to your ActiveRecord queries.
|