rails-erd-d3 0.0.8 → 0.0.9

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
  SHA1:
3
- metadata.gz: 74251903d2ba2e90c69862d1b1e627bdad8b7b8a
4
- data.tar.gz: 050cef6b98085bcdddb65724b549f71c0a09d999
3
+ metadata.gz: 6ee48f74faf75b034c4193b41a94a5ab624cc316
4
+ data.tar.gz: a68f8fa5c57287e975ffb86d5042c91cb9d4627b
5
5
  SHA512:
6
- metadata.gz: 96e38387b904cf2caafeed217933001ae7dc54396409707cf1d27a8d482f41d9a4f8bd2d244e0590347f74daa804eb47c735b30c96b0775639bb3fa95fb02431
7
- data.tar.gz: 729f8465c2cddafaea723d0a55425c4f96f036b414e4bbe242700975c6bc701596c419b7e010715addc0c6c035e3b627dcd32a055c14604c412afc91510b8179
6
+ metadata.gz: 5a2c905fd1cd61e1fe8dfed13c9f86e93eddbdeed32613653bdcf82bd9f97b5cced261a2686c9bbe4abfdf3914fc29e4d17c89e8ca6c978a20ec8a192461e04f
7
+ data.tar.gz: 802392a4f39ba4c1917e4ccd37588bf37cf4d93369046ac77dcd9554e056922861396a275dd95214ce7128b8bc681f47fb0d41b22c061d338666a545b74087dc
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Rails-ERD-D3
1
+ [![Gem Version](https://badge.fury.io/rb/rails-erd-d3.svg)](https://badge.fury.io/rb/rails-erd-d3)
2
2
 
3
- Gem is under active development.
3
+ # Rails-ERD-D3
4
4
 
5
5
  Create entity–relationship diagram with D3.js for your Rails application.
6
6
 
@@ -9,32 +9,36 @@ Create entity–relationship diagram with D3.js for your Rails application.
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'rails-erd-d3'
12
+ group :development do
13
+ gem "rails-erd-d3"
14
+ end
13
15
  ```
14
16
 
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install rails-erd-d3
17
+ And then execute for creating file erd.html:
22
18
 
23
- ## Usage
19
+ $ rails c
20
+ > RailsErdD3.create
24
21
 
25
- TODO: Write usage instructions here
22
+ ## Todo
26
23
 
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
24
+ - Add message after creating
25
+ - Sort nodes by label
26
+ - Check all associations
27
+ - belongs_to
28
+ - has_one
29
+ - has_many
30
+ - has_many :through
31
+ - has_one :through
32
+ - has_and_belongs_to_many
32
33
 
33
34
  ## Contributing
34
35
 
35
36
  Bug reports and pull requests are welcome on GitHub at https://github.com/RomanKrasavtsev/rails-erd-d3.
36
37
 
37
-
38
38
  ## License
39
39
 
40
40
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
42
+ ## Author
43
+
44
+ [Roman Krasavtsev](https://github.com/RomanKrasavtsev), [@romankrasavtsev](https://twitter.com/romankrasavtsev)
data/bin/erd CHANGED
File without changes
data/lib/rails_erd_d3.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'json'
1
+ require "json"
2
2
 
3
3
  class RailsErdD3
4
4
  def self.get_rails_version
@@ -15,7 +15,6 @@ class RailsErdD3
15
15
  klass = ApplicationRecord
16
16
  end
17
17
 
18
- Rails.application.eager_load!
19
18
  @@models = ObjectSpace.each_object(Class).select { |o| o.superclass == klass } || []
20
19
  end
21
20
 
@@ -27,15 +26,18 @@ class RailsErdD3
27
26
  models_list = {}
28
27
 
29
28
  @@models.each_with_index do |model, index|
30
- models_list[model.name] = index
29
+ models_list[model.model_name.plural.capitalize] = index
31
30
  end
32
31
 
33
32
  @@models.each_with_index do |model, index|
34
- name = model.name.capitalize
33
+ name = model.model_name.plural.capitalize
35
34
 
36
35
  nodes << { label: name, r: 30 }
37
36
  model.reflections.keys.each do |key|
38
- links << { source: models_list[name], target: models_list[key.capitalize] }
37
+ links << {
38
+ source: models_list[name],
39
+ target: models_list[key[1].plural_name.capitalize]
40
+ }
39
41
  end
40
42
  end
41
43
 
@@ -44,6 +46,8 @@ class RailsErdD3
44
46
  end
45
47
 
46
48
  def self.create
49
+ Rails.application.eager_load!
50
+
47
51
  file = File.new("erd.html", "w")
48
52
  file.puts("
49
53
  <!DOCTYPE HTML>
data/rails-erd-d3.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.name = "rails-erd-d3"
7
7
  spec.authors = ["Roman Krasavtsev"]
8
8
  spec.email = ["mr.krasavtsev@gmail.com"]
9
- spec.version = "0.0.8"
9
+ spec.version = "0.0.9"
10
10
  spec.summary = "Entity–relationship diagram with D3.js for Rails application"
11
11
  spec.description = "This gem creates entity–relationship diagram with D3.js for your Rails application"
12
12
  spec.homepage = "https://github.com/RomanKrasavtsev/rails-erd-d3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-erd-d3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Krasavtsev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-01 00:00:00.000000000 Z
11
+ date: 2016-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler