debugbar 0.4.0 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -3
- data/app/helpers/debugbar/tag_helpers.rb +4 -2
- data/build_fixtures.rb +3 -2
- data/lib/debugbar/engine.rb +26 -3
- data/lib/debugbar/http/http.rb +2 -0
- data/lib/debugbar/middlewares/track_current_request.rb +2 -4
- data/lib/debugbar/version.rb +1 -1
- data/public/debugbar.js +16 -16
- data/release.sh +70 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc75f60be93ef95e8b51a8dcb4a7682c801fef9ba4790828a26f8ec8c4c37f63
|
4
|
+
data.tar.gz: 7ef69e8c41cf2dddb68ad2d6e5ac2b2e8d4702ab9d97d89363d6f38b0fbae8ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d6e2fbef45e447717b91e9e92c53884e15684bd8fdfa9363b99f4ea35da766dc9b82b71340b61063832e5149ff7564c0cafd4dddfee52b74fe93805516a87e1
|
7
|
+
data.tar.gz: e35d17f833d1566a4c87b3a875ed496751622fd078386e10474eb09dbe739a193d67c481255813c3b3551b269935b08c0095ba0a37e8b2e709c28f90dfb2fb06
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,23 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## v0.4.2 - 2025-01-11
|
4
4
|
|
5
|
-
*
|
5
|
+
* Mount `Debugbar::Engine` automatically from the gem to simplify setup - See [#51](https://github.com/julienbourdeau/debugbar/pull/51)
|
6
|
+
* Fix error if ActiveCable is not available - See [#53](https://github.com/julienbourdeau/debugbar/pull/53)
|
6
7
|
|
8
|
+
### Attention needed
|
9
|
+
|
10
|
+
It's not breaking (yet) but if you have the following block in your `config/routes.rb`, please remove it!
|
11
|
+
|
12
|
+
```diff
|
13
|
+
- if defined? Debugbar
|
14
|
+
- mount Debugbar::Engine => Debugbar.config.prefix
|
15
|
+
- end
|
16
|
+
```
|
17
|
+
|
18
|
+
## v0.4.1 - 2025-01-07
|
19
|
+
|
20
|
+
* Small fix when response is not set ([2227f4d7](https://github.com/julienbourdeau/debugbar/commit/2227f4d7e5d97ddb4b55cabd779d2bf46f9edf33))
|
7
21
|
|
8
22
|
## v0.4.0 - 2025-01-07
|
9
23
|
|
@@ -42,7 +56,7 @@
|
|
42
56
|
In order to support Turbo Drive, I had to split the helper into two parts. Before the JavaScript file was loaded,
|
43
57
|
directly in the body, but it has to be loaded in the head now.
|
44
58
|
|
45
|
-
If you were passing
|
59
|
+
If you were passing configuration t `debugbar_javascript`, you must now pass it to `debugbar_body`.
|
46
60
|
|
47
61
|
```diff
|
48
62
|
<!DOCTYPE html>
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Debugbar::TagHelpers
|
2
2
|
def debugbar_head
|
3
|
-
|
3
|
+
html = <<-HTML
|
4
4
|
<script defer src="#{Debugbar.config.prefix}/assets/script"></script>
|
5
5
|
HTML
|
6
|
+
|
7
|
+
Debugbar.config.enabled? ? raw(html) : ""
|
6
8
|
end
|
7
9
|
|
8
10
|
def debugbar_body(opt = {})
|
@@ -27,7 +29,7 @@ module Debugbar::TagHelpers
|
|
27
29
|
</script>
|
28
30
|
HTML
|
29
31
|
|
30
|
-
raw
|
32
|
+
Debugbar.config.enabled? ? raw(html) : ""
|
31
33
|
end
|
32
34
|
|
33
35
|
def debugbar_javascript(opt = {})
|
data/build_fixtures.rb
CHANGED
@@ -25,7 +25,8 @@ Net::HTTP.start('127.0.0.1', 3000) do |http|
|
|
25
25
|
response = http.request Net::HTTP::Get.new('/_debugbar/poll')
|
26
26
|
data = JSON.parse(response.body)
|
27
27
|
data.each_with_index do |item, idx|
|
28
|
-
|
29
|
-
|
28
|
+
filename = ("%03d" % (idx +1)) + '-' + item['meta']['controller'] + '-' + item['meta']['action'] + '.json'
|
29
|
+
puts "Writing #{filename}"
|
30
|
+
File.write("#{fixtures_dir}/#{filename}", JSON.pretty_generate(item))
|
30
31
|
end
|
31
32
|
end
|
data/lib/debugbar/engine.rb
CHANGED
@@ -17,9 +17,11 @@ module Debugbar
|
|
17
17
|
end
|
18
18
|
|
19
19
|
initializer 'debugbar.override_config' do |app|
|
20
|
-
|
21
|
-
app.config.action_cable.disable_request_forgery_protection
|
22
|
-
|
20
|
+
if defined? ActionCable
|
21
|
+
unless app.config.action_cable.disable_request_forgery_protection
|
22
|
+
app.config.action_cable.disable_request_forgery_protection = true
|
23
|
+
log "Debugbar: Action Cable request forgery protection is enabled. This can cause issues with Debugbar. Overriding setting config.action_cable.disable_request_forgery_protection = true now. Update your configuration to get rid of this message."
|
24
|
+
end
|
23
25
|
end
|
24
26
|
|
25
27
|
if defined? HttpLog
|
@@ -84,6 +86,27 @@ module Debugbar
|
|
84
86
|
Debugbar::RequestBuffer.init(adapter)
|
85
87
|
end
|
86
88
|
|
89
|
+
initializer "debugbar.append_routes" do |app|
|
90
|
+
# Before 0.5.0, I asked people to mount the engine manually
|
91
|
+
# This will probably throw an error at some point to be ultimately removed
|
92
|
+
app.routes.append do
|
93
|
+
already_mounted = app.routes.routes.any? do |route|
|
94
|
+
route&.app&.app == ::Debugbar::Engine
|
95
|
+
end
|
96
|
+
|
97
|
+
if already_mounted
|
98
|
+
logger = Logger.new(STDOUT)
|
99
|
+
logger.warn 'Debugbar: The Debugbar engine is manually mounted in your `config/routes.rb`. The engine is now mounted automatically by the gem. Remove "mount Debugbar::Engine => Debugbar.config.prefix" from your routes to get rid of this message.'
|
100
|
+
|
101
|
+
unless Debugbar.config.enabled?
|
102
|
+
logger.warn "Debugbar: The Debugbar is disabled but the routes are loaded because the Debugbar::Engine is mounted manually in your `config/routes.rb`. It's recommended not to mount the engine manually since Debugbar 0.5.0"
|
103
|
+
end
|
104
|
+
else
|
105
|
+
mount Debugbar::Engine => Debugbar.config.prefix
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
87
110
|
initializer 'debugbar.helper' do
|
88
111
|
ActiveSupport.on_load(:action_controller) do
|
89
112
|
ActionController::Base.helper(Debugbar::TagHelpers)
|
data/lib/debugbar/http/http.rb
CHANGED
@@ -14,7 +14,7 @@ module Debugbar
|
|
14
14
|
|
15
15
|
Debugbar::Current.new_request!(SecureRandom.uuid)
|
16
16
|
|
17
|
-
|
17
|
+
res = @app.call(env)
|
18
18
|
|
19
19
|
# TODO: Remove this if statement?
|
20
20
|
# We check meta because the frontend doesn't support request without meta yet.
|
@@ -29,9 +29,7 @@ module Debugbar
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
[status, headers, body]
|
32
|
+
res
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
data/lib/debugbar/version.rb
CHANGED