kuber_kit 0.1.4 → 0.1.5
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/kuber_kit/core/context_helper/service_helper.rb +4 -0
- data/lib/kuber_kit/core/service.rb +15 -3
- data/lib/kuber_kit/core/service_definition.rb +7 -0
- data/lib/kuber_kit/core/service_factory.rb +2 -1
- data/lib/kuber_kit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5df957bf6c31a193caef5d2fc163be4d925ba6dc3bd61f2d98c47f0eee2bb42
|
4
|
+
data.tar.gz: 701748c782360287b41acd34dcd33a3c8d9192a2ba91685a5355dddbe4b19789
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4d10fbac924851b0552f1b833e8080203277245055717a5a7592437284eb9a5cd0535c369764ca474bc7a09686517254423fec45aeb2ccd8568d22c1851cf63
|
7
|
+
data.tar.gz: 1972b5f5cdd6cb8e8b1f33ae210ac783f3ff55e1c36f6304c933c2a43b3b335ff40b9400fd725be957227b3ed8160327d8d19f0352abf9b9596e4f0b0855716d
|
data/Gemfile.lock
CHANGED
@@ -1,20 +1,32 @@
|
|
1
1
|
class KuberKit::Core::Service
|
2
|
-
|
2
|
+
AttributeNotSet = Class.new(Indocker::Error)
|
3
|
+
|
4
|
+
attr_reader :name, :template_name, :tags, :images, :attributes
|
3
5
|
|
4
6
|
Contract KeywordArgs[
|
5
7
|
name: Symbol,
|
6
8
|
template_name: Symbol,
|
7
9
|
tags: ArrayOf[Symbol],
|
8
10
|
images: ArrayOf[Symbol],
|
11
|
+
attributes: HashOf[Symbol => Any],
|
9
12
|
] => Any
|
10
|
-
def initialize(name:, template_name:, tags:, images:)
|
13
|
+
def initialize(name:, template_name:, tags:, images:, attributes:)
|
11
14
|
@name = name
|
12
15
|
@template_name = template_name
|
13
16
|
@tags = tags
|
14
17
|
@images = images
|
18
|
+
@attributes = attributes
|
15
19
|
end
|
16
20
|
|
17
21
|
def uri
|
18
|
-
name.to_s.
|
22
|
+
name.to_s.gsub("_", "-")
|
23
|
+
end
|
24
|
+
|
25
|
+
def attribute(attribute_name)
|
26
|
+
unless attributes.has_key?(attribute_name.to_sym)
|
27
|
+
raise AttributeNotSet, "attribute #{attribute_name} was not set"
|
28
|
+
end
|
29
|
+
|
30
|
+
attributes[attribute_name.to_sym]
|
19
31
|
end
|
20
32
|
end
|
@@ -12,6 +12,7 @@ class KuberKit::Core::ServiceDefinition
|
|
12
12
|
template_name: get_value(@template_name),
|
13
13
|
tags: Array(get_value(@tags)).map(&:to_sym),
|
14
14
|
images: Array(get_value(@images)).map(&:to_sym),
|
15
|
+
attributes: get_value(@attributes),
|
15
16
|
)
|
16
17
|
end
|
17
18
|
|
@@ -33,6 +34,12 @@ class KuberKit::Core::ServiceDefinition
|
|
33
34
|
self
|
34
35
|
end
|
35
36
|
|
37
|
+
def attributes(value = nil, &block)
|
38
|
+
@attributes = block_given? ? block : value
|
39
|
+
|
40
|
+
self
|
41
|
+
end
|
42
|
+
|
36
43
|
private
|
37
44
|
def get_value(variable)
|
38
45
|
variable.is_a?(Proc) ? variable.call : variable
|
@@ -12,7 +12,8 @@ class KuberKit::Core::ServiceFactory
|
|
12
12
|
name: service_attrs.name,
|
13
13
|
template_name: service_attrs.template_name,
|
14
14
|
tags: service_attrs.tags,
|
15
|
-
images: service_attrs.images
|
15
|
+
images: service_attrs.images,
|
16
|
+
attributes: service_attrs.attributes || {}
|
16
17
|
)
|
17
18
|
end
|
18
19
|
end
|
data/lib/kuber_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuber_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Khaziev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contracts-lite
|