hospital 0.7.2 → 0.7.4

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: b02e6a704bf08855f155acb22e9a0ac2d1e7ed063e4aa6aec8faf69cb3ffab22
4
- data.tar.gz: 3ba9c9a2bfc297e36591c2243e1e1502da74a7267961e70c6d2450648711b49e
3
+ metadata.gz: 3ab764f421c7160201af9e785c00b3e3d4169199a921a03a295f5e694f1eb13c
4
+ data.tar.gz: 8aa64d6b14b30149df786c8f1c00b027a4ec1ee741d37e7fa597da02e23a1bce
5
5
  SHA512:
6
- metadata.gz: 27fe1cb91c287930699dfe0dda4269b63071c1c3080c95deba2a319cebe877a885aedd753db04c474bef45501ea065bf65fb09dbcee18fde0d0926203e9c773d
7
- data.tar.gz: 7a7c5cc067212bc54c2e41a27ce3bcb6a321fd4afa7f826e85ef15b116bbe7cf9b60a32d45ee821e32809e5c5851f347aa2b1ed841032d3a71c4076cb545c7c8
6
+ metadata.gz: 63229fb186f76c3c73bce046be58ab68d0f5a3a3526189e902992ebae073fd915aa16b7e01054806db9f7bc2a3fb08a791aa4aadba1b72f55b8afa23fe3e6245
7
+ data.tar.gz: ea6b28da799c06aa01b271e475449fa61e8bed3cef01f60fe9f68f8707bbaacfb15075075bf917451a47ed923723469468ff1c1dd6586f2f24fbc7f0ac32fd2f
@@ -17,10 +17,10 @@ module Hospital
17
17
  diagnosis.reset
18
18
  end
19
19
 
20
- def check verbose: false
20
+ def check verbose: false, ignore_condition: false
21
21
  diagnosis.reset
22
22
 
23
- if condition.nil? || condition.call
23
+ if ignore_condition || condition.nil? || condition.call
24
24
  @skipped = false
25
25
  code.call(diagnosis)
26
26
  diagnosis
@@ -11,15 +11,19 @@ class Hospital::Diagnosis
11
11
  end
12
12
 
13
13
  def reset
14
- @infos = []
15
- @warnings = []
16
- @skips = []
17
- @errors = []
18
- @results = []
14
+ @infos = []
15
+ @warnings = []
16
+ @skips = []
17
+ @errors = []
18
+ @results = []
19
+
20
+ @required_env_vars = []
19
21
  end
20
22
 
21
23
  def require_env_vars env_vars=[]
22
24
  success = true
25
+ @required_env_vars = env_vars
26
+
23
27
  if (missing_vars = env_vars.select{|var| ENV[var].nil? || ENV[var].empty? }).any?
24
28
  add_error("These necessary ENV vars are not set: #{variable_list(missing_vars)}.")
25
29
  success = false
@@ -28,6 +32,14 @@ class Hospital::Diagnosis
28
32
  end
29
33
  end
30
34
 
35
+ def dump_required_env_vars
36
+ @required_env_vars.map do |name|
37
+ value = ENV[name]
38
+ value = hide_value value if name =~ /(secret|password|key)/i
39
+ "'#{name}': #{value}"
40
+ end.join(",\n")
41
+ end
42
+
31
43
  def variable_list vars
32
44
  "[#{vars.map{|v| "'#{v}'"}.join(', ')}]"
33
45
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hospital
4
- VERSION = "0.7.2"
4
+ VERSION = "0.7.4"
5
5
  end
data/lib/hospital.rb CHANGED
@@ -24,9 +24,9 @@ module Hospital
24
24
  end
25
25
 
26
26
  # used to call the checkup for a specific class directly (in specs)
27
- def do_checkup(klass, verbose: false)
27
+ def do_checkup(klass, verbose: false, ignore_condition: false)
28
28
  @@groups.map(&:all_checkups).flatten.select{|cu| cu.klass == klass }.map do |cu|
29
- cu.check verbose: verbose
29
+ cu.check verbose: verbose, ignore_condition: ignore_condition
30
30
  end
31
31
  end
32
32
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hospital
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-29 00:00:00.000000000 Z
11
+ date: 2024-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: require_all