debugbar 0.3.1 → 0.3.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: 9533b2b578ca8071254a691d573f41708598945ab8ee666d45655f65f6b30730
4
- data.tar.gz: 4aba711679f6a65212f6fa88d543108e64c9a33f3fd99c59a3566d032f67e26b
3
+ metadata.gz: 5fb345ca3b935b2a6baee536310271a5cda8e15132e7a79413fb661e44c0dbef
4
+ data.tar.gz: 292867bd66a2a1e7348fca7451ef85e2bd756d187cefff23065c349fd90186f7
5
5
  SHA512:
6
- metadata.gz: 92d5d50ff82b3087cd332133e5c87733a7b2dc4eaa46c65fe4f5cac909d064a4a1c65612650a1eb10b18350272c8ae3f205663571793635c64a59369cb8aa545
7
- data.tar.gz: fd282177ec09843ab1a90ab9a71bb0838225e9958e2d443175faa3f60b8c5b87f7f78ca11bf8a867f671d906d045a0f87508ccc2c777e126f965fdd00161a3d2
6
+ metadata.gz: 6f0b963c955ca99ff48e9a281a43d3de900b552ed4b16de947529e106c00b5f65ff4cca955b62a521be56a9e1668ce9e6081ce364e57a8137a4dd466dfe087d2
7
+ data.tar.gz: 609c0a2137bf2f0517e362cbe8771ac4c7f4fef211b200c51621b7af2555a67b71e76967b1c45bf59c3c6c8639b6f255d13cfff341cbb048e83d885d7a8cecca
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.3.2 - 2024-05-04
4
+
5
+ * Improved Debug panel (to be in par with Queries panel) - See [#36](https://github.com/julienbourdeau/debugbar/pull/36)
6
+ * Better SQL dialect detection - See [c40e2405](https://github.com/julienbourdeau/debugbar/commit/c40e240524308c7ecf09fecbb548e97c2ef4e8b7)
7
+ * Add timings to SQL queries 🎨 - See [ebf8edcd](https://github.com/julienbourdeau/debugbar/commit/ebf8edcd8598a4a7b490a774a7374d51a3efc6b8)
8
+
3
9
  ## v0.3.1 - 2024-05-01
4
10
 
5
11
  * Add `active_record.adapter` config to help frontend format SQL queries - See [#35](https://github.com/julienbourdeau/debugbar/pull/35)
@@ -40,8 +40,8 @@ module Debugbar
40
40
  @jobs << job
41
41
  end
42
42
 
43
- def add_msg(msg, extra)
44
- @messages << {msg: msg, extra: extra}
43
+ def add_msg(msg, extra, source)
44
+ @messages << {id: SecureRandom.hex(8), msg: msg, extra: extra, source: source}
45
45
  end
46
46
 
47
47
  def add_cache(c)
@@ -36,12 +36,13 @@ module Debugbar
36
36
  duration: event.duration.round(1),
37
37
  lock_wait: payload[:lock_wait]&.round(1),
38
38
  binds: binds,
39
- source: query_source_location&.split(":in"),
39
+ source: query_source_location
40
40
  })
41
41
  end
42
42
 
43
43
  def query_source_location
44
- backtrace_cleaner.clean(caller(3))[0]
44
+ str = backtrace_cleaner.clean(caller(3))[0]
45
+ str&.split(":in")&.map { |s| s.delete_prefix("#{Rails.root}/").strip.tr("`'", '' ) } # Duplicated in Debugbar.msg
45
46
  end
46
47
  end
47
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Debugbar
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
data/lib/debugbar.rb CHANGED
@@ -47,12 +47,12 @@ module Debugbar
47
47
  end
48
48
  end
49
49
 
50
- def msg(msg, *extra)
50
+ def msg(msg, extra, source)
51
51
  if Current.request.nil?
52
52
  puts "The current request is not set yet. Printing to STDOUT instead."
53
- puts msg, extra
53
+ puts msg, extra, source
54
54
  else
55
- Current.request.add_msg(msg, extra)
55
+ Current.request.add_msg(msg, extra, source)
56
56
  end
57
57
  end
58
58
  end
@@ -82,7 +82,8 @@ module Debugbar
82
82
  end
83
83
 
84
84
  def msg(msg, *extra)
85
- Tracker.msg(msg, *extra)
85
+ source = caller.first&.split(":in")&.map { |s| s.delete_prefix("#{Rails.root}/").strip.tr("`'", '' ) }
86
+ Tracker.msg(msg, extra, source)
86
87
  end
87
88
  end
88
89
  end