Module: Kontena::Cli::Stacks::Common::StackValuesToOption

Included in:
BuildCommand, InstallCommand, ShowCommand, UpgradeCommand, ValidateCommand
Defined in:
lib/kontena/cli/stacks/common.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valuesObject

Returns the value of attribute values.



77
78
79
# File 'lib/kontena/cli/stacks/common.rb', line 77

def values
  @values
end

Class Method Details

.included(where) ⇒ Object

Include to add –values-to variable value dumping feature



79
80
81
# File 'lib/kontena/cli/stacks/common.rb', line 79

def self.included(where)
  where.option '--values-to', '[FILE]', 'Output variable values as YAML to file'
end

Instance Method Details

#dump_variablesObject

Writes a YAML file from the values received from YAML::Reader to a file defined through the –values-to option



85
86
87
# File 'lib/kontena/cli/stacks/common.rb', line 85

def dump_variables
  File.write(values_to, ::YAML.dump(reader.variable_values, without_defaults: true, without_vault: true))
end