dev_toolbar 1.1.0 → 2.0.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 +4 -4
- data/lib/dev_toolbar/app/controllers/dev_toolbar/erd_controller.rb +10 -0
- data/lib/dev_toolbar/app/views/dev_toolbar/erd/show.html.erb +40 -0
- data/lib/dev_toolbar/engine.rb +14 -0
- data/lib/dev_toolbar/middleware.rb +7 -2
- data/lib/dev_toolbar/version.rb +1 -1
- data/lib/dev_toolbar.rb +1 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a7c9be1b47e2a68f0571b7a9f0bcc808eb8d0d48669f866112c03c7eb2a1283
|
4
|
+
data.tar.gz: 0b16561e3b9c74b77d4a1ced86fb5e8599e5bb735dd70647d227a66b59f4c3ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87e7710e2564db6cf007098623f335d21ffdf904bd3653223cd33d0ceb28320aee601e1a2560972cf6dad0d82bfb5d3139eced7bc1f27711152ec345812ffced
|
7
|
+
data.tar.gz: a8dea90ceab903d1432f6d35b8af9504b32ead4cba856a76c1d9cf7765d441c4e09a86508e47e94963048e6a8fdb1d76c87afaea30a8d5c88e175d14251d7a27
|
@@ -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
|
@@ -81,8 +81,13 @@ module DevToolbar
|
|
81
81
|
|
82
82
|
def toolbar_links
|
83
83
|
DevToolbar.configuration.links.map do |link|
|
84
|
-
|
85
|
-
|
84
|
+
# if the erd.png file does not exist in /public, don't show the link
|
85
|
+
if link[:name] == "ERD" && !File.exist?(Rails.root.join("erd.png"))
|
86
|
+
next
|
87
|
+
else
|
88
|
+
"<a href='#{link[:path]}' target='_blank' class='dev-toolbar-link'>#{link[:name]}</a>"
|
89
|
+
end
|
90
|
+
end.compact.join(" ")
|
86
91
|
end
|
87
92
|
end
|
88
93
|
end
|
data/lib/dev_toolbar/version.rb
CHANGED
data/lib/dev_toolbar.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dev_toolbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Purinton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -60,7 +60,10 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- lib/dev_toolbar.rb
|
63
|
+
- lib/dev_toolbar/app/controllers/dev_toolbar/erd_controller.rb
|
64
|
+
- lib/dev_toolbar/app/views/dev_toolbar/erd/show.html.erb
|
63
65
|
- lib/dev_toolbar/configuration.rb
|
66
|
+
- lib/dev_toolbar/engine.rb
|
64
67
|
- lib/dev_toolbar/middleware.rb
|
65
68
|
- lib/dev_toolbar/railtie.rb
|
66
69
|
- lib/dev_toolbar/version.rb
|