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

Included in:
BuildCommand, InstallCommand, 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

#values ⇒ Object

Returns the value of attribute values.



36
37
38
# File 'lib/kontena/cli/stacks/common.rb', line 36

def values
  @values
end

Class Method Details

.included(where) ⇒ Object



37
38
39
# File 'lib/kontena/cli/stacks/common.rb', line 37

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

Instance Method Details

#dump_variables(reader) ⇒ Object



41
42
43
44
# File 'lib/kontena/cli/stacks/common.rb', line 41

def dump_variables(reader)
  vals = reader.variables.to_h(values_only: true).reject {|k,_| k == 'STACK' || k == 'GRID' }
  File.write(values_to, ::YAML.dump(vals))
end