kerbi 0.0.13 → 0.0.16

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: ca38a5f6ca920ab236cd405551a44dd3415b8ecc746798583aa6e2efe32d53d7
4
- data.tar.gz: '008754026121c9e6e03b68d99da1df0d4a6b906839a4b9e56b7173369f5600b5'
3
+ metadata.gz: dae405be53b5c0a3505a43512bb4551985ae43b4f364a053b9cee99265d99c6d
4
+ data.tar.gz: 6e58d1cbc2945dba01584bf5d687c2be5a5ca01bc6e121f1b938224997114c7a
5
5
  SHA512:
6
- metadata.gz: 0b307cbc7cde2f434fe6887ab6cc467a4b6b97cb9d5ca93a6cb4c776cccce8acefaf37dc30bbe8cf752d943f32c583a30664721ce33ae0c4898aa1e1dc5c039a
7
- data.tar.gz: 0413fdd8e9276992b6802b24d32fb98ee4d21a2df82c33b4806b057d8feb2fea2fcde9f042aba1fd112deaf5f858e4d98adf5be8ec37783554b0a4c95d6ee1c5
6
+ metadata.gz: 33e9e9a0a34833dc0d0822ec2b1764fe3491c7ff616cf8c6d77a428f50010f84a23ea0d72e1f8a5802cf8979fa89eae7e2451625aa1e2fae016c6c7baf700373
7
+ data.tar.gz: 2ffc4c1428bb792432c71c34ba204faf27f1f5bca6f96b7e92165b264db4cb188c64238cd706dafaf3080341a64eef3512d2ef126ab1aedd77f50b49ad00d730
@@ -25,7 +25,9 @@ module Kerbi
25
25
 
26
26
  cmd_meta Kerbi::Consts::CommandSchemas::CONFIG_SHOW
27
27
  def show
28
- echo_data(run_opts.options)
28
+ src = run_opts.options
29
+ hash = Hash[legal_keys.map { |k| [k, src[k]] }]
30
+ echo_data(hash)
29
31
  end
30
32
 
31
33
  cmd_meta Kerbi::Consts::CommandSchemas::CONFIG_RESET
@@ -2,9 +2,11 @@ module Kerbi
2
2
 
3
3
  class Console
4
4
  attr_reader :values
5
+ attr_reader :default_values
5
6
 
6
- def initialize(values)
7
+ def initialize(values, default_values)
7
8
  @values = values
9
+ @default_values = default_values
8
10
  end
9
11
 
10
12
  def to_s
@@ -46,9 +48,11 @@ module Kerbi
46
48
  def console
47
49
  utils::Cli.load_kerbifile(run_opts.project_root)
48
50
  values = compile_values
51
+ default_values = compile_default_values
49
52
  ARGV.clear
50
53
  IRB.setup(eval("__FILE__"), argv: [])
51
- workspace = IRB::WorkSpace.new(Console.new(values))
54
+ wrapper = Console.new(values, default_values)
55
+ workspace = IRB::WorkSpace.new(wrapper)
52
56
  IRB::Irb.new(workspace).run(IRB.conf)
53
57
  end
54
58
 
@@ -28,15 +28,15 @@ module Kerbi
28
28
  KUBE_ACCESS_TOKEN = "k8s-access-token"
29
29
  K8S_USERNAME = "k8s-username"
30
30
  K8S_PASSWORD = "k8s-password"
31
- K8S_TOKEN = "k8s-access-token"
32
31
 
33
32
  LEGAL_CONFIG_FILE_KEYS = [
33
+ LOAD_DEFAULT_VALUES,
34
+ OUTPUT_FMT,
34
35
  STATE_BACKEND_TYPE,
35
36
  K8S_AUTH_TYPE,
37
+ KUBE_CONFIG_PATH,
36
38
  KUBE_CONFIG_CONTEXT,
37
- K8S_USERNAME,
38
- K8S_PASSWORD,
39
- KUBE_ACCESS_TOKEN
39
+ KUBE_ACCESS_TOKEN,
40
40
  ]
41
41
  end
42
42
 
@@ -111,8 +111,8 @@ module Kerbi
111
111
  default: true
112
112
  }.freeze
113
113
 
114
- K8S_TOKEN = {
115
- key: OptionKeys::K8S_TOKEN,
114
+ KUBE_ACCESS_TOKEN = {
115
+ key: OptionKeys::KUBE_ACCESS_TOKEN,
116
116
  desc: "Kubernetes auth bearer token for token auth"
117
117
  }.freeze
118
118
 
@@ -199,7 +199,8 @@ module Kerbi
199
199
  WRITE_STATE,
200
200
  K8S_AUTH_TYPE,
201
201
  KUBE_CONFIG_PATH,
202
- KUBE_CONFIG_CONTEXT
202
+ KUBE_CONFIG_CONTEXT,
203
+ KUBE_ACCESS_TOKEN
203
204
  ].freeze
204
205
 
205
206
  VALUES_OPTIONS = [
@@ -397,6 +398,7 @@ module Kerbi
397
398
  options: [
398
399
  OptionSchemas::OUTPUT_FMT,
399
400
  OptionSchemas::PROJECT_ROOT,
401
+ OptionSchemas::RELEASE_NAME,
400
402
  *OptionSchemas::VALUES_OPTIONS,
401
403
  *OptionSchemas::KUBERNETES_OPTIONS
402
404
  ]
@@ -26,6 +26,10 @@ module Kerbi
26
26
  value || default
27
27
  end
28
28
 
29
+ def release_name
30
+ @release_name || options[consts::RELEASE_NAME]
31
+ end
32
+
29
33
  # @return [TrueClass, FalseClass]
30
34
  def output_yaml?
31
35
  self.output_format == 'yaml'
@@ -124,7 +128,7 @@ module Kerbi
124
128
 
125
129
  # @return [String]
126
130
  def k8s_auth_token
127
- options[consts::K8S_TOKEN]
131
+ options[consts::KUBE_ACCESS_TOKEN]
128
132
  end
129
133
 
130
134
  # @return [String]
@@ -12,5 +12,13 @@ RSpec.describe "$ kerbi values [COMMAND]" do
12
12
  exp_cli_eq_file(cmd, "values", "order-of-precedence", "yaml")
13
13
  end
14
14
  end
15
+
16
+ context "with state" do
17
+ it "parses RELEASE_NAME correctly" do
18
+ # base = "values show --release-name foo"
19
+ # puts cli(base)
20
+
21
+ end
22
+ end
15
23
  end
16
24
  end
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,13 @@
1
1
  require 'tempfile'
2
- require 'simplecov'
3
2
 
3
+ require 'simplecov'
4
4
  SimpleCov.start
5
5
 
6
+ if ENV['UPLOAD_CODECOV']
7
+ require 'codecov'
8
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
9
+ end
10
+
6
11
  require_relative './../lib/kerbi'
7
12
 
8
13
  def run_opts
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kerbi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xavier Millot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-18 00:00:00.000000000 Z
11
+ date: 2022-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http