draw_erd 0.1.0 → 0.1.1
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/.gitignore +2 -1
- data/README.md +1 -1
- data/app/controllers/draw_erd/diagram_controller.rb +2 -2
- data/app/models/draw_erd/diagram.rb +15 -2
- data/app/views/draw_erd/diagram/index.html.erb +3 -3
- data/lib/draw_erd/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 361694cfa9e1723292cd4da1979dc995d4f602a5
|
|
4
|
+
data.tar.gz: a87facd4851fd70f3e0e3b5fa1ddec6cbcdc56e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b7647034cce2f4234a18df184423ce64b2a1fa38caa9aa6a1d624c81553cefc7b95626650bef11eb9c672a5c1568d8589bebfe11a98ccc44c3b22cf703c9215b
|
|
7
|
+
data.tar.gz: 8715022cdd5937caf9963525f0a5dc521721dd3b3e448a6a1b8c933ba6f5ffc274c5da0826b4286fb8b4580ce09d6f7c85cdd7bc91ec1532046a0d4c6ee9d17d
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
module DrawErd
|
|
2
2
|
class DiagramController < ::DrawErd::ApplicationController
|
|
3
3
|
def index
|
|
4
|
+
@schemas = DrawErd::Diagram.schemas
|
|
5
|
+
|
|
4
6
|
title = 'erd'
|
|
5
7
|
path = 'draw-erd'
|
|
6
8
|
@image_file = File.join(path, "#{title}.png")
|
|
@@ -10,8 +12,6 @@ module DrawErd
|
|
|
10
12
|
|
|
11
13
|
diagram = DrawErd::Diagram.new(File.join('public', 'images', path))
|
|
12
14
|
diagram.create(title, @domains)
|
|
13
|
-
|
|
14
|
-
@schemas = DrawErd::Diagram.schemas
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -9,6 +9,19 @@ module DrawErd
|
|
|
9
9
|
schemas.map! {|schema| schema.singularize.camelize}
|
|
10
10
|
schemas.sort
|
|
11
11
|
end
|
|
12
|
+
|
|
13
|
+
def reset_migrations
|
|
14
|
+
paths = ActiveRecord::Migrator.migrations_paths
|
|
15
|
+
paths.each do |path|
|
|
16
|
+
Dir.foreach(path) do |file|
|
|
17
|
+
if match_data = /^(\d{3,})_(.+)\.rb$/.match(file)
|
|
18
|
+
version = match_data[1].to_i
|
|
19
|
+
ActiveRecord::Migrator.run(:down, paths, version)
|
|
20
|
+
ActiveRecord::Migrator.run(:up, paths, version)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
12
25
|
end
|
|
13
26
|
|
|
14
27
|
def initialize(path)
|
|
@@ -16,11 +29,11 @@ module DrawErd
|
|
|
16
29
|
FileUtils.mkdir_p(@path)
|
|
17
30
|
end
|
|
18
31
|
|
|
19
|
-
def create(title, domains=[])
|
|
32
|
+
def create(title, domains=[], attributes=[:foreign_keys, :content])
|
|
20
33
|
only = domains.map {|domain| domain.to_sym}
|
|
21
34
|
options = {
|
|
22
35
|
filetype: :png,
|
|
23
|
-
attributes:
|
|
36
|
+
attributes: attributes,
|
|
24
37
|
title: title.to_s,
|
|
25
38
|
only: only,
|
|
26
39
|
filename: File.join(@path, title.to_s)
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
<% @schemas.each do |schema| %>
|
|
19
19
|
<tr>
|
|
20
20
|
<td>
|
|
21
|
-
<%= check_box :schemas, schema,
|
|
22
|
-
|
|
23
|
-
<%= schema %>
|
|
21
|
+
<%= check_box :schemas, schema, {id: "check_#{schema}", checked: @domains.include?(schema),
|
|
22
|
+
onclick: 'check_schema()'}, true, false %>
|
|
23
|
+
<%= label_tag "check[#{schema}]", schema %>
|
|
24
24
|
</td>
|
|
25
25
|
</tr>
|
|
26
26
|
<% end %>
|
data/lib/draw_erd/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: draw_erd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ogom
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-08-
|
|
11
|
+
date: 2014-08-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|