Class: RubyHelm::Commands::Upgrade

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_helm/commands/upgrade.rb

Instance Attribute Summary

Attributes inherited from Base

#binary

Instance Method Summary collapse

Methods inherited from Base

#do_after, #do_before, #execute, #initialize, #instantiate_builder, #stderr, #stdin, #stdout

Constructor Details

This class inherits a constructor from RubyHelm::Commands::Base

Instance Method Details

#configure_command(builder, opts) ⇒ Object

rubocop:disable Metrics/MethodLength



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ruby_helm/commands/upgrade.rb', line 10

def configure_command(builder, opts)
  release = opts[:release]
  chart = opts[:chart]
  values = opts[:values] || {}
  should_install = opts[:install]

  paired_values = values.map do |key, value|
    "#{key}=#{value}"
  end

  builder.with_subcommand('upgrade') do |sub|
    unless values.empty?
      sub = sub.with_option(
        '--set',
        paired_values.join(','),
        separator: ' '
      )
    end
    sub = sub.with_flag('--install') if should_install
    sub
  end
         .with_argument(release)
         .with_argument(chart)
end