snapbot 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -0
- data/lib/snapbot/diagram/dot_generator/relationship.rb +1 -1
- data/lib/snapbot/reflector.rb +13 -2
- data/lib/snapbot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb7768e6e3ac46cacf84d569a0d8026062418160d39c5ae1e214875ac0f4b26d
|
4
|
+
data.tar.gz: 50467bc231c453c7c81129181f90c21759f5acb2f121fbaf07bfd5313dcaea80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0331b6031f3fe4e3ee09aef66a1030bfec968f5df8c7308c2dd09933e0c63cfad55e54dab10e7bf0e9dc568216d34bbd3f8ac32c5bd6e524750ad676fbb49988
|
7
|
+
data.tar.gz: 06757de1f42e455f6b8565661426bba4a94e609d567a5d2a2c6d8cdb8be8e5aed4b16e97334a009d34bda3b400707b2796a9a4b88b507a407b58e1ca8df2a798
|
data/.rubocop.yml
CHANGED
@@ -2,11 +2,19 @@ AllCops:
|
|
2
2
|
TargetRubyVersion: 2.6
|
3
3
|
SuggestExtensions: false
|
4
4
|
|
5
|
+
Metrics/AbcSize:
|
6
|
+
Exclude:
|
7
|
+
- spec/support/fixture_database.rb
|
8
|
+
|
5
9
|
Metrics/BlockLength:
|
6
10
|
Exclude:
|
7
11
|
- spec/**/*_spec.rb
|
8
12
|
- snapbot.gemspec
|
9
13
|
|
14
|
+
Metrics/MethodLength:
|
15
|
+
Exclude:
|
16
|
+
- spec/support/fixture_database.rb
|
17
|
+
|
10
18
|
Style/StderrPuts:
|
11
19
|
Exclude:
|
12
20
|
- lib/snapbot/diagram/renderer.rb
|
data/lib/snapbot/reflector.rb
CHANGED
@@ -13,11 +13,21 @@ module Snapbot
|
|
13
13
|
@models ||= begin
|
14
14
|
Rails.application.eager_load! if defined?(Rails)
|
15
15
|
base_activerecord_class.descendants.reject do |c|
|
16
|
-
c
|
16
|
+
activerecord_ignore?(c) || (only_with_records && c.count.zero?)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
ACTIVERECORD_IGNORE = [
|
22
|
+
/^Schema$/,
|
23
|
+
/^HABTM_/,
|
24
|
+
/^ActiveRecord::InternalMetadata$/,
|
25
|
+
/^ActiveRecord::SchemaMigration$/
|
26
|
+
].freeze
|
27
|
+
def activerecord_ignore?(klass)
|
28
|
+
ACTIVERECORD_IGNORE.any? { |r| klass.name =~ r }
|
29
|
+
end
|
30
|
+
|
21
31
|
def instances
|
22
32
|
@instances ||= models.each_with_object([]) do |klass, array|
|
23
33
|
array << klass.all
|
@@ -43,7 +53,8 @@ module Snapbot
|
|
43
53
|
def reflect_associations(instance)
|
44
54
|
(
|
45
55
|
instance.class.reflect_on_all_associations(:has_many).reject { |a| a.name == :schemas } +
|
46
|
-
instance.class.reflect_on_all_associations(:has_one)
|
56
|
+
instance.class.reflect_on_all_associations(:has_one) +
|
57
|
+
instance.class.reflect_on_all_associations(:has_and_belongs_to_many)
|
47
58
|
).flatten
|
48
59
|
end
|
49
60
|
|
data/lib/snapbot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snapbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russell Garner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: binding_of_caller
|