debugbar 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.prettierrc +6 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +5 -0
  5. data/Rakefile +4 -0
  6. data/app/channels/debugbar/debugbar_channel.rb +26 -0
  7. data/app/controllers/debugbar/application_controller.rb +4 -0
  8. data/app/controllers/debugbar/assets_controller.rb +15 -0
  9. data/app/helpers/debugbar/tag_helpers.rb +19 -0
  10. data/app/models/debugbar/application_record.rb +5 -0
  11. data/client/.gitignore +25 -0
  12. data/client/README.md +0 -0
  13. data/client/dist/.vite/manifest.json +14 -0
  14. data/client/dist/assets/debugbar-u5mP-5-z.js +34 -0
  15. data/client/dist/assets/ruby-logo-kn_8RniZ.svg +946 -0
  16. data/client/index.html +78 -0
  17. data/client/package-lock.json +2393 -0
  18. data/client/package.json +32 -0
  19. data/client/postcss.config.js +6 -0
  20. data/client/src/App.vue +17 -0
  21. data/client/src/AppDemo.vue +29 -0
  22. data/client/src/AppDev.vue +20 -0
  23. data/client/src/Debugbar.vue +276 -0
  24. data/client/src/assets/rails-logo.svg +1 -0
  25. data/client/src/assets/ruby-logo.svg +946 -0
  26. data/client/src/components/TabButton.vue +32 -0
  27. data/client/src/components/panels/CachePanel.vue +41 -0
  28. data/client/src/components/panels/JobsPanel.vue +52 -0
  29. data/client/src/components/panels/JsonPanel.vue +15 -0
  30. data/client/src/components/panels/LogsPanel.vue +43 -0
  31. data/client/src/components/panels/MessagesPanel.vue +25 -0
  32. data/client/src/components/panels/ModelsPanel.vue +37 -0
  33. data/client/src/components/panels/Panel.vue +7 -0
  34. data/client/src/components/panels/RequestPanel.vue +98 -0
  35. data/client/src/components/queries/QueriesPanel.vue +17 -0
  36. data/client/src/components/queries/QueryItem.vue +65 -0
  37. data/client/src/components/ui/Foldable.vue +39 -0
  38. data/client/src/components/ui/KeyValueTable.vue +16 -0
  39. data/client/src/components/ui/Row.vue +14 -0
  40. data/client/src/components/ui/logo-ruby.vue +547 -0
  41. data/client/src/demo.ts +17 -0
  42. data/client/src/dev.ts +20 -0
  43. data/client/src/main.ts +17 -0
  44. data/client/src/models/Config.ts +27 -0
  45. data/client/src/models/Request.ts +183 -0
  46. data/client/src/stores/RequestsStore.ts +36 -0
  47. data/client/src/stores/configStore.ts +8 -0
  48. data/client/src/style.css +23 -0
  49. data/client/src/types.d.ts +9 -0
  50. data/client/src/vite-env.d.ts +1 -0
  51. data/client/tailwind.config.js +16 -0
  52. data/client/tsconfig.json +29 -0
  53. data/client/tsconfig.node.json +10 -0
  54. data/client/vite.config.ts +44 -0
  55. data/config/routes.rb +7 -0
  56. data/debugbar.gemspec +38 -0
  57. data/fixtures/requests/1706607114--demo_post_list.json +499 -0
  58. data/fixtures/requests/1706607120--api_jobs.json +176 -0
  59. data/fixtures/requests/1706607123--api_jobs.json +119 -0
  60. data/fixtures/requests/1706607133--demo_slow_page.json +130 -0
  61. data/fixtures/requests/1706607136--demo_post.json +164 -0
  62. data/fixtures/requests/1706607136--demo_random_post.json +106 -0
  63. data/fixtures/requests/1706607141--api_errors.json +73 -0
  64. data/lib/debugbar/buffers/memory_buffer.rb +34 -0
  65. data/lib/debugbar/buffers/null_buffer.rb +18 -0
  66. data/lib/debugbar/buffers/request_buffer.rb +31 -0
  67. data/lib/debugbar/config.rb +50 -0
  68. data/lib/debugbar/current.rb +18 -0
  69. data/lib/debugbar/engine.rb +96 -5
  70. data/lib/debugbar/loggers/simple_logger.rb +34 -0
  71. data/lib/debugbar/middlewares/track_current_request.rb +35 -0
  72. data/lib/debugbar/request.rb +98 -0
  73. data/lib/debugbar/subscribers/action_controller.rb +33 -0
  74. data/lib/debugbar/subscribers/active_job.rb +158 -0
  75. data/lib/debugbar/subscribers/active_record.rb +65 -0
  76. data/lib/debugbar/subscribers/active_support.rb +30 -0
  77. data/lib/debugbar/version.rb +5 -0
  78. data/lib/debugbar.rb +86 -5
  79. data/package-lock.json +50 -0
  80. data/package.json +5 -0
  81. data/sig/debugbar.rbs +4 -0
  82. metadata +143 -47
  83. data/README.textile +0 -18
  84. data/lib/debugbar/railties/tasks.rake +0 -1
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ce9e037dfdc60939b85dc13fa9f4361cbbb8de8c7269461fecc722eb9e84ac12
4
+ data.tar.gz: e7c609a43130829a4cbdc35b9b2735c3ed4da5430085036b96892860a7647641
5
+ SHA512:
6
+ metadata.gz: 7c523067bb97bef7778d79b1f2aa31fc5ef3cbed4f632f21113fdb18edfe27b156633d9ca25943d5d387814c442e7c1c38b963fb85428fd852b57bb6f5a139e3
7
+ data.tar.gz: ffed0ea44e41025455732edde026d1319fe30b0c4b5603dc4c019171105f53419ca623f0629d0f08ee3125cf14256ef7a9ff77147b35dff00dc51bba3a4f4819
data/.prettierrc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "trailingComma": "es5",
3
+ "tabWidth": 2,
4
+ "printWidth": 120,
5
+ "semi": false
6
+ }
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Julien Bourdeau
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # Debugbar for Rails
2
+
3
+ Find all documentation on [debugbar.dev](https://debugbar.dev/)
4
+
5
+ [![debugbar screesnhot](https://debugbar.dev/assets/screenshots/home.png)](https://debugbar.dev/docs/)
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,26 @@
1
+ module Debugbar
2
+ class DebugbarChannel < ActionCable::Channel::Base
3
+ def subscribed
4
+ stream_from "debugbar_channel"
5
+ end
6
+
7
+ def receive(data)
8
+ if data["clear"]
9
+ RequestBuffer.clear!
10
+ end
11
+
12
+ if data["ids"].present?
13
+ RequestBuffer.remove(data["ids"])
14
+ end
15
+
16
+ Debugbar.connect!
17
+
18
+ data = RequestBuffer.all.map(&:to_h)
19
+ ActionCable.server.broadcast("debugbar_channel", data)
20
+ end
21
+
22
+ def unsubscribed
23
+ Debugbar.disconnect!
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,4 @@
1
+ module Debugbar
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,15 @@
1
+ module Debugbar
2
+ class AssetsController < ApplicationController
3
+ def js
4
+ render file: Debugbar.js_file,
5
+ layout: false,
6
+ content_type: 'text/javascript'
7
+ end
8
+
9
+ private
10
+
11
+ def verify_same_origin_request
12
+ true # YOLO
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module Debugbar::TagHelpers
2
+ def debugbar_javascript(opt = {})
3
+ html = <<-HTML
4
+ <div id="__debugbar"></div>
5
+ HTML
6
+
7
+ html += <<-HTML
8
+ <script type="text/javascript">
9
+ window._debugbarConfigOptions = #{opt.to_json}
10
+ </script>
11
+ HTML
12
+
13
+ html += <<-HTML
14
+ <script defer src="#{Debugbar.config.prefix}/assets/script"></script>
15
+ HTML
16
+
17
+ raw html
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module Debugbar
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
data/client/.gitignore ADDED
@@ -0,0 +1,25 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ #dist
12
+ dist-demo
13
+ dist-ssr
14
+ *.local
15
+
16
+ # Editor directories and files
17
+ .vscode/*
18
+ !.vscode/extensions.json
19
+ .idea
20
+ .DS_Store
21
+ *.suo
22
+ *.ntvs*
23
+ *.njsproj
24
+ *.sln
25
+ *.sw?
data/client/README.md ADDED
File without changes
@@ -0,0 +1,14 @@
1
+ {
2
+ "src/assets/ruby-logo.svg": {
3
+ "file": "assets/ruby-logo-kn_8RniZ.svg",
4
+ "src": "src/assets/ruby-logo.svg"
5
+ },
6
+ "src/main.ts": {
7
+ "assets": [
8
+ "assets/ruby-logo-kn_8RniZ.svg"
9
+ ],
10
+ "file": "assets/debugbar-u5mP-5-z.js",
11
+ "isEntry": true,
12
+ "src": "src/main.ts"
13
+ }
14
+ }