Class: Podjumper::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/podjumper/command.rb

Instance Method Summary collapse

Constructor Details

#initialize(info) ⇒ Command

Returns a new instance of Command.



3
4
5
6
7
# File 'lib/podjumper/command.rb', line 3

def initialize(info)
  @namespace = info.namespace
  @pod       = info.pod_name
  @container = info.container_name
end

Instance Method Details

#exec(command) ⇒ Object



9
10
11
12
13
# File 'lib/podjumper/command.rb', line 9

def exec(command)
  IO.popen(exec_command + command, in: :in) do |io|
    io.each_char(&method(:print))
  end
end

#logsObject



15
16
17
18
19
20
# File 'lib/podjumper/command.rb', line 15

def logs
  tty = TTY::Command.new(printer: :null)
  tty.run(*logs_command) do |out, _|
    puts out unless ping?(out)
  end
end