erd-keeper 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +50 -0
- data/Rakefile +6 -0
- data/bin/erd-keeper +4 -0
- data/erd-keeper.gemspec +27 -0
- data/lib/command.rb +19 -0
- data/lib/erd-keeper.rb +56 -0
- data/lib/erd-keeper/version.rb +3 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 77c5453535635c62114cbbf22f081f7b637fc785
|
4
|
+
data.tar.gz: fda51f0d7de8eeb8e70caebe7286ab2bdfaa4747
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e6e042352709e4429b79fc8b7e28fa198dd7cfa7635e71bf0bfee4af9fb5ec35f56b6c631a7e8856974ad5773214c00134f82e57e9adfb8f8f736ed04fde159a
|
7
|
+
data.tar.gz: 6ba9d3698db712c9cedf9a66ae6240169f2425e94cccbea01815f694774e9f480174049b856976b104ada98a340fbeb03118735a028755e6f79e857450988d26
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Yasuhiro Matsumura
|
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,50 @@
|
|
1
|
+
# ErdKeeper
|
2
|
+
|
3
|
+
ErdKeeper is a gem that outputs ER diagram by setting yaml.
|
4
|
+
|
5
|
+
The output of ER diagram is realized by wrapping call of [rails-erd](https://github.com/voormedia/rails-erd).
|
6
|
+
|
7
|
+
This gem generate a diagram based on your application's Active Record models.
|
8
|
+
|
9
|
+
|
10
|
+
## Getting started
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'erd-keeper'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Create configuration file (Write your application's Active Record models):
|
25
|
+
|
26
|
+
```yml
|
27
|
+
diagrams:
|
28
|
+
tweet:
|
29
|
+
- User
|
30
|
+
- Micropost
|
31
|
+
all:
|
32
|
+
- User
|
33
|
+
- Micropost
|
34
|
+
- Relationship
|
35
|
+
```
|
36
|
+
|
37
|
+
And then execute:
|
38
|
+
|
39
|
+
$ bundle exec erd-keeper --input="config/erd-keeper.yml" --output="./"
|
40
|
+
|
41
|
+
|
42
|
+
### Options
|
43
|
+
|
44
|
+
- --input : Write the path of the configuration file.
|
45
|
+
- --output : Write the path of the output ER diagram.
|
46
|
+
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/erd-keeper
ADDED
data/erd-keeper.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'erd-keeper/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "erd-keeper"
|
8
|
+
spec.version = ErdKeeper::VERSION
|
9
|
+
spec.authors = ["Yasuhiro Matsumura"]
|
10
|
+
spec.email = ["ym.contributor@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{ErdKeeper is a gem that outputs ER diagram by setting yaml.}
|
13
|
+
spec.description = %q{ErdKeeper is a gem that outputs ER diagram by setting yaml. The output of ER diagram is realized by wrapping call of rails-erd.}
|
14
|
+
spec.homepage = "https://github.com/muramurasan/erd-keeper"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "bin"
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
spec.add_dependency "rails-erd", "~> 1.1"
|
26
|
+
spec.add_dependency "thor"
|
27
|
+
end
|
data/lib/command.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "erd-keeper"
|
3
|
+
|
4
|
+
class Command < Thor
|
5
|
+
default_command :generate
|
6
|
+
|
7
|
+
desc "generate", "generate ER diagrams."
|
8
|
+
method_option :input,
|
9
|
+
type: :string,
|
10
|
+
default: "erd-keeper.yml",
|
11
|
+
desc: "Specify the path of the configuration file"
|
12
|
+
method_option :output,
|
13
|
+
type: :string,
|
14
|
+
default: ".",
|
15
|
+
desc: "Specify the path of the output file"
|
16
|
+
def generate
|
17
|
+
ErdKeeper::GenerateErd.new.exec(options[:input], options[:output])
|
18
|
+
end
|
19
|
+
end
|
data/lib/erd-keeper.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "erd-keeper/version"
|
3
|
+
|
4
|
+
module ErdKeeper
|
5
|
+
class GenerateErd
|
6
|
+
def exec(input, output)
|
7
|
+
if Dir.exist?(output)
|
8
|
+
while(output[-1] == "/")
|
9
|
+
output.chop!
|
10
|
+
end
|
11
|
+
else
|
12
|
+
puts "--- output: Folder not found!"
|
13
|
+
puts "--- Stop the output of ERD."
|
14
|
+
return
|
15
|
+
end
|
16
|
+
|
17
|
+
if File.exist?(input)
|
18
|
+
generate_erd_by_setting(input, output)
|
19
|
+
else
|
20
|
+
puts "--- input: File not found!"
|
21
|
+
puts "--- Instead, it outputs for all models."
|
22
|
+
generate_project_erd(output)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def generate_erd_by_setting(input, output)
|
29
|
+
load_diagrams(input).each do |diagram_name , diagram|
|
30
|
+
puts "--- Generate ERD : #{diagram_name}"
|
31
|
+
if diagram.nil?
|
32
|
+
puts "--- #{diagram_name}: The models are not described!"
|
33
|
+
next
|
34
|
+
end
|
35
|
+
models = diagram.map { |m| m }
|
36
|
+
generate_domain_erd(diagram_name, models, output)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def load_diagrams(yaml)
|
41
|
+
load_yaml = YAML.load_file(yaml)
|
42
|
+
load_yaml["diagrams"]
|
43
|
+
end
|
44
|
+
|
45
|
+
def generate_domain_erd(diagram_name = "erd", models = nil, folder = ".")
|
46
|
+
system "bundle exec erd --only='#{models.join(",")}' "\
|
47
|
+
"--inheritance=true "\
|
48
|
+
"--title='#{diagram_name}' "\
|
49
|
+
"--filename=#{folder}/#{diagram_name} --filetype=png"
|
50
|
+
end
|
51
|
+
|
52
|
+
def generate_project_erd(folder)
|
53
|
+
system "bundle exec erd --title='All domain model' --filename=#{folder}/project --filetype=png"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: erd-keeper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yasuhiro Matsumura
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rails-erd
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: ErdKeeper is a gem that outputs ER diagram by setting yaml. The output
|
84
|
+
of ER diagram is realized by wrapping call of rails-erd.
|
85
|
+
email:
|
86
|
+
- ym.contributor@gmail.com
|
87
|
+
executables:
|
88
|
+
- erd-keeper
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/erd-keeper
|
98
|
+
- erd-keeper.gemspec
|
99
|
+
- lib/command.rb
|
100
|
+
- lib/erd-keeper.rb
|
101
|
+
- lib/erd-keeper/version.rb
|
102
|
+
homepage: https://github.com/muramurasan/erd-keeper
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.5.1
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: ErdKeeper is a gem that outputs ER diagram by setting yaml.
|
126
|
+
test_files: []
|