database_consistency 1.7.7 → 1.7.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f17a39d98d4045434101b952706e15a54da6c1bc8a46860e7daa56932b9569a8
4
- data.tar.gz: 73a0950925d6158c7e9be1dfa7e9d2c706bed88590884c7ab9784e3434e044e0
3
+ metadata.gz: 199d6a4e4c313048e4e1abf5e980fec96d4703704a837024fbb6e507ab36bc7f
4
+ data.tar.gz: db33237e3cc031b90ebae5001a4d99b5c398f6a2324d6016275b8501b2f39e10
5
5
  SHA512:
6
- metadata.gz: cd3677888dabe3342854f3ad10e2591cfb79027fd6f210099c4be014f21e02b3317dec9070a35b41876088fbae5bcd5d4faacdb452bbd6e98cfaf7808f3f3294
7
- data.tar.gz: a1bdfe2c29b6a873bec6f9866eb11b9a2ac90fe4117df6586f9e3ab3687cb20f29f387b23a34b011f5f2c6a52e52ee881b8b3682ee2e527c1673e2249a4f74fa
6
+ metadata.gz: 30639e1cfed1a67db161d01dcd1fd8d1f2511fcb062bebb9371a9a690d2054ae5936fb13a0a158db26c2bcb60b89560c1fd17a936c402ae72e62a7c611a732ee
7
+ data.tar.gz: 6b891e83dd31d2a9fcfb76ac53d3aa1186e203daebb27c252084cf7208cfa0c3f091dbbe92cb63cb98b0dc48f2939718b6fc85a9f72430e79a9882799c6b1a94
@@ -27,8 +27,9 @@ module DatabaseConsistency
27
27
 
28
28
  # Returns list of models to check
29
29
  def models
30
- ActiveRecord::Base.descendants.delete_if(&:abstract_class?).select do |klass|
31
- klass.connection.table_exists?(klass.table_name) &&
30
+ ActiveRecord::Base.descendants.select do |klass|
31
+ !klass.abstract_class? &&
32
+ klass.connection.table_exists?(klass.table_name) &&
32
33
  !klass.name.include?('HABTM_') &&
33
34
  project_klass?(klass)
34
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '1.7.7'
4
+ VERSION = '1.7.9'
5
5
  end
@@ -12,11 +12,20 @@ module DatabaseConsistency
12
12
  assign_result(hash, result)
13
13
  end
14
14
 
15
- File.write(file_name, h.to_yaml)
15
+ sorted_hash = sort(h)
16
+
17
+ File.write(file_name, sorted_hash.to_yaml)
16
18
  end
17
19
 
18
20
  private
19
21
 
22
+ def sort(obj)
23
+ return obj unless obj.is_a?(Hash)
24
+
25
+ obj.sort_by { |(k, _)| k }
26
+ .to_h { |k, v| [k, sort(v)] }
27
+ end
28
+
20
29
  def write?(status)
21
30
  status == :fail
22
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_consistency
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.7
4
+ version: 1.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-01 00:00:00.000000000 Z
11
+ date: 2023-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord