Class: Kerbi::RunOpts
- Inherits:
-
Object
- Object
- Kerbi::RunOpts
- Defined in:
- lib/config/run_opts.rb
Overview
Convenience accessor struct for getting values from the CLI args. noinspection RubyTooManyMethodsInspection
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #cluster_namespace ⇒ String
- #fname_exprs ⇒ Array<String>
- #initialize(cli_opts, defaults) ⇒ Kerbi::RunOpts constructor
- #inline_val_exprs ⇒ Array<String>
- #k8s_auth_password ⇒ String
- #k8s_auth_token ⇒ String
- #k8s_auth_type ⇒ String
- #k8s_auth_username ⇒ String
- #kube_config_path ⇒ String
- #kube_context_name ⇒ String
- #load_defaults? ⇒ TrueClass, FalseClass
- #output_format ⇒ String
- #output_json? ⇒ TrueClass, FalseClass
- #output_table? ⇒ TrueClass, FalseClass
- #output_yaml? ⇒ TrueClass, FalseClass
- #project_root ⇒ String
- #read_state_from ⇒ String
- #reads_state? ⇒ TrueClass, FalseClass
- #reads_state_strictly? ⇒ TrueClass, FalseClass
- #ruby_version ⇒ String
- #state_backend_type ⇒ String
- #verbose? ⇒ TrueClass, FalseClass
- #write_state_msg ⇒ String
- #write_state_to ⇒ String
- #writes_state? ⇒ TrueClass, FalseClass
Constructor Details
#initialize(cli_opts, defaults) ⇒ Kerbi::RunOpts
14 15 16 17 18 19 |
# File 'lib/config/run_opts.rb', line 14 def initialize(cli_opts, defaults) @options = defaults.deep_dup. merge(Kerbi::ConfigFile.read.deep_dup). merge(cli_opts.deep_dup). freeze end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/config/run_opts.rb', line 9 def @options end |
Instance Method Details
#cluster_namespace ⇒ String
108 109 110 |
# File 'lib/config/run_opts.rb', line 108 def cluster_namespace [consts::NAMESPACE] end |
#fname_exprs ⇒ Array<String>
48 49 50 |
# File 'lib/config/run_opts.rb', line 48 def fname_exprs [consts::VALUE_FNAMES] end |
#inline_val_exprs ⇒ Array<String>
53 54 55 |
# File 'lib/config/run_opts.rb', line 53 def inline_val_exprs [consts::INLINE_ASSIGNMENT] end |
#k8s_auth_password ⇒ String
123 124 125 |
# File 'lib/config/run_opts.rb', line 123 def k8s_auth_password [consts::K8S_PASSWORD] end |
#k8s_auth_token ⇒ String
128 129 130 |
# File 'lib/config/run_opts.rb', line 128 def k8s_auth_token [consts::K8S_TOKEN] end |
#k8s_auth_type ⇒ String
93 94 95 |
# File 'lib/config/run_opts.rb', line 93 def k8s_auth_type [consts::K8S_AUTH_TYPE] end |
#k8s_auth_username ⇒ String
118 119 120 |
# File 'lib/config/run_opts.rb', line 118 def k8s_auth_username [consts::K8S_USERNAME] end |
#kube_config_path ⇒ String
98 99 100 |
# File 'lib/config/run_opts.rb', line 98 def kube_config_path [consts::KUBE_CONFIG_PATH] end |
#kube_context_name ⇒ String
103 104 105 |
# File 'lib/config/run_opts.rb', line 103 def kube_context_name [consts::KUBE_CONFIG_CONTEXT] end |
#load_defaults? ⇒ TrueClass, FalseClass
58 59 60 |
# File 'lib/config/run_opts.rb', line 58 def load_defaults? [consts::LOAD_DEFAULT_VALUES].present? end |
#output_format ⇒ String
22 23 24 25 |
# File 'lib/config/run_opts.rb', line 22 def output_format value = [consts::OUTPUT_FMT] value || default end |
#output_json? ⇒ TrueClass, FalseClass
38 39 40 |
# File 'lib/config/run_opts.rb', line 38 def output_json? self.output_format == 'json' end |
#output_table? ⇒ TrueClass, FalseClass
33 34 35 |
# File 'lib/config/run_opts.rb', line 33 def output_table? self.output_format == 'table' end |
#output_yaml? ⇒ TrueClass, FalseClass
28 29 30 |
# File 'lib/config/run_opts.rb', line 28 def output_yaml? self.output_format == 'yaml' end |
#project_root ⇒ String
138 139 140 |
# File 'lib/config/run_opts.rb', line 138 def project_root [consts::PROJECT_ROOT].presence end |
#read_state_from ⇒ String
63 64 65 |
# File 'lib/config/run_opts.rb', line 63 def read_state_from [consts::READ_STATE].presence end |
#reads_state? ⇒ TrueClass, FalseClass
78 79 80 |
# File 'lib/config/run_opts.rb', line 78 def reads_state? read_state_from.present? end |
#reads_state_strictly? ⇒ TrueClass, FalseClass
83 84 85 |
# File 'lib/config/run_opts.rb', line 83 def reads_state_strictly? [consts::STRICT_READ_STATE] end |
#ruby_version ⇒ String
43 44 45 |
# File 'lib/config/run_opts.rb', line 43 def ruby_version [consts::RUBY_VER] end |
#state_backend_type ⇒ String
113 114 115 |
# File 'lib/config/run_opts.rb', line 113 def state_backend_type [consts::STATE_BACKEND_TYPE] end |
#verbose? ⇒ TrueClass, FalseClass
73 74 75 |
# File 'lib/config/run_opts.rb', line 73 def verbose? [consts::VERBOSE].present? end |
#write_state_msg ⇒ String
133 134 135 |
# File 'lib/config/run_opts.rb', line 133 def write_state_msg [consts::WRITE_STATE_MESSAGE] end |
#write_state_to ⇒ String
68 69 70 |
# File 'lib/config/run_opts.rb', line 68 def write_state_to [consts::WRITE_STATE].presence end |
#writes_state? ⇒ TrueClass, FalseClass
88 89 90 |
# File 'lib/config/run_opts.rb', line 88 def writes_state? write_state_to.present? end |