erd 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35c1ad5ad3318d07d2faeb5836b2ec12e8132088994985d6d0f0342addd7685d
4
- data.tar.gz: 77ce179c5b2c8cbe58095320d012e5aab188c3aa0d23d73e9de5036564e2cf1f
3
+ metadata.gz: 23d4342f2a320f75b2e90d11bf2474d5f1878632369e6c5a9e3608f3c9ac9aee
4
+ data.tar.gz: d7b53a5993a0b95508e44be666ec68f620563e4a9ee7bfb7ef708f09beb0ffda
5
5
  SHA512:
6
- metadata.gz: c02778a0c99593cd9ae3b8f5c27ccb0ea11f8ad6aa719a023f8de9ad40a51352ac33d17e92035afec8faad65ad7f1944eb032a65c98d9570f4840843121f65d5
7
- data.tar.gz: 5f227492c2234358069825ca797188e6ec92e74cab71172de589077c1e52d4e3d104e04eedbd3e3e3b84b54dea911c8e61970893fdf9c7b4cd7ada16a2b98d31
6
+ metadata.gz: 37a889901a16afac747792e929a71a8831ff55b0119cdb5cf96911fb19447a493a717021c7a65c1e7d3274809af67dd64c6a0184f79aebfa09716198186d38f8
7
+ data.tar.gz: c87a23f1c22cbff2363b8f54d993be86669330854fd80bd9570df87b3f144434c9ad55aacceacdf08f95b0fe60ff0cf67d4a145ee1918c22c1cba2b7b8b31b15
@@ -1,43 +1,49 @@
1
- = Erd
1
+ # Erd
2
2
 
3
3
  A Rails engine for drawing your app's ER diagram and operating migrations
4
4
 
5
5
 
6
- == Requirements
6
+ ## Requirements
7
7
 
8
8
  * Rails 5.2, 5.1, 5.0, 4.2, 4.1, 4.0, 3.2, or 3.1
9
9
 
10
10
  * Graphviz
11
11
 
12
12
 
13
- == Installation
13
+ ## Installation
14
14
 
15
- Add 'erd' gem to your existing app's Gemfile:
16
- gem 'erd'
15
+ Bundle 'erd' gem to your existing Rails app's Gemfile:
16
+ ```ruby
17
+ gem 'erd', group: :development
17
18
 
18
- Bundle it:
19
- % bundle
19
+ ```
20
20
 
21
21
 
22
- == Usage
22
+ ## Usage
23
23
 
24
24
  Browse at your http://localhost:3000/erd
25
25
 
26
26
 
27
- == Features
27
+ ## Features
28
28
 
29
- * Erd draws an ER diagram based on your app's database and models
29
+ ### Show Mode
30
30
 
31
- * You can drag and arrange the positions of each model
31
+ * Erd draws an ER diagram based on your app's database and models.
32
32
 
33
- * You can operate DB schema manipulations such as `add column`, `rename column`, `alter column`, `create model (as well as table)`, and `drop table`
33
+ * You can drag and arrange the positions of each model.
34
34
 
35
- * Then, Erd generates migration files on the server
35
+ * Then you can save the positions to a local file `db/erd_positions.json`, so you can share the diagram between the team members.
36
36
 
37
- * And you can run each migration on your browser
37
+ ### Edit Mode
38
38
 
39
+ * You can operate DB schema manipulations such as `add column`, `rename column`, `alter column`, `create model (as well as table)`, and `drop table`.
39
40
 
40
- == TODO
41
+ * Then, Erd generates migration files on the server.
42
+
43
+ * And you can run each migration on your browser super quickly.
44
+
45
+
46
+ ## TODO
41
47
 
42
48
  * Fix buggy JS
43
49
 
@@ -50,17 +56,17 @@ Browse at your http://localhost:3000/erd
50
56
  * cleaner code (the code is horrible. Please don't read the code, though of course your patches welcome)
51
57
 
52
58
 
53
- == Contributing to Erd
59
+ ## Contributing to Erd
54
60
 
55
61
  * Send me your pull requests!
56
62
 
57
63
 
58
- == Team
64
+ ## Team
59
65
 
60
- * {Akira Matsuda}[https://github.com/amatsuda]
61
- * {Teppei Machida}[http://github.com/machida] (design)
66
+ * [Akira Matsuda][https://github.com/amatsuda]
67
+ * [Teppei Machida][http://github.com/machida] (design)
62
68
 
63
69
 
64
- == Copyright
70
+ ## Copyright
65
71
 
66
72
  Copyright (c) 2012 Akira Matsuda. See MIT-LICENSE for further details.
@@ -6,7 +6,8 @@ require 'erd/application_controller'
6
6
 
7
7
  module Erd
8
8
  class ErdController < ::Erd::ApplicationController
9
- POSITIONS_JSON_FILE = Rails.root.join('tmp/erd_positions.json').freeze
9
+ POSITIONS_JSON_FILE = Rails.root.join('db/erd_positions.json').freeze
10
+ OLD_POSITIONS_JSON_FILE = Rails.root.join('db/erd_positions.json').freeze # for compatibility
10
11
 
11
12
  def index
12
13
  @erd = render_plain generate_plain, saved_positions
@@ -80,7 +81,13 @@ module Erd
80
81
  private
81
82
 
82
83
  def saved_positions
83
- POSITIONS_JSON_FILE.exist? ? ActiveSupport::JSON.decode(POSITIONS_JSON_FILE.read) : {}
84
+ if POSITIONS_JSON_FILE.exist?
85
+ ActiveSupport::JSON.decode(POSITIONS_JSON_FILE.read)
86
+ elsif OLD_POSITIONS_JSON_FILE.exist?
87
+ ActiveSupport::JSON.decode(OLD_POSITIONS_JSON_FILE.read)
88
+ else
89
+ {}
90
+ end
84
91
  end
85
92
 
86
93
  def generate_plain
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Erd
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-16 00:00:00.000000000 Z
11
+ date: 2020-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-graphviz
@@ -161,7 +161,7 @@ files:
161
161
  - ".travis.yml"
162
162
  - Gemfile
163
163
  - MIT-LICENSE
164
- - README.rdoc
164
+ - README.md
165
165
  - Rakefile
166
166
  - app/controllers/erd/application_controller.rb
167
167
  - app/controllers/erd/erd_controller.rb