okcomputer-checks 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ok_computer/checks/registry.rb +17 -7
- data/lib/ok_computer/checks/version.rb +1 -1
- data/spec/ok_computer/checks_spec.rb +28 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3f6daa10543667d831f916643cd8509bd71267cf9027a4ca5e2455a424dabc2
|
4
|
+
data.tar.gz: e39221047f08e96a9d15ba478a204dc4dcd2a4cdab789fff63cc5cb50ede5d97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fececbd15ed6ccb3a0ce20c49c624c8377a0213804682992acd17250c6ac17ac52f93a2d9c4f15a7311a0aa9051344d46b17ae02813d07a924c82d0a10d445e
|
7
|
+
data.tar.gz: 9879e6cda942bdad1b32de1aba99d4110fe6baeb8dc41cf90f135d09c6af73ffd32ec69fa28176f1738f908b5429bc6e50694cd8feea1b80e48fe9a3c2d564bd
|
@@ -23,18 +23,28 @@ module OkComputer
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
def add_collection(collection_name, &block)
|
27
|
+
checks = CheckCollection.new(collection_name)
|
28
|
+
Checks.register(checks, &block)
|
29
|
+
register(collection_name, checks)
|
30
|
+
end
|
31
|
+
|
32
|
+
def add_optional(klass_or_check, check_name, *args)
|
33
|
+
add(OptionalCheck.new(process_check(klass_or_check, *args)), check_name)
|
34
|
+
end
|
32
35
|
|
33
|
-
|
36
|
+
def add(klass_or_check, check_name, *args)
|
37
|
+
register(check_name, process_check(klass_or_check, *args))
|
34
38
|
end
|
35
39
|
|
36
40
|
private
|
37
41
|
|
42
|
+
def process_check(klass_or_check, *args)
|
43
|
+
return klass_or_check if [OptionalCheck, Check, CheckCollection].any? { |k| klass_or_check.is_a?(k) }
|
44
|
+
|
45
|
+
build_check(klass_or_check, *args)
|
46
|
+
end
|
47
|
+
|
38
48
|
def build_check(klass, *args)
|
39
49
|
unless klass.is_a?(Class)
|
40
50
|
begin
|
@@ -60,5 +60,33 @@ RSpec.describe(OkComputer::Checks) do
|
|
60
60
|
it { expect(collection.fetch(:search)).to(be_present) }
|
61
61
|
it { is_expected.to(be_success) }
|
62
62
|
end
|
63
|
+
|
64
|
+
describe('#add_collection') do
|
65
|
+
subject(:search) { collection.fetch(:search) }
|
66
|
+
|
67
|
+
before do
|
68
|
+
described_class.register do |r|
|
69
|
+
r.add_collection(:search) do |s|
|
70
|
+
s.add(:algolia, :algolia, app_id: app_id, api_key: api_key)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
collection.run
|
74
|
+
end
|
75
|
+
|
76
|
+
it { expect(search.fetch(:algolia)).to(be_present) }
|
77
|
+
it { is_expected.to(be_success) }
|
78
|
+
end
|
79
|
+
|
80
|
+
describe('#add_optional') do
|
81
|
+
before do
|
82
|
+
described_class.register do |r|
|
83
|
+
r.add_optional(:algolia, :search, app_id: app_id, api_key: api_key)
|
84
|
+
end
|
85
|
+
collection.run
|
86
|
+
end
|
87
|
+
|
88
|
+
it { expect(collection.fetch(:search)).to(be_present) }
|
89
|
+
it { is_expected.to(be_success) }
|
90
|
+
end
|
63
91
|
end
|
64
92
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: okcomputer-checks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- First Circle Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -266,7 +266,7 @@ homepage: https://github.com/carabao-capital/okcomputer-checks
|
|
266
266
|
licenses:
|
267
267
|
- MIT
|
268
268
|
metadata:
|
269
|
-
source_code_uri: https://github.com/carabao-capital/okcomputer-checks/tree/v1.
|
269
|
+
source_code_uri: https://github.com/carabao-capital/okcomputer-checks/tree/v1.1.0
|
270
270
|
allowed_push_host: https://rubygems.org
|
271
271
|
post_install_message:
|
272
272
|
rdoc_options: []
|
@@ -283,7 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
283
283
|
- !ruby/object:Gem::Version
|
284
284
|
version: '0'
|
285
285
|
requirements: []
|
286
|
-
rubygems_version: 3.0.
|
286
|
+
rubygems_version: 3.0.8
|
287
287
|
signing_key:
|
288
288
|
specification_version: 4
|
289
289
|
summary: Collection health-check for okcomputer
|