query_diet 0.7.2 → 0.7.3
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 +4 -4
- data/README.md +33 -5
- data/lib/query_diet/active_record_ext.rb +1 -1
- data/lib/query_diet/benchmark.rb +11 -0
- data/lib/query_diet/logger.rb +1 -1
- data/lib/query_diet/version.rb +1 -1
- data/lib/query_diet/widget/helper.rb +19 -0
- data/lib/query_diet/widget.rb +1 -15
- data/lib/query_diet.rb +1 -0
- metadata +11 -7
- data/MIT-LICENSE +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e0dcbe12b6aeaf62fea07ee16bf3856aa09d849dcee601bd9d66611939d11384
|
|
4
|
+
data.tar.gz: 00bd178162c5eb27e9928a72c9e242112e0a6db411cb79c8e38d5fd4861060ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1fb3c23580b461f2e9f999bd1ae5bc8a68b0c2b0230136f93f01b2779d443664adb34e24fdcd56a4e01030154aa4d068ff8c0ce82fe61cb3bf2de83018762cf9
|
|
7
|
+
data.tar.gz: 7a4a4840f4798129c983e00729d68d000d050a787ea763a122269eb93f677cf905d45e3fbc521dae4e69aa4562f2fe8a8e04dabfe984d2e0e424a409d418f7df
|
data/README.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
<p>
|
|
2
|
+
<a href="https://makandra.de/">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="media/makandra-with-bottom-margin.light.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: dark)" srcset="media/makandra-with-bottom-margin.dark.svg">
|
|
6
|
+
<img align="right" width="25%" alt="makandra" src="media/makandra-with-bottom-margin.light.svg">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
|
|
10
|
+
<picture>
|
|
11
|
+
<source media="(prefers-color-scheme: light)" srcset="media/logo.light.shapes.svg">
|
|
12
|
+
<source media="(prefers-color-scheme: dark)" srcset="media/logo.dark.shapes.svg">
|
|
13
|
+
<img width="215" alt="Query Diet" role="heading" aria-level="1" src="media/logo.light.shapes.svg">
|
|
14
|
+
</picture>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
[](https://github.com/makandra/query_diet/actions)
|
|
18
|
+
|
|
3
19
|
|
|
4
20
|
Query Diet counts the number of database queries for the last request and *subtly* displays it in the upper right corner of your screen.
|
|
5
21
|
The display turns red if too many queries are run, or if they take too long.
|
|
@@ -7,11 +23,11 @@ This is useful to prevent [N + 1 queries](http://guides.rubyonrails.org/active_r
|
|
|
7
23
|
|
|
8
24
|
This is Query Diet being happy about 3 requests taking 66ms:
|
|
9
25
|
|
|
10
|
-

|
|
11
27
|
|
|
12
28
|
This is Query Diet being angry about 103 requests taking 164ms:
|
|
13
29
|
|
|
14
|
-

|
|
15
31
|
|
|
16
32
|
|
|
17
33
|
Installation
|
|
@@ -67,7 +83,19 @@ Rails.application.config.content_security_policy do |policy|
|
|
|
67
83
|
|
|
68
84
|
### Rails compatibility
|
|
69
85
|
|
|
70
|
-
The gem is tested
|
|
86
|
+
The gem is tested against
|
|
87
|
+
|
|
88
|
+
| Versions | Ruby 2.7.8 | Ruby 3.0.0 | Ruby 3.1.6 | Ruby 3.3.4 | Ruby 3.4.4 |
|
|
89
|
+
|-----------|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|
|
|
90
|
+
| Rails 6.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
|
|
91
|
+
| Rails 7.0 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |
|
|
92
|
+
| Rails 7.1 | :x: | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: |
|
|
93
|
+
| Rails 7.2 | :x: | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: |
|
|
94
|
+
| Rails 8.0 | :x: | :x: | :x: | :heavy_check_mark: | :x: |
|
|
95
|
+
| Rails 8.1 | :x: | :x: | :x: | :heavy_check_mark: | :heavy_check_mark: |
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
Later versions might work, earlier will not.
|
|
71
99
|
|
|
72
100
|
For Rails 2.3 and Ruby 1.8.7 support, use a version < 0.6.
|
|
73
101
|
|
data/lib/query_diet/logger.rb
CHANGED
data/lib/query_diet/version.rb
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module QueryDiet
|
|
2
|
+
module Widget
|
|
3
|
+
module Helper
|
|
4
|
+
|
|
5
|
+
def query_diet_widget(options = {})
|
|
6
|
+
default_html_options = {:nonce => false}
|
|
7
|
+
options = options.reverse_merge(default_html_options)
|
|
8
|
+
|
|
9
|
+
nonce_attribute = options.fetch(:nonce) ? " nonce=\"#{content_security_policy_nonce}\"" : ''
|
|
10
|
+
|
|
11
|
+
html = Widget.css(nonce_attribute) + Widget.html(options) + Widget.js(nonce_attribute)
|
|
12
|
+
html.respond_to?(:html_safe) ? html.html_safe : html
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
ActionView::Base.send :include, QueryDiet::Widget::Helper
|
data/lib/query_diet/widget.rb
CHANGED
|
@@ -50,21 +50,7 @@ module QueryDiet
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
end
|
|
53
|
-
|
|
54
|
-
module Helper
|
|
55
|
-
def query_diet_widget(options = {})
|
|
56
|
-
default_html_options = {:nonce => false}
|
|
57
|
-
options = options.reverse_merge(default_html_options)
|
|
58
|
-
|
|
59
|
-
nonce_attribute = options.fetch(:nonce) ? " nonce=\"#{content_security_policy_nonce}\"" : ''
|
|
60
|
-
|
|
61
|
-
html = Widget.css(nonce_attribute) + Widget.html(options) + Widget.js(nonce_attribute)
|
|
62
|
-
html.respond_to?(:html_safe) ? html.html_safe : html
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
53
|
end
|
|
67
|
-
|
|
68
54
|
end
|
|
69
55
|
|
|
70
|
-
|
|
56
|
+
require 'query_diet/widget/helper'
|
data/lib/query_diet.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: query_diet
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Henning Koch
|
|
8
8
|
- Tobias Kraze
|
|
9
|
-
autorequire:
|
|
9
|
+
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2025-10-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: Rails database query counter that stays out of your way
|
|
15
15
|
email: github@makandra.de
|
|
@@ -17,20 +17,24 @@ executables: []
|
|
|
17
17
|
extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
|
19
19
|
files:
|
|
20
|
-
- MIT-LICENSE
|
|
21
20
|
- README.md
|
|
22
21
|
- lib/query_diet.rb
|
|
23
22
|
- lib/query_diet/active_record_ext.rb
|
|
23
|
+
- lib/query_diet/benchmark.rb
|
|
24
24
|
- lib/query_diet/logger.rb
|
|
25
25
|
- lib/query_diet/rack/reset_logger.rb
|
|
26
26
|
- lib/query_diet/version.rb
|
|
27
27
|
- lib/query_diet/widget.rb
|
|
28
|
+
- lib/query_diet/widget/helper.rb
|
|
28
29
|
homepage: https://github.com/makandra/query_diet
|
|
29
30
|
licenses:
|
|
30
31
|
- MIT
|
|
31
32
|
metadata:
|
|
33
|
+
source_code_uri: https://github.com/makandra/query_diet
|
|
34
|
+
bug_tracker_uri: https://github.com/makandra/query_diet/issues
|
|
35
|
+
changelog_uri: https://github.com/makandra/query_diet/blob/master/CHANGELOG.md
|
|
32
36
|
rubygems_mfa_required: 'true'
|
|
33
|
-
post_install_message:
|
|
37
|
+
post_install_message:
|
|
34
38
|
rdoc_options: []
|
|
35
39
|
require_paths:
|
|
36
40
|
- lib
|
|
@@ -45,8 +49,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
45
49
|
- !ruby/object:Gem::Version
|
|
46
50
|
version: '0'
|
|
47
51
|
requirements: []
|
|
48
|
-
rubygems_version: 3.5.
|
|
49
|
-
signing_key:
|
|
52
|
+
rubygems_version: 3.5.22
|
|
53
|
+
signing_key:
|
|
50
54
|
specification_version: 4
|
|
51
55
|
summary: Rails database query counter that stays out of your way
|
|
52
56
|
test_files: []
|
data/MIT-LICENSE
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2009 Henning Koch
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
-
a copy of this software and associated documentation files (the
|
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
-
the following conditions:
|
|
10
|
-
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
|
12
|
-
included in all copies or substantial portions of the Software.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|