database_consistency 1.3.8 → 1.3.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: ad78f367e1642231f8f17aa787385cd154dec73b9fd68ee0f506311335128d0e
4
- data.tar.gz: cd0d30bf84e70dffb926a9cae47542853ea59d68ec4e268318af1bee0e6094e4
3
+ metadata.gz: c589e055624919d847ef24864b767c55ebb9bb37d18da70b0558e73c2336815c
4
+ data.tar.gz: 53bd691bf67c2a014d8c96cfd1e93f59699ace4c6a1ba41befeca8557c05fda6
5
5
  SHA512:
6
- metadata.gz: 221df64634adcf4c025ed9937b38f4fed127639b39bb944c9b31b616917916e1cbf01165c934c35c8e5b2f338d6512ab5a371d9d0bcf43ffe25fa3258f73aa47
7
- data.tar.gz: bee363244d2240f94225429684e66a8d1dbdd545a22a03f8fdd70f3b40baea91d94be51aadc4822f0a19921541e472c668aaaea22504e7a1c5ff5de10014d005
6
+ metadata.gz: f15b6e520813a6cc98105f250bdfa4397f12c1fff90357680681bafdba028a748bb74de0e43ac22fd377fcdf9569e619d0bd09e14095301c7ea353c45dc71146
7
+ data.tar.gz: 27e3773b5458c410b80c6640e5e1fc0e863faf568a7b26cf0bddbf8441411971e79ffe8ede2d77fae11c1cf590e7fe13439f0c32ee423305ad0d3d77c77b98f1
@@ -7,17 +7,10 @@ module DatabaseConsistency
7
7
  class Configuration
8
8
  DEFAULT_PATH = '.database_consistency.yml'
9
9
 
10
- def initialize(filepaths = DEFAULT_PATH)
11
- @configuration = Array(filepaths).each_with_object({}) do |filepath, result|
12
- content =
13
- if filepath && File.exist?(filepath)
14
- data = load_yaml_config_file(filepath)
15
- data.is_a?(Hash) ? data : {}
16
- else
17
- {}
18
- end
19
-
20
- combine_configs!(result, content)
10
+ def initialize(file_paths = DEFAULT_PATH)
11
+ @configuration = existing_configurations(file_paths).then do |existing_paths|
12
+ puts "Loaded configurations: #{existing_paths.join(', ')}"
13
+ extract_configurations(existing_paths)
21
14
  end
22
15
  end
23
16
 
@@ -55,6 +48,21 @@ module DatabaseConsistency
55
48
 
56
49
  attr_reader :configuration
57
50
 
51
+ def existing_configurations(paths)
52
+ Array(paths).select do |filepath|
53
+ filepath && File.exist?(filepath)
54
+ end
55
+ end
56
+
57
+ def extract_configurations(paths)
58
+ Array(paths).each_with_object({}) do |filepath, result|
59
+ data = load_yaml_config_file(filepath)
60
+ content = data.is_a?(Hash) ? data : {}
61
+
62
+ combine_configs!(result, content)
63
+ end
64
+ end
65
+
58
66
  def global_enabling
59
67
  value = configuration.dig('DatabaseConsistencyCheckers', 'All', 'enabled')
60
68
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '1.3.8'
4
+ VERSION = '1.3.9'
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.3.8
4
+ version: 1.3.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: 2022-11-23 00:00:00.000000000 Z
11
+ date: 2022-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord