class Seira::Commands::Kubectl
Attributes
command[R]
context[R]
Public Class Methods
new(command, context:)
click to toggle source
# File lib/seira/commands/kubectl.rb, line 6 def initialize(command, context:) @command = command @context = context end
Public Instance Methods
invoke(clean_output: false, return_output: false)
click to toggle source
# File lib/seira/commands/kubectl.rb, line 11 def invoke(clean_output: false, return_output: false) puts "Calling: #{calculated_command.green}" unless clean_output if return_output `#{calculated_command}` else system(calculated_command) end end
Private Instance Methods
calculated_command()
click to toggle source
# File lib/seira/commands/kubectl.rb, line 23 def calculated_command @_calculated_command ||= begin if context == :none "kubectl #{command}" else "kubectl #{command} --namespace=#{context[:app]}" end end end