rails-erd 1.4.4 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/generators/erd/templates/auto_generate_diagram.rake +1 -1
- data/lib/rails_erd.rb +1 -0
- data/lib/rails_erd/cli.rb +1 -1
- data/lib/rails_erd/domain.rb +9 -1
- data/lib/rails_erd/domain/attribute.rb +6 -0
- data/lib/rails_erd/engine.rb +4 -0
- data/lib/rails_erd/version.rb +1 -1
- data/test/support_files/erdconfig.example +1 -0
- data/test/support_files/erdconfig.exclude.example +1 -0
- data/test/unit/config_test.rb +2 -2
- data/test/unit/diagram_test.rb +8 -0
- data/test/unit/domain_test.rb +11 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e936dc2f84cd3264efc39a2835403813003e1422
|
4
|
+
data.tar.gz: e1da2f8dbdbcc4da4a13826242db83c27bcfbf1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a4d0f1753d7411500afdf241d6941b042f92a40c012ac7b75362cd8710bd7a4755ccb4fad41aec1d4ce93399474eec875293779a6596ced807f9f25452a3d4a
|
7
|
+
data.tar.gz: 7190fca96730605ae0a8f3fe2aefd9c21a6d4818722d388d8ba3fa278f89bdc29db93bbbb849f6cacb1e0af218eb0bbf58489cfc46696a4bfd996519917b90ce
|
data/README.md
CHANGED
@@ -38,7 +38,8 @@ See the [installation instructions](http://voormedia.github.io/rails-erd/install
|
|
38
38
|
|
39
39
|
### Configuration
|
40
40
|
|
41
|
-
|
41
|
+
|
42
|
+
Rails ERD has the ability to be configured via the command line or through the use of a YAML file with configuration options set. It will look for this file first at `~/.erdconfig` and then `./.erdconfig` (which will override any settings in `~/.erdconfig`). The format of the file is as follows (shown here with the default settings used if no `.erdconfig` is found). More information on [customization options](http://voormedia.github.io/rails-erd/customise.html) can be found in Rails ERD's project documentation.
|
42
43
|
|
43
44
|
```
|
44
45
|
attributes:
|
data/lib/rails_erd.rb
CHANGED
data/lib/rails_erd/cli.rb
CHANGED
@@ -16,7 +16,7 @@ Choice.options do
|
|
16
16
|
|
17
17
|
option :attributes do
|
18
18
|
long "--attributes=TYPE,..."
|
19
|
-
desc "Attribute groups to display: content, primary_keys, foreign_keys, timestamps and/or inheritance."
|
19
|
+
desc "Attribute groups to display: false, content, primary_keys, foreign_keys, timestamps and/or inheritance."
|
20
20
|
end
|
21
21
|
|
22
22
|
option :orientation do
|
data/lib/rails_erd/domain.rb
CHANGED
@@ -122,7 +122,15 @@ module RailsERD
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def check_model_validity(model)
|
125
|
-
model.abstract_class?
|
125
|
+
if model.abstract_class? || model.table_exists?
|
126
|
+
if model.name.nil?
|
127
|
+
raise "is anonymous class"
|
128
|
+
else
|
129
|
+
true
|
130
|
+
end
|
131
|
+
else
|
132
|
+
raise "table #{model.table_name} does not exist"
|
133
|
+
end
|
126
134
|
rescue => e
|
127
135
|
warn "Ignoring invalid model #{model.name} (#{e.message})"
|
128
136
|
end
|
@@ -88,6 +88,12 @@ module RailsERD
|
|
88
88
|
@model.inheritance_column == name
|
89
89
|
end
|
90
90
|
|
91
|
+
# Method allows false to be set as an attributes option when making custom graphs.
|
92
|
+
# It rejects all attributes when called from Diagram#filtered_attributes method
|
93
|
+
def false?
|
94
|
+
false
|
95
|
+
end
|
96
|
+
|
91
97
|
# Returns +true+ if this attribute is one of the standard 'magic' Rails
|
92
98
|
# timestamp columns, being +created_at+, +updated_at+, +created_on+ or
|
93
99
|
# +updated_on+.
|
data/lib/rails_erd/version.rb
CHANGED
data/test/unit/config_test.rb
CHANGED
@@ -12,7 +12,7 @@ class ConfigTest < ActiveSupport::TestCase
|
|
12
12
|
set_user_config_file_to("erdconfig.example")
|
13
13
|
|
14
14
|
expected_hash = {
|
15
|
-
attributes: [:content, :foreign_key, :inheritance],
|
15
|
+
attributes: [:content, :foreign_key, :inheritance, :false],
|
16
16
|
disconnected: true,
|
17
17
|
filename: "erd",
|
18
18
|
filetype: :pdf,
|
@@ -34,7 +34,7 @@ class ConfigTest < ActiveSupport::TestCase
|
|
34
34
|
set_user_config_file_to("erdconfig.exclude.example")
|
35
35
|
|
36
36
|
expected_hash = {
|
37
|
-
attributes: [:content, :foreign_key, :inheritance],
|
37
|
+
attributes: [:content, :foreign_key, :inheritance, :false],
|
38
38
|
disconnected: true,
|
39
39
|
filename: "erd",
|
40
40
|
filetype: :pdf,
|
data/test/unit/diagram_test.rb
CHANGED
@@ -310,6 +310,14 @@ class DiagramTest < ActiveSupport::TestCase
|
|
310
310
|
assert_equal %w{id}, retrieve_attribute_lists(:attributes => [:primary_keys])[Book].map(&:name)
|
311
311
|
end
|
312
312
|
|
313
|
+
test "generate should yield [] if attributes = false" do
|
314
|
+
create_model "Book", :title => :string
|
315
|
+
create_model "Page", :book => :references do
|
316
|
+
belongs_to :book
|
317
|
+
end
|
318
|
+
assert_equal [], retrieve_attribute_lists(:attributes => [:false])[Book].map(&:name)
|
319
|
+
end
|
320
|
+
|
313
321
|
test "generate should yield foreign key attributes if included" do
|
314
322
|
create_model "Book", :author => :references do
|
315
323
|
belongs_to :author
|
data/test/unit/domain_test.rb
CHANGED
@@ -72,6 +72,17 @@ class DomainTest < ActiveSupport::TestCase
|
|
72
72
|
assert_equal ["Palace", "Structure"], Domain.generate.entities.collect(&:name)
|
73
73
|
end
|
74
74
|
|
75
|
+
test "entities should exclude models without a class name" do
|
76
|
+
create_models "Foo", "Bar"
|
77
|
+
Foo.stubs(:name).returns(nil)
|
78
|
+
|
79
|
+
begin
|
80
|
+
assert_equal ["Bar"], Domain.generate.entities.collect(&:name)
|
81
|
+
ensure
|
82
|
+
Foo.unstub(:name) # required so `reset_domain` works
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
75
86
|
# Relationship processing ==================================================
|
76
87
|
test "relationships should return empty array for empty domain" do
|
77
88
|
assert_equal [], Domain.generate.relationships
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-erd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rolf Timmermans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/rails_erd/domain/relationship.rb
|
96
96
|
- lib/rails_erd/domain/relationship/cardinality.rb
|
97
97
|
- lib/rails_erd/domain/specialization.rb
|
98
|
+
- lib/rails_erd/engine.rb
|
98
99
|
- lib/rails_erd/railtie.rb
|
99
100
|
- lib/rails_erd/tasks.rake
|
100
101
|
- lib/rails_erd/version.rb
|