database_consistency 1.1.15 → 1.2.0

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: e7986728aea3224bf5a8f04ef65847f88bfe517b4c7b0b3b4361c7a0dbdd2a2d
4
- data.tar.gz: d7225b7dadd93850c02c0282974dc01d4c8ae6c2ded3638e996d6aa3fe29fdbe
3
+ metadata.gz: f18ab981e7a995312fcefac4aad1673991c0ca74f83e892ed443b55399f73621
4
+ data.tar.gz: '0284902da44ea88322df42739eb9471212970ff4a2bde3ea91c491a0b3b6a8c6'
5
5
  SHA512:
6
- metadata.gz: ed7beed1d43e74309e173bfba69ebb82dc4948b73b31413c43d7454a4f3c165ef68328d902278bf8e1bf527897da9848213f477779f3a48d198a580a17b8f9ef
7
- data.tar.gz: 0f00c0005e59a6f374c58d25b3554405edf78eb592908603b46224ca7aff86c0e9d39e2a1bb642d6ea0a69100d8df0bf8564c184e8d3ee4b88f93cfdafa75fb1
6
+ metadata.gz: 3765a63635638981d1a7389ed4d5f4a611d188c08281a13fc2ae5c435e4da8ad09a9a0f49511be596126d75caca322a3a7bd16309d27914adcfcb386a135223a
7
+ data.tar.gz: 6473f6990528f09bbb90e6e044b0e1c506b9c9586c65f2b76f8efaed68f1cb91d914703e11ba3747ce0663f9999e33065d7d5b0f5dbce44672a3ca33bd3be94f
@@ -37,22 +37,30 @@ module DatabaseConsistency
37
37
  def enabled?(*path)
38
38
  current = configuration
39
39
 
40
+ value = global_enabling
41
+
40
42
  path.each do |key|
41
43
  current = current[key.to_s]
42
- return true unless current.is_a?(Hash)
44
+ return value unless current.is_a?(Hash)
43
45
 
44
46
  next if current['enabled'].nil?
45
47
 
46
- return false unless current['enabled']
48
+ value = current['enabled']
47
49
  end
48
50
 
49
- true
51
+ value
50
52
  end
51
53
 
52
54
  private
53
55
 
54
56
  attr_reader :configuration
55
57
 
58
+ def global_enabling
59
+ value = configuration.dig('DatabaseConsistencyCheckers', 'All', 'enabled')
60
+
61
+ value.nil? ? true : value
62
+ end
63
+
56
64
  def load_yaml_config_file(filepath)
57
65
  if YAML.respond_to?(:safe_load_file)
58
66
  YAML.safe_load_file(filepath, aliases: true)
@@ -14,7 +14,7 @@ module DatabaseConsistency
14
14
 
15
15
  # @param [String] type
16
16
  def initialize(type)
17
- @type = type
17
+ @type = type.downcase
18
18
  end
19
19
 
20
20
  # @return [String]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '1.1.15'
4
+ VERSION = '1.2.0'
5
5
  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.1.15
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-04 00:00:00.000000000 Z
11
+ date: 2022-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  - !ruby/object:Gem::Version
200
200
  version: '0'
201
201
  requirements: []
202
- rubygems_version: 3.1.6
202
+ rubygems_version: 3.3.21
203
203
  signing_key:
204
204
  specification_version: 4
205
205
  summary: Provide an easy way to check the consistency of the database constraints