kuber_kit 1.2.4 → 1.2.6
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/CHANGELOG.md +6 -0
- data/README.md +2 -2
- data/kuber_kit.gemspec +1 -1
- data/lib/kuber_kit/actions/configuration_loader.rb +4 -0
- data/lib/kuber_kit/core/context_helper/context_vars.rb +33 -19
- data/lib/kuber_kit/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 536f630ab67b2695dfcbde31648ae12a22445bf2918c415ce43984631dfaf27a
|
|
4
|
+
data.tar.gz: b2994f8e2cd1ccede7c9e18c0b519e7492f5548c3ac0a08ae73d17989ae050ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a8c64a620e1c418c9079cec7e372ee025af8d694c42752584730b26f4839b559136247f21f172040c90c6c181b34d25a52698f73fe7962428f73d0f3d557498f
|
|
7
|
+
data.tar.gz: 5a5cc0c62d3f94c8bc91b90caa4e4c98c63cef520ce8b15d9d673cc5abc3e0067731cb492f1a9dc041a789d56f0b67cfafee25d1054eaa8acb3884bb15d51616
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
**1.2.6**
|
|
2
|
+
- Lock cli-ui version on 2.1.0 (2.2.x has some bugs)
|
|
3
|
+
|
|
4
|
+
**1.2.5**
|
|
5
|
+
- Improve handling ContextVars, ability to convert context var to OpenStruct
|
|
6
|
+
|
|
1
7
|
**1.2.4**
|
|
2
8
|
- Fix a mistake in setting env variables
|
|
3
9
|
- Added an option to set "use local deployment" variable
|
data/README.md
CHANGED
|
@@ -19,8 +19,8 @@ Please install specific kuber_kit version, depending on Ruby version.
|
|
|
19
19
|
| Ruby Version | KuberKit Version |
|
|
20
20
|
| ------------ | ------------ |
|
|
21
21
|
| 2.6 | 1.0.1 |
|
|
22
|
-
| 2.7 | 1.1.
|
|
23
|
-
| > 3.0 | 1.2.
|
|
22
|
+
| 2.7 | 1.1.3 |
|
|
23
|
+
| > 3.0 | 1.2.6 |
|
|
24
24
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
data/kuber_kit.gemspec
CHANGED
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.add_dependency "dry-container", "~> 0.10.1"
|
|
34
34
|
|
|
35
35
|
spec.add_dependency "thor"
|
|
36
|
-
spec.add_dependency "cli-ui"
|
|
36
|
+
spec.add_dependency "cli-ui", '2.1.0'
|
|
37
37
|
spec.add_dependency "net-ssh"
|
|
38
38
|
spec.add_dependency "tty-prompt"
|
|
39
39
|
|
|
@@ -90,6 +90,10 @@ class KuberKit::Actions::ConfigurationLoader
|
|
|
90
90
|
configuration_name = first_configurations.configuration_name
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
+
if configuration_store.count > 1 && configuration_name
|
|
94
|
+
ui.print_info("Configuration", "Using configuration: #{configuration_name.to_s.cyan}")
|
|
95
|
+
end
|
|
96
|
+
|
|
93
97
|
if configuration_store.count > 1 && configuration_name.nil?
|
|
94
98
|
options = all_configurations.map(&:configuration_name).map(&:to_s)
|
|
95
99
|
configuration_name = ui.prompt("Please select configuration name (or set it using -C option)", options)
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
require 'ostruct'
|
|
1
2
|
class KuberKit::Core::ContextHelper::ContextVars
|
|
2
3
|
attr_reader :parent, :parent_name
|
|
3
4
|
|
|
4
5
|
BuildArgUndefined = Class.new(KuberKit::Error)
|
|
5
6
|
|
|
6
|
-
def initialize(context_vars, parent_name = nil
|
|
7
|
+
def initialize(context_vars, parent_name = nil)
|
|
7
8
|
@context_vars = context_vars
|
|
8
9
|
@parent_name = parent_name
|
|
9
|
-
@parent = parent
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
def read(*variable_names)
|
|
12
|
+
def read(*variable_names, default: nil)
|
|
13
|
+
dig(*variable_names)
|
|
14
|
+
rescue BuildArgUndefined
|
|
15
|
+
return default
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def dig(*variable_names)
|
|
13
19
|
result = self
|
|
14
20
|
variable_names.each do |var|
|
|
15
21
|
result = result.get_variable_value(var)
|
|
@@ -18,7 +24,7 @@ class KuberKit::Core::ContextHelper::ContextVars
|
|
|
18
24
|
end
|
|
19
25
|
|
|
20
26
|
def variable_defined?(*variable_names)
|
|
21
|
-
|
|
27
|
+
dig(*variable_names)
|
|
22
28
|
return true
|
|
23
29
|
rescue BuildArgUndefined
|
|
24
30
|
return false
|
|
@@ -29,15 +35,30 @@ class KuberKit::Core::ContextHelper::ContextVars
|
|
|
29
35
|
raise ArgumentError.new("context args does not accept any arguments")
|
|
30
36
|
end
|
|
31
37
|
|
|
32
|
-
|
|
38
|
+
dig(name)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def keys
|
|
42
|
+
@context_vars.keys
|
|
33
43
|
end
|
|
34
44
|
|
|
35
45
|
def to_h
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
values = keys.map do |key|
|
|
47
|
+
value = get_variable_value(key)
|
|
48
|
+
hash_value = value.respond_to?(:to_h) ? value.to_h : value
|
|
49
|
+
[key, hash_value]
|
|
40
50
|
end
|
|
51
|
+
Hash[values]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def to_struct
|
|
55
|
+
values = keys.map do |key|
|
|
56
|
+
value = get_variable_value(key)
|
|
57
|
+
hash_value = value.respond_to?(:to_struct) ? value.to_struct : value
|
|
58
|
+
[key, hash_value]
|
|
59
|
+
end
|
|
60
|
+
hash = Hash[values]
|
|
61
|
+
OpenStruct.new(hash)
|
|
41
62
|
end
|
|
42
63
|
|
|
43
64
|
def get_variable_value(variable_name)
|
|
@@ -46,23 +67,16 @@ class KuberKit::Core::ContextHelper::ContextVars
|
|
|
46
67
|
end
|
|
47
68
|
|
|
48
69
|
if value.is_a?(Hash)
|
|
49
|
-
return self.class.new(value, variable_name
|
|
70
|
+
return self.class.new(value, format_arg(variable_name))
|
|
50
71
|
end
|
|
51
72
|
|
|
52
73
|
value
|
|
53
74
|
end
|
|
54
75
|
|
|
55
76
|
private
|
|
77
|
+
|
|
56
78
|
|
|
57
79
|
def format_arg(name)
|
|
58
|
-
|
|
59
|
-
parent = @parent
|
|
60
|
-
|
|
61
|
-
while parent do
|
|
62
|
-
string = [parent.parent_name, string].compact.join(".")
|
|
63
|
-
parent = parent.parent
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
string
|
|
80
|
+
[@parent_name, name].compact.join(".")
|
|
67
81
|
end
|
|
68
82
|
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: 1.2.
|
|
4
|
+
version: 1.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Iskander Khaziev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-04-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: contracts
|
|
@@ -98,16 +98,16 @@ dependencies:
|
|
|
98
98
|
name: cli-ui
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
|
-
- -
|
|
101
|
+
- - '='
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version:
|
|
103
|
+
version: 2.1.0
|
|
104
104
|
type: :runtime
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
|
-
- -
|
|
108
|
+
- - '='
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version:
|
|
110
|
+
version: 2.1.0
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
112
|
name: net-ssh
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|