dev_toolbar 1.2.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c3346cbc6911631a8ab5f783fd8c3f1cce6aee3ff8347f8f733327fc2cdf2f5
4
- data.tar.gz: dc5718868ec6d26a22f4c6c1dae9cbd7981afb3ea96b20f309b86f54106fd253
3
+ metadata.gz: 6a18b06fb4ebca9df093fe77b0fc00d329965a63016d5b96b7f1e014345d6e51
4
+ data.tar.gz: 7d61f7d42ce4bfba5c5739fd869d4fcbe9799fcf18f013d1d203a10450169ab5
5
5
  SHA512:
6
- metadata.gz: e9248fce47ce7b823952f317c51634012df65d95e05f62f897c06771a969e2b374f4fcc8f337e7f5bacce69868976b44af561abff46086da1ead1e946ef50f36
7
- data.tar.gz: 858c55b8fab494d9a6d60f928d28bdc3eb0bb44f51888ea25edde8af8a88631f1abbad6088b1932111d3e5b8474f7cd1a1998d822616d21a148004461a5ed8a9
6
+ metadata.gz: 17c4d7b47ed6688e0c16af6bf5987bae26519d7705170adc265e8891449ef8b716f0dd81a9029ce7d32b138b59d5f08a9b489f001b88a96aabfe8841677713e6
7
+ data.tar.gz: b4f95df36dbbceb5423713ac190a52fa332de5343ada45a4cc7e7cc2350cd23e4edd7b357c134a187a03529534715c90460ea723ffa9e5c646f79b8669042232
@@ -0,0 +1,10 @@
1
+ module DevToolbar
2
+ class ErdController < ActionController::Base
3
+ layout false
4
+
5
+ def show
6
+ @erd_path = Rails.root.join("erd.png")
7
+ render :show
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,40 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Entity Relationship Diagram</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+
7
+ <style>
8
+ body {
9
+ width: 95%;
10
+ max-width: 33em;
11
+ margin: 4em auto 0;
12
+ text-align: center;
13
+ font-family: arial, sans-serif;
14
+ line-height: 1.5em;
15
+ color: #808080;
16
+ }
17
+
18
+ img {
19
+ max-width: 100%;
20
+ height: auto;
21
+ }
22
+ </style>
23
+ </head>
24
+
25
+ <body>
26
+ <h1>Entity Relationship Diagram</h1>
27
+ <p>To update this diagram after changes to your database or models (e.g. adding association accessors), open a terminal and run the command:</p>
28
+ <div>
29
+ <code>rake erd</code>
30
+ </div>
31
+ <p>Then refresh this page.</p>
32
+ <div>
33
+ <% if File.exist?(@erd_path) %>
34
+ <img src="data:image/png;base64,<%= Base64.strict_encode64(File.read(@erd_path)) %>" alt="Entity Relationship Diagram">
35
+ <% else %>
36
+ <p>Entity Relationship Diagram not found. If this project has a database, you can generate the ERD with the command above.</p>
37
+ <% end %>
38
+ </div>
39
+ </body>
40
+ </html>
@@ -0,0 +1,14 @@
1
+ module DevToolbar
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace DevToolbar
4
+
5
+ config.autoload_paths << File.expand_path("../app/controllers", __FILE__)
6
+ config.paths["app/views"] << File.expand_path("../app/views", __FILE__)
7
+
8
+ initializer "dev_toolbar.add_routes", after: :add_routing_paths do |app|
9
+ app.routes.append do
10
+ get "/erd", to: "dev_toolbar/erd#show"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -82,7 +82,7 @@ module DevToolbar
82
82
  def toolbar_links
83
83
  DevToolbar.configuration.links.map do |link|
84
84
  # if the erd.png file does not exist in /public, don't show the link
85
- if link[:name] == "Data Model" && !File.exist?(Rails.public_path.join("erd.png"))
85
+ if link[:name] == "ERD" && !File.exist?(Rails.root.join("erd.png"))
86
86
  next
87
87
  else
88
88
  "<a href='#{link[:path]}' target='_blank' class='dev-toolbar-link'>#{link[:name]}</a>"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DevToolbar
4
- VERSION = "1.2.0"
4
+ VERSION = "2.1.0"
5
5
  end
data/lib/dev_toolbar.rb CHANGED
@@ -4,6 +4,7 @@ require_relative "dev_toolbar/version"
4
4
  require_relative "dev_toolbar/railtie"
5
5
  require_relative "dev_toolbar/middleware"
6
6
  require_relative "dev_toolbar/configuration"
7
+ require_relative "dev_toolbar/engine"
7
8
 
8
9
  module DevToolbar
9
10
  class Error < StandardError; end
metadata CHANGED
@@ -1,27 +1,26 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_toolbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Purinton
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-10-21 00:00:00.000000000 Z
10
+ date: 2025-07-04 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
16
+ - - ">="
18
17
  - !ruby/object:Gem::Version
19
18
  version: '7.0'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - "~>"
23
+ - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '7.0'
27
26
  - !ruby/object:Gem::Dependency
@@ -60,7 +59,10 @@ extensions: []
60
59
  extra_rdoc_files: []
61
60
  files:
62
61
  - lib/dev_toolbar.rb
62
+ - lib/dev_toolbar/app/controllers/dev_toolbar/erd_controller.rb
63
+ - lib/dev_toolbar/app/views/dev_toolbar/erd/show.html.erb
63
64
  - lib/dev_toolbar/configuration.rb
65
+ - lib/dev_toolbar/engine.rb
64
66
  - lib/dev_toolbar/middleware.rb
65
67
  - lib/dev_toolbar/railtie.rb
66
68
  - lib/dev_toolbar/version.rb
@@ -70,7 +72,6 @@ licenses:
70
72
  metadata:
71
73
  homepage_uri: https://github.com/firstdraft
72
74
  source_code_uri: https://github.com/firstdraft/dev_toolbar
73
- post_install_message:
74
75
  rdoc_options: []
75
76
  require_paths:
76
77
  - lib
@@ -85,8 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
86
  - !ruby/object:Gem::Version
86
87
  version: '0'
87
88
  requirements: []
88
- rubygems_version: 3.4.6
89
- signing_key:
89
+ rubygems_version: 3.6.5
90
90
  specification_version: 4
91
91
  summary: A development toolbar for Rails applications.
92
92
  test_files: []