Class: RubyHelm::Commands::Base

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

Direct Known Subclasses

Init, Install, Reset, Template, Upgrade

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(binary: nil) ⇒ Base

Returns a new instance of Base.



10
11
12
# File 'lib/ruby_helm/commands/base.rb', line 10

def initialize(binary: nil)
  @binary = binary || RubyHelm.configuration.binary
end

Instance Attribute Details

#binaryObject (readonly)

Returns the value of attribute binary.



8
9
10
# File 'lib/ruby_helm/commands/base.rb', line 8

def binary
  @binary
end

Instance Method Details

#configure_command(builder, opts) ⇒ Object



48
# File 'lib/ruby_helm/commands/base.rb', line 48

def configure_command(builder, opts); end

#do_after(opts) ⇒ Object



50
# File 'lib/ruby_helm/commands/base.rb', line 50

def do_after(opts); end

#do_before(opts) ⇒ Object



46
# File 'lib/ruby_helm/commands/base.rb', line 46

def do_before(opts); end

#execute(opts = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ruby_helm/commands/base.rb', line 26

def execute(opts = {})
  builder = instantiate_builder

  do_before(opts)
  configure_command(builder, opts)
    .build
    .execute(
      stdin:,
      stdout:,
      stderr:
    )
  do_after(opts)
end

#instantiate_builderObject



40
41
42
43
44
# File 'lib/ruby_helm/commands/base.rb', line 40

def instantiate_builder
  Lino::CommandLineBuilder
    .for_command(binary)
    .with_option_separator('=')
end

#stderrObject



22
23
24
# File 'lib/ruby_helm/commands/base.rb', line 22

def stderr
  $stderr
end

#stdinObject



14
15
16
# File 'lib/ruby_helm/commands/base.rb', line 14

def stdin
  nil
end

#stdoutObject



18
19
20
# File 'lib/ruby_helm/commands/base.rb', line 18

def stdout
  $stdout
end