snapbot 0.1.3 → 0.2.0

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
  SHA256:
3
- metadata.gz: bb58059025b35d29e5d762be3719f21461f225a2950c51efe54161009b1412ca
4
- data.tar.gz: a08b6fe2a72289b2946ac7461920863a7226a9d24b12a24d3b23dbe1f2ca00dd
3
+ metadata.gz: bb7768e6e3ac46cacf84d569a0d8026062418160d39c5ae1e214875ac0f4b26d
4
+ data.tar.gz: 50467bc231c453c7c81129181f90c21759f5acb2f121fbaf07bfd5313dcaea80
5
5
  SHA512:
6
- metadata.gz: 31970a0125ab31512d051b4a8dac26e324fa556dd6ccfdffa1a83dc8bc9b6a962f5423150bcc634c45420cc59e12258b3d034b1210765b7c63cbba033b8a3277
7
- data.tar.gz: 530cebe2837a43ea3a9bddcdb63ed3bdda8666d3a2dd05cb79926e3d6f9c5b3c41da750e8d5dfc6c67fa3784c4f1c672b4620c0e2d135a1825bf87b1182b76fa
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
@@ -11,7 +11,7 @@ module Snapbot
11
11
  self.destination = destination
12
12
  end
13
13
 
14
- def equals(other)
14
+ def ==(other)
15
15
  source == other.source && destination == other.destination
16
16
  end
17
17
  end
@@ -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.to_s == "Schema" || (only_with_records && c.count.zero?)
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Snapbot
4
- VERSION = "0.1.3"
4
+ VERSION = "0.2.0"
5
5
  end
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.1.3
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-08 00:00:00.000000000 Z
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